:root {
    --bg-color: #000000;
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --danger: #ef4444;
    --success: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Glassmorphism utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
}

/* Auth Overlays */
.overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95); z-index: 2000;
    display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(15px);
}
.overlay.active { display: flex; }

.auth-card {
    width: 90%; max-width: 420px; padding: 45px; text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.auth-card h2 { font-size: 28px; font-weight: 800; margin: 20px 0 10px; }
.auth-card p { color: var(--text-secondary); margin-bottom: 35px; font-size: 15px; }

.input-group { position: relative; margin-bottom: 18px; width: 100%; }
.input-group input {
    width: 100%; padding: 18px 22px; background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border); border-radius: 16px;
    color: white; outline: none; font-size: 16px; transition: all 0.3s;
}
.input-group input:focus { border-color: white; background: rgba(255,255,255,0.07); }

.auth-switch { margin-top: 25px; font-size: 14px; color: var(--text-secondary); }
.auth-switch span { color: white; cursor: pointer; text-decoration: underline; font-weight: 600; }

/* Admin Panel */
.admin-panel {
    width: 95%; max-width: 850px; padding: 40px; max-height: 85vh; overflow-y: auto;
}
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.admin-header h2 { font-weight: 800; font-size: 24px; }

table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th { text-align: left; padding: 15px; font-size: 12px; color: var(--text-secondary); border-bottom: 1px solid var(--glass-border); text-transform: uppercase; letter-spacing: 1px; }
td { padding: 18px 15px; border-bottom: 1px solid var(--glass-border); font-size: 15px; }

/* Layout */
.app-container { display: flex; min-height: 100vh; }

.sidebar {
    width: 300px; height: calc(100vh - 40px); margin: 20px; padding: 35px 25px;
    display: flex; flex-direction: column; position: sticky; top: 20px;
    z-index: 100;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s;
}

.sidebar.nav-hidden {
    transform: translateY(-120%);
}

@media (min-width: 1025px) {
    .sidebar.nav-hidden {
        transform: none; /* Don't hide sidebar on desktop */
    }
}

.logo { display: flex; align-items: center; gap: 15px; font-size: 24px; font-weight: 800; margin-bottom: 50px; }
.logo-icon { width: 42px; height: 42px; background: white; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: black; font-size: 20px; }

