/* Patel Omnix - Glassmorphism Design System */
:root {
    --primary: #7dd3fc;
    --secondary: #6366f1;
    --accent: #a78bfa;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-blur: 20px;
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.65);
    --bg-gradient-1: #1e1b4b;
    --bg-gradient-2: #312e81;
    --bg-gradient-3: #0e7490;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --radius: 24px;
    --radius-sm: 12px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

[data-theme="light"] {
    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-border: rgba(255, 255, 255, 0.8);
    --text: #1e293b;
    --text-muted: rgba(30, 41, 59, 0.65);
    --bg-gradient-1: #e0e7ff;
    --bg-gradient-2: #c7d2fe;
    --bg-gradient-3: #a5f3fc;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-body {
    background: linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 40%, var(--bg-gradient-3) 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

.app-body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(125, 211, 252, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(167, 139, 250, 0.25) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

#app { position: relative; z-index: 1; min-height: 100vh; }

/* Glass components */
.glass-card, .glass-panel, .glass-bar {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.glass-bar {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
}

/* Screens */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

#login-screen {
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    text-align: center;
}

.login-card .logo {
    width: 120px;
    height: auto;
    margin-bottom: 1.5rem;
}

.login-card h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }
.subtitle { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.95rem; }
.footer-link { margin-top: 1.5rem; font-size: 0.875rem; }
.footer-link a { color: var(--primary); text-decoration: none; }

/* Nav */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.1rem;
}

.nav-logo { width: 36px; height: 36px; object-fit: contain; }
.nav-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.user-badge {
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    background: rgba(255,255,255,0.1);
    border-radius: 999px;
}

/* Dashboard layout */
.dashboard-layout {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 60px);
}

.sidebar {
    width: 220px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-radius: 0;
    border-top: none;
    flex-shrink: 0;
}

.tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tab-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.tab-btn.active {
    background: rgba(125, 211, 252, 0.15);
    border-color: rgba(125, 211, 252, 0.3);
    color: var(--primary);
}

.main-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.7rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

[data-theme="light"] .form-group input,
[data-theme="light"] .form-group select,
[data-theme="light"] .form-group textarea {
    background: rgba(255, 255, 255, 0.6);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-inline { display: flex; gap: 0.5rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: rgba(125, 211, 252, 0.35);
    color: var(--text);
    border: 1px solid rgba(125, 211, 252, 0.5);
}
.btn-primary:hover { background: rgba(125, 211, 252, 0.5); transform: translateY(-1px); }

.btn-secondary {
    background: rgba(99, 102, 241, 0.3);
    color: var(--text);
    border: 1px solid rgba(99, 102, 241, 0.4);
}
.btn-secondary:hover { background: rgba(99, 102, 241, 0.45); }

.btn-success {
    background: rgba(52, 211, 153, 0.3);
    color: var(--text);
    border: 1px solid rgba(52, 211, 153, 0.5);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
}
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.06); }

.btn-warning { background: rgba(251, 191, 36, 0.3); border: 1px solid rgba(251, 191, 36, 0.5); color: var(--text); }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1rem; }

.badge {
    background: var(--secondary);
    color: #fff;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
}

/* Invoice workspace */
.invoice-workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.form-panel, .preview-panel, .settings-panel {
    padding: 1.5rem;
}

.form-panel h2, .preview-panel h2 { margin-bottom: 1.25rem; font-size: 1.25rem; }
.form-panel h3 { margin: 1.25rem 0 0.75rem; font-size: 0.95rem; color: var(--primary); }

.item-row {
    display: grid;
    grid-template-columns: 2fr 0.7fr 0.9fr 0.9fr auto;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: end;
}

.item-row input { font-size: 0.85rem; padding: 0.5rem 0.7rem; }
.item-remove {
    background: rgba(248, 113, 113, 0.2);
    border: 1px solid rgba(248, 113, 113, 0.4);
    color: var(--danger);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1.1rem;
}

.preview-panel { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow: auto; }
.invoice-preview-wrap {
    transform: scale(0.55);
    transform-origin: top left;
    width: 181.8%;
    pointer-events: none;
}

.quota-info { margin-top: 1rem; font-size: 0.85rem; color: var(--text-muted); }

/* Settings grid */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}
.settings-grid .full { grid-column: 1 / -1; }

/* Tables */
.table-wrap { overflow-x: auto; margin-top: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--glass-border); }
th { color: var(--text-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; }
tr:hover td { background: rgba(255,255,255,0.03); }

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-card {
    padding: 1.5rem;
    text-align: center;
}
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.25rem; }

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}
.modal.hidden { display: none; }
.modal-card { width: 100%; max-width: 480px; padding: 2rem; }

