@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap');

:root {
    --bg-dark: #0a0f1d;
    --bg-card: #12192c;
    --bg-card-hover: #1b2640;
    --bg-header: #070b16;
    --border-color: #1e2d4a;
    --border-focus: #00d4ff;
    
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-accent: #00d4ff;
    --text-yellow: #fbbf24;
    --text-green: #34d399;
    --text-red: #f87171;

    --btn-primary-bg: linear-gradient(135deg, #0052d4, #4364f7, #6fb1fc);
    --btn-primary-hover: linear-gradient(135deg, #0043b3, #3452db, #599df7);

    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* App Container Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Top Header Bar */
.tally-header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 48px;
}

.tally-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
    color: var(--text-accent);
    letter-spacing: 0.5px;
}

.tally-brand .badge {
    background: #00d4ff22;
    border: 1px solid var(--text-accent);
    color: var(--text-accent);
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
}

.user-info {
    color: var(--text-secondary);
}
.user-info strong {
    color: var(--text-yellow);
}

/* Main Layout Split: Content + Menu Panel */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.workspace {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: radial-gradient(circle at top left, #141e33 0%, var(--bg-dark) 70%);
}

.menu-panel {
    width: 260px;
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 8px;
    overflow-y: auto;
}

/* Custom Scrollbar */
.menu-panel::-webkit-scrollbar, .workspace::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.menu-panel::-webkit-scrollbar-track, .workspace::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
.menu-panel::-webkit-scrollbar-thumb, .workspace::-webkit-scrollbar-thumb {
    background: #1e2d4a;
    border-radius: 3px;
}
.menu-panel::-webkit-scrollbar-thumb:hover, .workspace::-webkit-scrollbar-thumb:hover {
    background: var(--text-accent);
}

.menu-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    padding: 4px 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.btn-shortcut {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #182238;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
}

.btn-shortcut:hover, .btn-shortcut:focus {
    background: var(--bg-card-hover);
    border-color: var(--text-accent);
    color: var(--text-accent);
    transform: translateX(-2px);
    outline: none;
}

.btn-shortcut .key-badge {
    background: #0d1424;
    border: 1px solid #2e436e;
    color: var(--text-yellow);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 700;
}

/* Gateway of Tally Box */
.gateway-box {
    max-width: 650px;
    margin: 40px auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.gateway-header {
    background: #16223a;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gateway-header h2 {
    font-size: 16px;
    color: var(--text-accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

.gateway-body {
    padding: 20px;
}

.gateway-section {
    margin-bottom: 20px;
}

.gateway-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-bottom: 10px;
    border-bottom: 1px solid #1a2742;
    padding-bottom: 4px;
}

.gateway-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.gateway-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #162035;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.gateway-item:hover, .gateway-item:focus {
    background: #1c2b4a;
    border-color: var(--text-accent);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.2);
    color: var(--text-accent);
    outline: none;
}

.shortcut-key {
    font-family: var(--font-mono);
    color: var(--text-yellow);
    font-weight: 700;
    text-decoration: underline;
}

/* Tables / Grids */
.tally-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    margin-bottom: 20px;
}

.tally-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.tally-card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-accent);
}

.tally-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 13px;
}

.tally-table th {
    background: #16223a;
    color: var(--text-secondary);
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.tally-table th.text-right, .tally-table td.text-right {
    text-align: right;
}

.tally-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #162035;
    color: var(--text-primary);
}

.tally-table tr:hover {
    background: #162440;
}

.tally-table tr.total-row {
    background: #172645;
    font-weight: 700;
    border-top: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
}

.tally-table tr.total-row td {
    color: var(--text-yellow);
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    background: #0a1120;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--text-accent);
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
    outline: none;
    background: #0f192e;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--btn-primary-bg);
    color: #fff;
}

.btn-primary:hover {
    background: var(--btn-primary-hover);
    box-shadow: 0 4px 15px rgba(67, 100, 247, 0.4);
}

.btn-secondary {
    background: #1e2d4a;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #283c63;
}

.btn-danger {
    background: #991b1b;
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Flash Notifications */
.flash-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.flash-success {
    background: rgba(52, 211, 153, 0.15);
    border: 1px solid var(--text-green);
    color: var(--text-green);
}

.flash-error {
    background: rgba(248, 113, 113, 0.15);
    border: 1px solid var(--text-red);
    color: var(--text-red);
}

/* Bottom Status Bar */
.status-bar {
    background: var(--bg-header);
    border-top: 1px solid var(--border-color);
    padding: 6px 16px;
    height: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-item strong {
    color: var(--text-yellow);
}

/* Badges */
.badge-dr {
    background: rgba(251, 191, 36, 0.15);
    color: var(--text-yellow);
    border: 1px solid var(--text-yellow);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.badge-cr {
    background: rgba(0, 212, 255, 0.15);
    color: var(--text-accent);
    border: 1px solid var(--text-accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
}

/* Login Page Styling */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #162440 0%, #080c17 100%);
}

.login-card {
    width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-header h1 {
    color: var(--text-accent);
    font-size: 24px;
    margin-bottom: 6px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Print / PDF Styling */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }

    .tally-header, .menu-panel, .status-bar, .btn, .flash-message {
        display: none !important;
    }

    .main-layout {
        display: block !important;
    }

    .workspace {
        padding: 0 !important;
        background: none !important;
    }

    .tally-card {
        background: #ffffff !important;
        border: none !important;
        box-shadow: none !important;
        color: #000000 !important;
    }

    .tally-table th {
        background: #f1f5f9 !important;
        color: #000000 !important;
        border-bottom: 2px solid #000000 !important;
    }

    .tally-table td {
        color: #000000 !important;
        border-bottom: 1px solid #cbd5e1 !important;
    }

    .tally-card-title, .shortcut-key, strong {
        color: #000000 !important;
    }
}
