:root {
    --bg-color: #191919;
    /* Dark background similar to screenshot */
    --card-bg: #2b2b2b;
    /* Slightly lighter for cards */
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-blue: #2196f3;
    /* Blue for checkboxes and rating */
    --border-radius: 8px;
    --spacing: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
}

.app-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 60px;
    /* More padding on sides */
}

/* Header & Navigation */
header {
    background-color: var(--card-bg);
    padding: 20px 40px;
    border-bottom: 1px solid #333;
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 30px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
    /* Needed for absolute positioning of child */
}

h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

/* Category Navigation (Segmented Control) */
.category-nav {
    display: flex;
    background-color: #1a1a1a;
    border-radius: 8px;
    padding: 4px;
    position: absolute;
    /* Absolute positioning */
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border: 1px solid #333;
    z-index: 10;
}

.nav-btn {
    background: none;
    border: none;
    color: #888;
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    z-index: 1;
    transition: color 0.3s ease;
}

.nav-btn.active {
    color: white;
}

.nav-slider {
    position: absolute;
    top: 4px;
    left: 0;
    height: calc(100% - 8px);
    background-color: #333;
    border-radius: 6px;
    transition: transform 0.3s ease, width 0.3s ease;
    width: 33.33%;
    /* Initial width, adjusted by JS */
}

.add-btn {
    background-color: white;
    color: black;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.add-btn:hover {
    background-color: #e0e0e0;
}

.plus-icon {
    font-size: 18px;
    font-weight: bold;
}

/* Genre Filter & Sort */
.filter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.genre-filter {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none;
    /* Firefox */
    flex-grow: 1;
}

.sort-dropdown {
    background-color: #1a1a1a;
    color: #888;
    border: 1px solid #444;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.sort-dropdown:hover {
    border-color: #666;
    color: #ccc;
}

.sort-dropdown:focus {
    border-color: white;
    color: white;
}

.genre-filter::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.filter-btn {
    background: none;
    border: 1px solid #444;
    color: #888;
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    font-size: 13px;
}

.filter-btn:hover {
    border-color: #666;
    color: #ccc;
}

.filter-btn.active {
    background-color: white;
    color: black;
    border-color: white;
}

/* Button Styling */
.btn-primary {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid #444;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #3a3a3a;
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid #444;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
}

.btn-secondary:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
}

.btn-danger {
    background-color: transparent;
    color: #ff4444;
    border: 1px solid #ff4444;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-danger:hover {
    background-color: #ff4444;
    color: white;
}

.hidden {
    display: none !important;
}

.mobile-only {
    display: none;
}

/* Gallery Grid */
.movie-gallery {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding-bottom: 40px;
}

