/* Theme and Variables mapping */
:root {
    --primary-color: #6b7280;
    --secondary-color: #4b5563;
    --accent-color: #9ca3af;
    --dark-bg: #050505;
    --light-bg: #19191b;
    --tertiary-bg: #23232a;
    --text-light: #fff;
    --text-dark: #333;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    --border-color: #4b5563;
}

[data-theme="light"] {
    --primary-color: #4b5563;
    --secondary-color: #6b7280;
    --accent-color: #4b5563;
    --dark-bg: #f5f5f5;
    --light-bg: #ffffff;
    --tertiary-bg: #e8e8e8;
    --text-light: #1a1a1a;
    --text-dark: #333;
    --border-color: #d1d5db;
}

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

body {
    font-family: Verdana, Geneva, 'DejaVu Sans', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-light);
    background: var(--dark-bg);
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    color: var(--text-light);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Utils */
.hidden {
    display: none !important;
}

.full-width-image {
    width: 100%;
    height: auto;
    object-fit: scale-down;
}

.clickable-image {
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

.clickable-image:hover {
    transform: scale(1.02);
}

#scoring-item-image {
    border-radius: 5px;
    margin-bottom: 15px;
    max-height: 300px;
    background: var(--tertiary-bg);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 3px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    justify-content: center;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
    background: var(--secondary-color);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--text-light);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-icon-only {
    padding: 8px 12px;
    font-size: 1.2em;
    border-radius: 3px;
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon-only:hover {
    background: var(--primary-color);
    color: white;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5em;
    cursor: pointer;
    transition: color 0.3s;
}

.btn-close:hover {
    color: #ff4444;
}

/* Inputs */
.input-field {
    width: 100%;
    padding: 10px;
    background: var(--tertiary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-light);
    border-radius: 3px;
    margin-bottom: 10px;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent-color);
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

/* Editable List Title */
.list-title-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
    flex: 1;
}

.list-title-input {
    font-size: 2em;
    font-weight: bold;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: transparent;
    border: 1px solid transparent;
    border-bottom: 2px solid transparent;
    color: var(--text-light);
    padding: 5px 30px 5px 5px;
    margin: 0;
    width: 100%;
    transition: all 0.3s ease;
}

.list-title-input:hover {
    border-bottom: 2px solid var(--border-color);
}

.list-title-input:focus {
    background: var(--tertiary-bg);
    border-bottom: 2px solid var(--accent-color);
    outline: none;
}

.list-title-container .edit-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
    pointer-events: none;
}

.list-title-input:focus+.edit-icon {
    opacity: 0;
}

/* Dashboard Header Mobile Friendly */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.dashboard-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 250px;
}

.dashboard-header-right {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Cards Grid from main theme */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.card {
    background: var(--light-bg);
    border-radius: 3px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.card.clickable {
    cursor: pointer;
}

.card.clickable:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-color);
}

.card-icon {
    font-size: 3em;
    margin: 0 auto 15px;
    color: var(--primary-color);
}

.card-title {
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.card-description {
    opacity: 0.8;
}

/* Specific Cards */
.item-card {
    padding: 0;
    text-align: left;
    height: auto;
    min-height: 250px;
    justify-content: flex-start;
}

.item-card-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: var(--tertiary-bg);
    border-bottom: 1px solid var(--border-color);
}

.item-card-image-placeholder {
    width: 100%;
    height: 150px;
    background: var(--tertiary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
}

.item-card-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.item-card-score {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--accent-color);
    text-align: right;
    margin-top: auto;
}

/* Theme Toggle */
.language-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.lang-btn {
    padding: 8px 12px;
    background: var(--light-bg);
    border: 1px solid var(--primary-color);
    border-radius: 3px;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: var(--primary-color);
}

/* Views */
.view {
    animation: fadeIn 0.3s ease;
    padding-top: 40px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header {
    text-align: center;
    margin-bottom: 40px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    overflow-y: auto;
}

.modal-content {
    background: var(--light-bg);
    padding: 30px;
    border-radius: 5px;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--primary-color);
    position: relative;
    margin: auto;
    max-height: 90vh;
    overflow-y: auto;
}

/* Drag and Drop Zone */
.image-drop-zone {
    border: 2px dashed var(--primary-color);
    border-radius: 5px;
    padding: 30px 10px;
    text-align: center;
    cursor: pointer;
    background: var(--tertiary-bg);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.image-drop-zone:hover,
.image-drop-zone.dragover {
    background: var(--light-bg);
    border-color: var(--accent-color);
}

.image-drop-zone img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 10;
}

/* Tags */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.tag .remove-tag {
    cursor: pointer;
    opacity: 0.7;
}

.tag .remove-tag:hover {
    opacity: 1;
}

/* Scoring Controls */
.scoring-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.score-slider-container {
    background: var(--tertiary-bg);
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
}

.score-slider-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    align-items: center;
}

input[type=range] {
    width: 100%;
    accent-color: var(--accent-color);
}

.smart-suggestion {
    font-size: 0.8em;
    color: #4CAF50;
    margin-top: 5px;
    display: block;
}

/* Compare View */
.compare-cards-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    align-items: center;
}

.compare-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.compare-vs {
    font-size: 2em;
    color: var(--primary-color);
    font-weight: bold;
}

.compare-img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 10px;
}

.current-score-text {
    font-size: 0.9em;
    opacity: 0.7;
}

.error-msg {
    color: #ff4444;
    font-size: 0.9em;
    margin-top: 5px;
}

/* Fullscreen Overlay */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.fullscreen-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: zoom-out;
}

.fullscreen-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    z-index: 3010;
}

.fullscreen-content img {
    max-width: 100%;
    max-height: 95vh;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    border-radius: 5px;
}

.fullscreen-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 2.5em;
    cursor: pointer;
    z-index: 3020;
    opacity: 0.7;
    transition: opacity 0.2s;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.fullscreen-close:hover {
    opacity: 1;
}

/* Responsive Media Queries */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-header-left {
        width: 100%;
    }

    .list-title-input {
        font-size: 1.5em;
    }

    .hide-mobile {
        display: none;
    }

    .dashboard-header-right .btn {
        flex: 1;
        padding: 10px;
    }

    .scoring-layout {
        grid-template-columns: 1fr;
    }

    .compare-cards-container {
        flex-direction: column;
    }

    .compare-vs {
        margin: 10px 0;
    }

    .modal-content {
        padding: 20px;
    }

    /* Tags add responsive */
    #item-editor-view .form-group>div[style*="flex-wrap: wrap"] {
        flex-direction: column;
        align-items: stretch !important;
    }

    .fullscreen-close {
        top: 10px;
        right: 10px;
        font-size: 2em;
    }
}