/* Impersonate banner */
.impersonate-banner {
    background: rgba(251, 191, 36, 0.2);
    border-bottom: 1px solid rgba(251, 191, 36, 0.4);
    padding: 0.5rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.impersonate-banner.hidden { display: none; }

.drive-status { margin: 1rem 0; padding: 1rem; background: rgba(0,0,0,0.15); border-radius: var(--radius-sm); }
.drive-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
#folder-select-wrap { margin-top: 1rem; }
#folder-select-wrap select { width: 100%; margin: 0.5rem 0; }

.pending-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(0,0,0,0.15);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hidden { display: none !important; }

/* Landing page */
.landing-body { overflow-x: hidden; }
.landing-bg {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 35%, #0891b2 70%, #6366f1 100%);
    z-index: 0;
}
.landing-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hero {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem 4rem;
}

.hero-content {
    max-width: 720px;
    padding: 3rem;
    text-align: center;
}

.hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    line-height: 1.2;
    margin-bottom: 1rem;
}

.hero-app-name {
    font-size: clamp(2.5rem, 6vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
    background: linear-gradient(135deg, #fff 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-tagline {
    font-size: 1rem;
    color: var(--primary);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 1.25rem;
}

.hero-sub { font-size: 1.15rem; color: var(--text-muted); margin-bottom: 2rem; }
.hero-cta { display: flex; justify-content: center; gap: 1rem; }

/* About / Purpose — Google OAuth verification */
.about-app {
    position: relative;
    z-index: 1;
    padding: 2rem 2rem 4rem;
    max-width: 900px;
    margin: 0 auto;
}

.about-card {
    padding: 2.5rem;
    margin-bottom: 1.5rem;
}

.about-card h3 {
    font-size: 1.05rem;
    color: var(--primary);
    margin: 1.5rem 0 0.75rem;
}

.about-lead {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.about-list {
    list-style: disc;
    padding-left: 1.5rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
}

.about-list li { margin-bottom: 0.5rem; }

.about-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 0.75rem;
}

.about-card a { color: var(--primary); }

.about-es { opacity: 0.92; }

.nav-brand .brand-name {
    font-weight: 800;
    font-size: 1.15rem;
}

.features, .pricing {
    position: relative;
    z-index: 1;
    padding: 4rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2.5rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

.feature-card { padding: 2rem; }
.feature-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.feature-card h3 { margin-bottom: 0.75rem; font-size: 1.1rem; }
.feature-card p { color: var(--text-muted); font-size: 0.9rem; }

.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.plan-card {
    padding: 2rem;
    text-align: center;
    position: relative;
}
.plan-card.featured {
    border-color: var(--primary);
    transform: scale(1.03);
}
.plan-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #1e293b;
    padding: 0.2rem 1rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}
.plan-price { font-size: 2.5rem; font-weight: 700; margin: 1rem 0; color: var(--primary); }
.plan-price small { font-size: 0.9rem; font-weight: 400; color: var(--text-muted); }
.plan-card ul { list-style: none; text-align: left; }
.plan-card li { padding: 0.4rem 0; color: var(--text-muted); font-size: 0.9rem; }
.plan-card li::before { content: '✓ '; color: var(--success); }
.pricing-note { text-align: center; margin-top: 2rem; color: var(--text-muted); }

.landing-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.landing-footer a { color: var(--primary); text-decoration: none; }

/* Toast */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    z-index: 9999;
    animation: slideIn 0.3s ease;
    max-width: 360px;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Offline indicator */
.offline-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(251, 191, 36, 0.9);
    color: #1e293b;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 9998;
    display: none;
}
.offline-bar.show { display: block; }

/* Responsive */
@media (max-width: 1024px) {
    .invoice-workspace { grid-template-columns: 1fr; }
    .preview-panel { position: static; max-height: none; }
    .invoice-preview-wrap { transform: scale(0.75); width: 133.3%; }
}

@media (max-width: 768px) {
    .dashboard-layout { flex-direction: column; }
    .sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        padding: 0.5rem;
        border-radius: 0;
    }
    .tab-btn { white-space: nowrap; flex-shrink: 0; }
    .form-row { grid-template-columns: 1fr; }
    .item-row {
        grid-template-columns: 1fr 1fr;
        background: rgba(0,0,0,0.1);
        padding: 0.75rem;
        border-radius: var(--radius-sm);
    }
    .item-row input:first-child { grid-column: 1 / -1; }
    .landing-nav { padding: 0.75rem 1rem; }
    .hero-content { padding: 2rem 1.5rem; }
    .nav-actions .btn-sm { padding: 0.35rem 0.6rem; font-size: 0.75rem; }
}

@media (max-width: 480px) {
    .invoice-preview-wrap { transform: scale(0.5); width: 200%; }
    .login-card { padding: 1.5rem; }
}

/* Print - hide app chrome */
@media print {
    body * { visibility: hidden; }
    .invoice-print, .invoice-print * { visibility: visible; }
    .invoice-print { position: absolute; left: 0; top: 0; width: 100%; }
}
