/* Modern Mobile-First Dashboard Styles */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #FD5F2F;
    min-height: 100vh;
    line-height: 1.6;
}

/* Header Styling */
.dashboard-header {
    background-color: #FBF7F0;
    padding: 1rem 0 0 0;
    transition: all 0.3s ease;
}

.dashboard-header h1 {
    color: #333;
    margin: 0.5rem 0;
}

.header-nav {
    justify-content: flex-start !important;
    gap: 0;
    margin-top: 1rem;
}

.header-link {
    background-color: rgb(253, 95, 47);
    color: black;
    padding: 0.75rem 3.5rem;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: bold;
    font-family: Inter_Regular, system-ui, sans-serif;
    box-sizing: border-box;
    border-top-right-radius: 35px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    margin-right: -35px;
    position: relative;
    box-shadow: 2px 0 0 rgba(0, 0, 0, 0.1);
}

.header-link:hover {
    background-color: rgb(255, 120, 80);
    color: black;
    transform: none;
    z-index: 10;
}

/* Layer tabs so they overlap properly */
.header-link:nth-child(1) { z-index: 4; }
.header-link:nth-child(2) { z-index: 3; }
.header-link:nth-child(3) { z-index: 2; }
.header-link:nth-child(4) { z-index: 1; }

/* Search Section */
.search-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#search-box {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

#search-box:focus {
    border-color: #C97B73;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

#autocomplete-results {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    margin-top: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.suggestion {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
}

.suggestion:last-child {
    border-bottom: none;
}

.suggestion:hover {
    background: linear-gradient(135deg, rgba(201, 123, 115, 0.1), rgba(184, 106, 97, 0.1));
    color: #C97B73;
}

/* Card Styling */
.dashboard-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    overflow: hidden;
}

.dashboard-card:hover {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}

.card-content {
    padding: 2rem;
}

.card-title {
    background: linear-gradient(135deg, #C97B73, #B86A61);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

/* Chart Containers */
.chart-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.chart-container {
    padding: 1rem;
}

/* Table Styling */
#priceTable {
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

#priceTable th {
    background: linear-gradient(135deg, #C97B73, #B86A61);
    color: white;
    font-weight: 600;
    padding: 1rem;
    text-align: left;
}

#priceTable td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
}

#priceTable tbody tr:hover {
    background: linear-gradient(135deg, rgba(201, 123, 115, 0.05), rgba(184, 106, 97, 0.05));
}

#priceTable a {
    color: #C97B73;
    font-weight: 500;
    text-decoration: none;
}

#priceTable a:hover {
    color: #B86A61;
    text-decoration: underline;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .dashboard-header {
        padding: 0.75rem 0 0 0;
    }
    
    .dashboard-header h1 {
        font-size: 2.5rem;
        margin: 0.25rem 0;
    }
    
    .header-nav {
        justify-content: flex-start !important;
        margin-top: 1rem;
    }
    
    .header-link {
        padding: 0.5rem 2.5rem;
        font-size: 0.9rem;
        background-color: rgb(253, 95, 47);
        border-top-right-radius: 35px;
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        margin-right: -35px;
        font-weight: bold;
        color: black;
        white-space: nowrap;
    }
    
    .card-content {
        padding: 1.5rem;
    }
    
    .card-title {
        font-size: 2rem;
    }
    
    .chart-card {
        margin: 0.5rem;
        border-radius: 12px;
    }
    
    .chart-container {
        padding: 0.5rem;
    }
    
    /* Make table responsive */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    #priceTable {
        min-width: 100%;
        font-size: 0.9rem;
    }
    
    #priceTable th,
    #priceTable td {
        padding: 0.5rem;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .dashboard-header h1 {
        font-size: 2rem;
    }
    
    .header-link {
        padding: 0.4rem 2rem;
        font-size: 0.6rem;
        background-color: rgb(253, 95, 47);
        border-top-right-radius: 25px;
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        margin-right: -25px;
        font-weight: bold;
        color: black;
    }
    
    .card-title {
        font-size: 1.5rem;
    }
    
    .card-content {
        padding: 1rem;
    }
}

/* Animation for loading states */
@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

.loading {
    animation: shimmer 1.5s infinite ease-out;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 400% 100%;
}

/* Utility classes for mobile */
.mobile-hidden {
    display: block;
}

.mobile-only {
    display: none;
}

.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.no-underline {
    text-decoration: none;
}

@media (max-width: 768px) {
    .mobile-hidden {
        display: none;
    }
    
    .mobile-only {
        display: block;
    }
}

/* Expandable Search Container Styles */
.search-container {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.search-container.scanning {
    height: 450px;
    /* Keep the same background and styling as the regular search container */
}

.search-content {
    transition: all 0.3s ease-out;
}

.search-content.hidden {
    opacity: 0;
    transform: translateY(-20px);
}

.scanner-interface {
    opacity: 0;
    transition: all 0.3s ease-out 0.2s;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.scanner-interface.active {
    opacity: 1;
    display: flex;
}

.scanner-header-content {
    position: relative;
    padding: 1rem 0;
    margin-bottom: 1rem;
}

.scanner-header-content h2 {
    margin: 0 0 1rem 0;
}

.close-btn-inline {
    position: absolute;
    top: 1rem;
    right: 0;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    color: #666;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}

.close-btn-inline:hover {
    background-color: rgba(255, 255, 255, 0.95);
    color: #333;
    transform: scale(1.1);
}

.scanner-video-container {
    position: relative;
    flex: 1;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

/* Ensure Quagga-generated elements are properly displayed */
.scanner-video-container video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    position: relative !important;
    z-index: 1 !important;
}

.scanner-video-container canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none !important;
    z-index: 2 !important;
}

#scanner-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-line {
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 2px;
    background: #FD5F2F;
    box-shadow: 0 0 10px #FD5F2F;
    animation: scannerLine 2s ease-in-out infinite;
    z-index: 10;
}

@keyframes scannerLine {
    0%, 100% {
        opacity: 0.5;
        transform: translateY(-50%) scaleX(0.8);
    }
    50% {
        opacity: 1;
        transform: translateY(-50%) scaleX(1);
    }
}

/* Mobile adjustments for expandable scanner */
@media (max-width: 768px) {
    .search-container.scanning {
        height: 400px;
    }
    
    .scanner-video-container {
        border-radius: 8px;
        min-height: 250px;
    }
    
    .scanner-header-content {
        padding: 0.75rem 0;
    }
    
    .close-btn-inline {
        top: 0.75rem;
        font-size: 1.2rem;
        width: 1.75rem;
        height: 1.75rem;
    }
}