@media (min-width: 600px) {
    .movie-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .movie-gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .movie-gallery {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1500px) {
    .movie-gallery {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Movie Card */
.movie-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
    cursor: pointer;
}

.movie-card:hover {
    transform: translateY(-2px);
}

.card-image {
    height: 160px;
    background-size: cover;
    background-position: center;
    background-color: #333;
}

.card-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.movie-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Custom Checkbox */
.checkbox-row {
    display: flex;
    align-items: center;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    user-select: none;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    height: 16px;
    width: 16px;
    background-color: transparent;
    border: 1px solid #666;
    border-radius: 3px;
    margin-right: 8px;
    position: relative;
}

.custom-checkbox:hover input~.checkmark {
    border-color: #888;
}

.custom-checkbox input:checked~.checkmark {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.custom-checkbox input:checked~.checkmark:after {
    display: block;
}

.custom-checkbox .checkmark:after {
    left: 5px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Star Rating */
.rating-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
}

.rating-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 25px;
}

.star-rating {
    display: flex;
    gap: 2px;
}

.star {
    color: #444;
    /* Empty star color */
    font-size: 14px;
}

.star.filled {
    color: #FFD700;
    /* Gold for filled stars */
}

.star.half {
    position: relative;
    color: #444;
}

.star.half::after {
    content: '★';
    position: absolute;
    left: 0;
    top: 0;
    width: 50%;
    overflow: hidden;
    color: #FFD700;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: #1e1e1e;
    width: 90%;
    max-width: 700px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-height: 90vh;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.modal-image-container {
    position: relative;
    width: 100%;
    height: 250px;
}

.modal-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-color: #333;
    cursor: move;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 10px;
    color: white;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.close-modal:hover {
    background: rgba(0, 0, 0, 0.8);
}

.modal-body-content {
    padding: 40px 60px;
}

.modal-title-section {
    margin-bottom: 30px;
}

.modal-title-input {
    background: transparent;
    border: none;
    color: white;
    font-size: 36px;
    font-weight: 700;
    width: 100%;
    padding: 0;
    margin: 0;
}

.modal-title-input:focus {
    outline: none;
}

.modal-properties {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.property-row {
    display: grid;
    grid-template-columns: 24px 140px 1fr;
    align-items: center;
    font-size: 14px;
    min-height: 32px;
}

.property-icon {
    color: #888;
    font-size: 16px;
    display: flex;
    align-items: center;
}

.property-label {
    color: #888;
    font-weight: 500;
}

.property-value {
    color: white;
}

.property-input {
    background: transparent;
    border: 1px solid transparent;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
    transition: background 0.2s, border-color 0.2s;
}

.property-input:hover {
    background: #2b2b2b;
}

.property-input:focus {
    background: #2b2b2b;
    border-color: #444;
    outline: none;
}

.text-input {
    width: 100%;
}

.badge-select {
    background-color: #4a4a4a;
    color: white;
    border-radius: 4px;
    padding: 2px 8px;
    width: auto;
    display: inline-block;
    border: none;
    cursor: pointer;
}

.rating-box {
    width: 60px;
    background: #2b2b2b;
    border: 1px solid #444;
    border-radius: 4px;
    color: white;
    padding: 4px;
    cursor: pointer;
}

.genre-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.genre-tag {
    background-color: #3a3a3a;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}

.genre-tag.selected {
    background-color: #d32f2f;
    /* Red for Krimi */
}

.genre-tag.selected:nth-child(2n) {
    background-color: #7b1fa2;
    /* Purple for Drama */
}

.rating-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-actions {
    margin-top: 40px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid #333;
    padding-top: 20px;
}

/* App Mode Selector */
.app-mode-selector {
    position: relative;
    cursor: pointer;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.dropdown-trigger:hover {
    opacity: 0.8;
}

.mode-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 8px 0;
    min-width: 200px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.mode-dropdown.hidden {
    display: none;
}

.mode-option {
    padding: 8px 16px;
    color: #888;
    transition: all 0.2s;
}

.mode-option:hover {
    background-color: #333;
    color: white;
}

.text-input-filter {
    background-color: #1a1a1a;
    color: white;
    border: 1px solid #444;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    width: 150px;
}

.text-input-filter:focus {
    border-color: white;
}

.filter-group {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-grow: 1;
}

.filter-group.hidden {
    display: none;
}

.vault-field.hidden,
.restaurant-field.hidden {
    display: none;
}

/* Logo Styles */
.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.header-logo {
    height: 50px;
    width: auto;
    object-fit: contain;
}

/* Mobile Optimization */
@media (max-width: 768px) {
    .app-container {
        padding: 10px 16px;
    }

    header {
        padding: 16px;
        margin-bottom: 20px;
        transition: transform 0.3s ease-in-out;
    }

    header.header-hidden {
        transform: translateY(-100%);
    }

    .header-top {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .logo-container {
        justify-content: center;
    }

    .app-mode-selector {
        text-align: center;
        display: flex;
        justify-content: center;
    }

    .category-nav {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        width: 100%;
        justify-content: space-between;
        margin-top: 10px;
    }

    .nav-btn {
        flex: 1;
        padding: 8px 4px;
        font-size: 13px;
        text-align: center;
    }

    .add-btn {
        width: 100%;
        justify-content: center;
    }

    .filter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        display: none;
        /* Hidden by default on mobile */
    }

    .filter-row.visible {
        display: flex;
    }

    .mobile-only {
        display: block;
        /* Show on mobile */
    }

    #mobile-filter-toggle {
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
    }

    .filter-group {
        flex-wrap: wrap;
        gap: 10px;
    }

    .text-input-filter {
        width: 100%;
    }

    .genre-filter {
        width: 100%;
        padding-bottom: 8px;
    }

    /* Modal Mobile */
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-body-content {
        padding: 20px;
    }

    .modal-image-container {
        height: 180px;
    }

    .modal-title-input {
        font-size: 24px;
    }

    .property-row {
        grid-template-columns: 24px 1fr;
        grid-template-rows: auto auto;
        height: auto;
        align-items: start;
        padding: 8px 0;
    }

    .property-icon {
        grid-row: 1;
        grid-column: 1;
        margin-top: 2px;
    }

    .property-label {
        grid-row: 1;
        grid-column: 2;
        margin-bottom: 6px;
        font-size: 13px;
    }

    .property-input,
    .text-value,
    .genre-tags,
    .rating-display,
    .custom-checkbox {
        grid-row: 2;
        grid-column: 2;
        width: 100%;
    }

    .modal-actions {
        flex-direction: column-reverse;
        gap: 10px;
    }

    .btn-primary,
    .btn-secondary,
    .btn-danger {
        width: 100%;
        justify-content: center;
    }
}