/* Premium Dark Glassmorphism Theme */

:root {
    /* Deep Space Background */
    --bg-dark: #0f0c29;
    --bg-gradient: linear-gradient(135deg, #0f0c29, #302b63, #24243e);

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #a0a0c0;
    --text-accent: #b19cd9;

    /* Accents */
    --accent-blue: #00c6ff;
    --accent-purple: #9d50bb;
    --accent-gold: #fccb90;

    /* Glass Components */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    --card-radius: 20px;
}

body {
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'SF Pro Display', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 120px;
    /* More space for nav */
}

/* --- Header --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 16px 4px 4px;
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

#user-name {
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.3px;
}

.glass-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 16px;
    outline: none;
    font-size: 13px;
    backdrop-filter: blur(10px);
    appearance: none;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.glass-input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(157, 80, 187, 0.3);
}

/* --- Date Controls --- */
.date-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 32px;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.date-input {
    width: 100%;
    text-align: center;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 0;
}

/* --- Summary Cards --- */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 32px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s;
}

.stat-card:active {
    transform: scale(0.96);
}

.stat-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    /* Removing float animation for cleaner look, or keeping it subtle? keeping subtle */
    /* animation: float 6s ease-in-out infinite; */
}

.stat-card h3 {
    margin: 0 0 4px 0;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    font-weight: 600;
}

.stat-card .value {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.3px;
}

/* --- Charts --- */
.chart-container-glass {
    position: relative;
    padding: 24px;
    border-radius: 28px;
    margin-bottom: 32px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.chart-container-glass h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(90deg, #fff, #a0a0c0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- SKU Grid --- */
.top-sku h3 {
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
    padding-left: 8px;
}

.sku-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.sku-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.sku-card:active {
    transform: scale(0.98);
}

.sku-img-container {
    aspect-ratio: 3/4;
    overflow: hidden;
    position: relative;
    background: #0f0c29;
}

.sku-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.sku-card:hover .sku-img {
    transform: scale(1.05);
}

.sku-card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 12px;
    background: linear-gradient(to top, rgba(15, 12, 41, 0.95), rgba(15, 12, 41, 0));
}

.sku-card-price {
    font-weight: 700;
    color: #fff;
    font-size: 15px;
    margin-bottom: 4px;
}

.sku-card-name {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- MODAL (Refined) --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    /* Darker backdrop */
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease-out;
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #1a1a2e;
    /* Solid dark color for readability */
    width: 90%;
    max-width: 400px;
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 32px 24px;
    position: relative;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    max-height: 85vh;
    overflow-y: auto;
}

/* Close Button (Premium) */
.close-modal {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    color: #fff;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 10002;
    transition: transform 0.2s, background 0.2s;
}

.close-modal:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.2);
}

.modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 24px;
    width: 100%;
}

.modal-product-img {
    width: 140px;
    height: 180px;
    object-fit: cover;
    border-radius: 16px;
    margin-bottom: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-title-block h2 {
    font-size: 18px;
    margin: 0 0 6px 0;
    color: #fff;
    font-weight: 600;
}

.modal-title-block span {
    font-size: 12px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 8px;
}

/* Modal Tabs */
.modal-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 20px;
    width: 100%;
}

.modal-tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-tab.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.modal-tab-content {
    display: none;
    width: 100%;
    animation: fadeIn 0.3s ease;
}

.modal-tab-content.active {
    display: block;
}

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

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

.modal-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    margin-bottom: 24px;
}

.modal-stat {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-stat .label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.modal-stat .val {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.highlight-green {
    color: #4ade80 !important;
}

.btn-primary {
    background: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
    border: none;
    color: white;
    padding: 14px 24px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    font-size: 15px;
    box-shadow: 0 8px 20px rgba(0, 114, 255, 0.3);
    transition: transform 0.2s;
    margin-top: 10px;
}

.btn-primary:active {
    transform: scale(0.97);
}

/* --- BOTTOM NAV (Premium Dock) --- */
.bottom-nav {
    position: fixed;
    bottom: 0px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    padding: 16px 20px calc(25px + env(safe-area-inset-bottom)) 20px;
    /* Clean Blur Background */
    background: rgba(21, 21, 35, 0.85);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    z-index: 9999;
    /* Floating look via box-shadow */
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 16px;
    color: #6b7280;
    /* Dimmed */
    cursor: pointer;
    background: transparent;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    flex: 1;
    max-width: 100px;
    user-select: none;
    touch-action: manipulation;
}

.nav-item.active {
    color: #fff;
    /* White active */
    /* background: rgba(255, 255, 255, 0.1); -> Just icon color change for cleaner ios look */
    transform: translateY(-2px);
}

.nav-item.active .nav-icon {
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.4));
    transform: scale(1.1);
}

.nav-icon {
    font-size: 24px;
    transition: all 0.25s;
    margin-bottom: 2px;
}

.nav-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Misc classes */
.glass {
    /* Helper for misc glass elements */
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: var(--glass-border);
    border-radius: 20px;
}

.hidden {
    display: none !important;
}

/* AI Specific Styles */
.ai-block {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    border-left: 3px solid var(--accent-purple);
}

.ai-block h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: var(--accent-purple);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-block p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #ddd;
}

.highlight-text {
    color: #fff;
    font-weight: 500;
    margin-top: 4px;
}

.text-mute {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
}