/* CSS Variables for theming */
:root {
    /* Light mode colors */
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #f0f0f0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --accent-color: #FF69B4;
    --accent-hover: #e55a9e;
    --sugarfree-color: #0595D2;
    --regular-color: #FF9800;
    --all-color: #666666;
}

/* Dark mode colors */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
        --text-muted: #888888;
        --border-color: #404040;
        --shadow-color: rgba(0, 0, 0, 0.3);
        --accent-color: #FF69B4;
        --accent-hover: #e55a9e;
        --sugarfree-color: #0595D2;
        --regular-color: #FF9800;
        --all-color: #666666;
    }
}

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

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Sidebar */
.sidebar {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 40px;
    box-shadow: 0 10px 30px var(--shadow-color);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.sidebar-header h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.edition-count {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-weight: 500;
}

.edition-count span {
    font-weight: 700;
    color: var(--accent-color);
}

.search-container {
    margin-bottom: 15px;
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(255, 105, 180, 0.1);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.filter-controls {
    display: flex;
    gap: 10px;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

/* Filter button specific colors */
.filter-btn[data-filter="all"].active,
.filter-btn[data-filter="all"]:hover {
    background: var(--all-color);
    color: white;
    border-color: var(--all-color);
}

.filter-btn[data-filter="sugarfree"].active,
.filter-btn[data-filter="sugarfree"]:hover {
    background: var(--sugarfree-color);
    color: white;
    border-color: var(--sugarfree-color);
}

.filter-btn[data-filter="regular"].active,
.filter-btn[data-filter="regular"]:hover {
    background: var(--regular-color);
    color: white;
    border-color: var(--regular-color);
}

.editions-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

/* Make edition cards consistent height */
.edition-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 25px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    min-height: 450px;
}

.edition-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(255, 105, 180, 0.2);
}

.edition-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.edition-can {
    width: 100px;
    height: 180px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edition-can-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.2));
    transition: all 0.3s ease;
}

.edition-card:hover .edition-can-image {
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.3));
    transform: scale(1.05);
}

.edition-info {
    flex: 1;
    display: grid;
    grid-template-rows: auto auto auto auto auto auto;
    gap: 5px;
}

.edition-info h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.edition-info p {
    font-size: 14px;
    color: var(--text-secondary);
}

.edition-info p:last-of-type {
    font-size: 14px;
    color: var(--text-muted);
    height: 70px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
}

/* Fix flag display in edition cards - prevent truncation */
.edition-info p[style*="font-size: 12px"] {
    font-size: 12px !important;
    color: var(--text-muted) !important;
    margin-bottom: 5px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.3;
    max-height: none;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
    display: block;
}

.flavor-description {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.4;
    height: auto;
    min-height: 60px;
    overflow: visible;
    display: block;
    text-align: center;
    margin: 5px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

/* Edition Tags - make them consistent */
.tag {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
    margin: 2px;
}

.tag-sugarfree {
    background: var(--sugarfree-color);
    color: white;
}

.tag-regular {
    background: var(--regular-color);
    color: white;
}

.edition-tags {
    margin-top: 5px;
    margin-bottom: 15px;
}

/* Product Link Button */
.product-link-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    margin-top: auto;
}

.product-link-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 105, 180, 0.3);
}

/* Country Availability */
.country-availability {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px var(--shadow-color);
}

.country-availability h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 30px;
}

.countries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.country-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
}

.country-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(255, 105, 180, 0.2);
}

.country-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

/* Country flag styles */
.country-flag {
    font-size: 2rem;
    margin-bottom: 10px;
}

.country-flag-img {
    width: 40px;
    height: 30px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Ensure flag tooltips display inline */
.flag-tooltip {
    cursor: pointer;
    transition: transform 0.2s ease;
    display: inline-block;
    margin: 0 1px;
    vertical-align: middle;
}

.country-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.country-editions {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.country-editions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.edition-mini {
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    color: white;
}

/* Special styling for White Edition to improve readability */
.edition-mini[style*="background: #FFFFFF"] {
    background: var(--border-color) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color);
}

/* Country Editions Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 30px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s ease;
}

/* Desktop: Make modal content narrower */
@media (min-width: 1200px) {
    .modal-content {
        max-width: 50%;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 30px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.modal-editions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 20px;
}

.modal-edition-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 450px;
}

.modal-edition-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(255, 105, 180, 0.2);
}