.nav-links { list-style: none; flex: 1; }
.nav-links li { 
    padding: 16px 22px; border-radius: 18px; cursor: pointer; color: var(--text-secondary); 
    margin-bottom: 10px; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-links li.active { background: white; color: black; font-weight: 700; box-shadow: 0 10px 30px rgba(255,255,255,0.1); transform: translateY(-2px); }
.nav-links li:hover:not(.active) { background: rgba(255,255,255,0.06); color: white; }
.nav-item-content { display: flex; align-items: center; gap: 14px; font-size: 16px; }

.sidebar-footer { border-top: 1px solid var(--glass-border); padding-top: 25px; display: flex; flex-direction: column; gap: 12px; }

/* Main Content Area */
.content-area { flex: 1; padding: 40px 60px 40px 20px; }

.section-header { margin-bottom: 40px; }
.section-header h1 { font-size: 38px; font-weight: 800; margin-bottom: 8px; letter-spacing: -1px; }
.section-header p { color: var(--text-secondary); font-size: 18px; }

.tool-section { display: none; }
.tool-section.active-section { display: block; animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Scanner */
.scanner-wrapper { max-width: 600px; margin: 0 auto; padding: 40px; }
#reader { width: 100%; border-radius: 20px; overflow: hidden; border: none !important; }
.scanner-placeholder { padding: 80px 40px; text-align: center; color: var(--text-secondary); }
.scanner-placeholder i { font-size: 72px; opacity: 0.2; margin-bottom: 30px; }

.result-content { margin: 20px 0; }
#result-text { font-size: 20px; font-weight: 700; word-break: break-all; margin-bottom: 15px; }

.warning-box {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 12px;
    padding: 12px 15px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: #f59e0b;
    margin-top: 10px;
    text-align: left;
}
.warning-box i { font-size: 16px; margin-top: 2px; }

.scanner-actions { display: flex; flex-direction: column; gap: 10px; }
.mobile-only { display: none; }

/* Calculator */
.calc-main-container { display: flex; gap: 40px; flex-wrap: wrap; }
.calc-wrapper { width: 100%; max-width: 400px; padding: 35px; border-radius: 35px; }

.calc-display { 
    background: rgba(255, 255, 255, 0.03); border-radius: 24px; padding: 30px; 
    margin-bottom: 30px; text-align: right; min-height: 140px; display: flex; flex-direction: column; justify-content: flex-end;
}
.calc-current { font-size: 48px; font-weight: 700; word-break: break-all; }
.calc-history { font-size: 16px; color: var(--text-secondary); margin-bottom: 10px; min-height: 20px; }

.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.key { 
    aspect-ratio: 1; border: none; border-radius: 20px; font-size: 24px; font-weight: 600;
    cursor: pointer; background: rgba(255, 255, 255, 0.05); color: white; transition: all 0.2s;
}
.key:active { transform: scale(0.92); background: rgba(255,255,255,0.1); }
.operator-key { background: rgba(255,255,255,0.08); }
.equals-key { background: white; color: black; font-weight: 800; }

.history-panel { flex: 1; min-width: 340px; padding: 30px; max-height: 600px; overflow-y: auto; }
.history-panel h3 { margin-bottom: 25px; font-weight: 800; font-size: 20px; display: flex; align-items: center; gap: 12px; }
.history-item { 
    padding: 18px; border-bottom: 1px solid var(--glass-border); display: flex; justify-content: space-between; align-items: center;
}
.hist-calc { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.hist-date { font-size: 12px; color: var(--text-secondary); }

/* VAT Tools */
.vat-container { max-width: 600px; margin: 0 auto; }
.vat-toggle-wrapper { padding: 8px; margin-bottom: 40px; background: rgba(255,255,255,0.03); border-radius: 22px; }
.vat-toggle { display: flex; gap: 8px; }
.toggle-btn { 
    flex: 1; padding: 18px; border: none; border-radius: 16px; background: transparent; 
    color: var(--text-secondary); font-size: 15px; font-weight: 700; cursor: pointer; transition: all 0.3s;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.toggle-btn.active { background: white; color: black; box-shadow: 0 8px 20px rgba(0,0,0,0.3); }

.vat-calculator { padding: 45px; border-radius: 35px; }
.vat-results { display: flex; flex-direction: column; gap: 18px; }
.result-card { 
    padding: 25px; background: rgba(255,255,255,0.02); border: 1px solid var(--glass-border); 
    border-radius: 22px; display: flex; justify-content: space-between; align-items: center;
}
.highlight-card { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.2); }
.result-label { font-size: 14px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.result-value { font-size: 26px; font-weight: 800; }

/* Global UI Elements */
.btn { padding: 16px; border-radius: 16px; border: none; font-weight: 700; cursor: pointer; font-size: 15px; transition: all 0.3s; width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; }
.primary-btn { background: white; color: black; }
.primary-btn:active { transform: scale(0.96); opacity: 0.9; }
.secondary-btn { background: rgba(255,255,255,0.05); color: white; border: 1px solid var(--glass-border); }
.logout-btn { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.1); }
.icon-btn { background: none; border: none; color: white; cursor: pointer; font-size: 20px; opacity: 0.7; transition: 0.2s; }
.icon-btn:hover { opacity: 1; }

/* Extreme Mobile Optimization */
@media (max-width: 1024px) {
    .app-container { flex-direction: column; }
    .sidebar {
        width: 100%; height: 70px; margin: 0; padding: 0 10px; position: fixed; top: 0; left: 0; right: 0;
        flex-direction: row; border-radius: 0; background: rgba(0, 0, 0, 0.9);
        border: none; border-bottom: 1px solid var(--glass-border); z-index: 1000;
        box-shadow: 0 10px 40px rgba(0,0,0,0.5);
        display: flex; align-items: center; justify-content: center;
        backdrop-filter: blur(20px);
    }
    .sidebar .logo, .sidebar-footer { display: none; }
    .nav-links { display: flex; width: 100%; justify-content: space-around; gap: 10px; list-style: none; margin: 0; padding: 0; }
    .nav-links li { 
        padding: 12px; margin: 0; flex: 1; display: flex; justify-content: center; align-items: center;
        border-radius: 14px; background: transparent; height: 55px; max-width: 100px;
        transition: all 0.2s ease;
    }
    .nav-links li.active { 
        background: rgba(255, 255, 255, 0.1); color: white; 
        box-shadow: none;
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    .nav-links li span { display: none; }
    .nav-links li.mobile-only { display: flex; }
    .nav-links li.logout-nav-item { color: var(--danger); }
    .nav-links li.logout-nav-item i { color: var(--danger); }
    
    .nav-links li .nav-item-content { font-size: 20px; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
    .nav-links li .nav-item-content i { margin: 0; }
    
    .content-area { padding: 90px 20px 40px 20px; }
    .section-header h1 { font-size: 28px; }
    .section-header p { font-size: 14px; }

    .calc-main-container { flex-direction: column; align-items: center; width: 100%; }
    .history-panel { width: 100%; min-width: 100%; margin-top: 20px; padding: 20px; }
    .calc-wrapper { max-width: 100%; padding: 20px; }
    
    .vat-calculator { padding: 20px; }
    #vat-input { font-size: 24px; padding: 18px 15px 18px 50px; }
}

@media (max-width: 480px) {
    .result-card { flex-direction: column; align-items: flex-start; gap: 10px; padding: 20px; }
    .result-value { font-size: 24px; }
    .auth-card { padding: 30px 20px; }
}