.modal-edition-can {
    width: 80px;
    height: 140px;
    margin: 20px auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-edition-can-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.2));
    transition: all 0.3s ease;
}

.modal-edition-card:hover .modal-edition-can-image {
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.3));
    transform: scale(1.05);
}

.modal-edition-info {
    flex: 1;
    display: grid;
    grid-template-rows: auto auto auto auto auto auto;
    width: 100%;
    gap: 5px;
}

.modal-edition-info h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.modal-edition-info p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.modal-edition-info p:last-of-type {
    font-size: 13px;
    color: var(--text-muted);
    height: 60px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.modal-edition-info p.flavor-description {
    font-size: 12px !important;
    color: var(--text-muted) !important;
    font-style: italic;
    line-height: 1.4;
    height: auto !important;
    min-height: 55px;
    overflow: visible;
    display: block !important;
    text-align: center;
    margin: 5px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.modal-edition-info .edition-tags {
}

.modal-edition-info .product-link-btn {
    margin-top: auto;
}

/* Iframe Modal */
.iframe-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.iframe-modal-content {
    background: var(--bg-secondary);
    border-radius: 20px;
    width: 90%;
    height: 90%;
    max-width: 1200px;
    max-height: 800px;
    position: relative;
    overflow: hidden;
}

.iframe-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.iframe-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.close-iframe-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.3s ease;
    padding: 5px;
}

.close-iframe-modal:hover {
    color: var(--accent-color);
}

.iframe-container {
    height: calc(100% - 80px);
    width: 100%;
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: var(--bg-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar-header {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
    }
    
    .filter-controls {
        width: 100%;
        justify-content: center;
    }
    
    .editions-list {
        grid-template-columns: 1fr;
    }
    
    .countries-grid {
        grid-template-columns: 1fr;
    }
    
    /* Fix mobile country card layout */
    .country-card {
        padding: 15px;
        min-height: auto;
    }
    
    .country-header {
        margin-bottom: 10px;
    }
    
    .country-name {
        font-size: 14px;
    }
    
    .country-editions {
        font-size: 11px;
        margin-bottom: 8px;
    }
    
    .country-editions-list {
        gap: 3px;
    }
    
    .edition-mini {
        padding: 1px 4px;
        font-size: 9px;
    }
    
    /* Fix description text overflow on mobile */
    .edition-info p:last-of-type {
        height: auto;
        min-height: 60px;
        -webkit-line-clamp: 3;
    }
    
    .flavor-description {
        height: auto;
        min-height: 50px;
        font-size: 11px;
        line-height: 1.3;
        margin-bottom: 10px;
    }
    
    /* Fix flag display on mobile */
    .edition-info p[style*="font-size: 12px"] {
        font-size: 11px !important;
        line-height: 1.2;
        margin-bottom: 8px;
    }
    
    .modal-content {
        margin: 20px;
        padding: 20px;
    }
    
    .modal-editions-grid {
        grid-template-columns: 1fr;
    }
    
    .iframe-modal-content {
        width: 95%;
        height: 95%;
    }
    
    .iframe-modal-header {
        padding: 15px 20px;
    }
    
    .iframe-modal-title {
        font-size: 16px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.edition-card,
.country-card {
    animation: fadeIn 0.6s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.modal-content {
    animation: slideIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.iframe-modal-content {
    animation: scaleIn 0.3s ease-out;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.flag-tooltip:hover {
    transform: scale(1.2);
}

.flag-tooltip .country-flag,
.flag-tooltip .country-flag-img,
.flag-tooltip .country-flag-fallback {
    display: inline-block;
    vertical-align: middle;
}

.country-tooltip {
    position: fixed;
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transform: translateY(0);
    transition: all 0.2s ease;
    white-space: nowrap;
}

/* Dark mode tooltip */
@media (prefers-color-scheme: dark) {
    .country-tooltip {
        background: var(--bg-secondary);
        color: var(--text-primary);
        border-color: var(--border-color);
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
} 

.modal-flag-img {
    width: 30px;
    height: 22px;
    object-fit: cover;
    border-radius: 3px;
    margin-right: 8px;
    vertical-align: middle;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
} 