/**
 * ============================================================
 * CASHIER'S DAILY BALANCE SYSTEM
 * Main Stylesheet
 * ============================================================
 */

/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-color: #1e293b;
    --text-muted: #64748b;
    
    --header-height: 60px;
    --sidebar-width: 250px;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    --transition: all 0.2s ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    min-height: 100vh;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 0.5em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

.text-muted { color: var(--text-muted); }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }
.text-primary { color: var(--primary-color); }

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

.main-content {
    flex: 1;
    padding: 20px;
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
    }
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e3a5f 0%, #0f172a 100%);
    color: white;
    z-index: 200;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo img {
    height: 40px;
    width: auto;
}

.sidebar-logo h1 {
    font-size: 1rem;
    margin: 0;
    line-height: 1.2;
}

.sidebar-logo h1 small {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.7;
}

.sidebar-nav {
    padding: 15px 0;
}

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

.nav-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 20px;
    opacity: 0.5;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
}

.nav-item i {
    width: 20px;
    text-align: center;
}

/* Expandable nav parent */
.nav-parent {
    position: relative;
}

.nav-parent .nav-arrow {
    margin-left: auto;
    font-size: 0.6rem;
    transition: transform 0.25s ease;
    width: auto;
}

.nav-parent.expanded .nav-arrow {
    transform: rotate(90deg);
}

/* Nav children container */
.nav-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0,0,0,0.15);
}

.nav-children.open {
    max-height: 200px;
}

.nav-child {
    padding: 9px 20px 9px 56px !important;
    font-size: 0.8rem;
    opacity: 0.7;
    position: relative;
}

.nav-child::before {
    content: '';
    position: absolute;
    left: 32px;
    top: 50%;
    width: 10px;
    height: 1px;
    background: rgba(255,255,255,0.3);
}

.nav-child i {
    font-size: 0.7rem;
    width: 16px;
}

.nav-child:hover {
    opacity: 1;
    background: rgba(255,255,255,0.08);
}

.nav-child.active {
    opacity: 1;
    background: rgba(255,255,255,0.15);
    color: white;
}

/* Report welcome shortcuts */
.report-shortcut:hover {
    background: rgba(0,0,0,0.04);
}

/* Summary Report KPIs */
.summary-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.summary-breakdown-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* Summary Breakdown Tabs */
.summary-tabs {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
}

.summary-tab {
    padding: 6px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.summary-tab:hover {
    color: #334155;
}

.summary-tab.active {
    background: #fff;
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Not yet posted tab — blinking neon */
@keyframes neon-blink {
    0%, 100% {
        color: #1d4ed8;
        text-shadow: 0 0 6px #3b82f6, 0 0 12px #3b82f6;
    }
    50% {
        color: #93c5fd;
        text-shadow: 0 0 2px #3b82f6;
    }
}

.summary-tab.tab-unposted-alert {
    animation: neon-blink 1.2s ease-in-out infinite;
    font-weight: 700;
}

.summary-tab.tab-unposted-alert.active {
    animation: none;
    color: var(--primary-color);
    text-shadow: none;
}

.bank-result {
    font-weight: 600;
    font-family: 'Consolas', 'Courier New', monospace;
    text-align: center;
    font-size: 0.82rem;
}

.bank-result-match {
    background: #f0fdf4 !important;
    border-color: #22c55e !important;
    color: #166534 !important;
}

.bank-result-nomatch {
    background: #fef2f2 !important;
    border-color: #ef4444 !important;
    color: #991b1b !important;
}

.bank-comment-input {
    margin-top: 6px;
    font-size: 0.75rem !important;
    padding: 4px 8px !important;
    height: 30px !important;
    color: #475569;
}

.bank-comment-input::placeholder {
    color: #94a3b8;
    font-style: italic;
}

.bank-update-btn {
    margin-top: 4px;
    width: 100%;
    font-size: 0.72rem;
    padding: 3px 8px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.bank-update-btn:hover:not(:disabled) {
    background: #2563eb;
}

.bank-update-btn:disabled {
    background: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
}

.btn-warning {
    background: #f59e0b;
    color: #fff;
    border: none;
}

.btn-warning:hover {
    background: #d97706;
}

.kpi-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    text-align: center;
}

.kpi-card .kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.kpi-card .kpi-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 4px;
}

.kpi-card.kpi-positive .kpi-value { color: var(--success-color); }
.kpi-card.kpi-negative .kpi-value { color: var(--danger-color); }
.kpi-card.kpi-primary .kpi-value { color: var(--primary-color); }

/* Summary expandable rows */
.summary-category {
    border-bottom: 1px solid var(--border-color);
}

.summary-category:last-child {
    border-bottom: none;
}

.summary-cat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.15s ease;
    user-select: none;
}

/* Grand Total row below all categories */
.summary-grand-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #1e293b;
    border-radius: 0 0 10px 10px;
    margin-top: 2px;
}

.summary-grand-total-label {
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-grand-total-row .cat-odoo-total {
    color: #93c5fd;
}

.summary-grand-total-row .cat-actual-total {
    color: #fff;
}

.summary-grand-total-row .cat-diff-total {
    font-weight: 700;
}

.summary-cat-header:hover {
    background: #f8fafc;
}

.summary-cat-header .cat-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-cat-header .cat-toggle {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background: #f1f5f9;
    font-size: 0.7rem;
    color: #64748b;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.summary-cat-header.expanded .cat-toggle {
    transform: rotate(90deg);
    background: var(--primary-color);
    color: white;
}

.summary-cat-header .cat-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.summary-cat-header .cat-total {
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 24px;
}

.cat-odoo-total {
    color: #2563eb;
    font-weight: 600;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.82rem;
}

.cat-actual-total {
    color: #1e293b;
    font-weight: 600;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.82rem;
}

.cat-diff-total {
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.82rem;
    min-width: 120px;
    text-align: right;
}

.summary-cat-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #f8fafc;
}

.summary-cat-detail.open {
    max-height: 2000px;
    overflow: visible;
}

.summary-table-scroll {
    overflow-x: auto;
    width: 100%;
    max-width: calc(100vw - var(--sidebar-width) - 40px);
}

.summary-detail-table {
    width: max-content;
    font-size: 0.82rem;
    border-collapse: separate;
    border-spacing: 0;
}

.summary-detail-table th {
    padding: 8px 20px;
    text-align: left;
    font-weight: 600;
    color: #64748b;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border-color);
}

.summary-detail-table td {
    padding: 7px 20px;
    border-bottom: 1px solid #e9ecef;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.summary-detail-table td:first-child {
    font-family: inherit;
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 1;
    box-shadow: 2px 0 4px rgba(0,0,0,0.06);
}

.summary-detail-table th:first-child {
    position: sticky;
    left: 0;
    background: #f1f5f9;
    z-index: 2;
    box-shadow: 2px 0 4px rgba(0,0,0,0.06);
}

.summary-bank-row td:first-child,
.summary-bank-subrow td:first-child {
    background: #fff;
}

.summary-bank-row:hover td:first-child {
    background: #f8fafc;
}

.summary-detail-table .right,
.summary-detail-table th.right {
    text-align: right;
}

/* Sticky Total column - always visible on the right */
.summary-detail-table th.sticky-total,
.summary-detail-table td.sticky-total {
    position: sticky;
    right: 0;
    background: #f1f5f9;
    box-shadow: -2px 0 4px rgba(0,0,0,0.06);
    z-index: 1;
}

.summary-detail-table tbody tr:hover td.sticky-total {
    background: #e9f0f7;
}

.summary-detail-table tr[style*="background:#f8fafc"] td.sticky-total {
    background: #eef2f7;
}

/* Expandable bank rows in Credit Cards */
.summary-bank-row.expandable {
    cursor: pointer;
}

.summary-bank-row.expandable:hover {
    background: #f1f5f9;
}

.summary-bank-arrow {
    font-size: 0.6rem;
    color: #94a3b8;
    transition: transform 0.2s;
    margin-right: 6px;
    display: inline-block;
}

.summary-bank-row.expanded .summary-bank-arrow {
    transform: rotate(90deg);
}

.summary-bank-subrow td {
    font-size: 0.82rem;
    color: #64748b;
}

.summary-subrow-label {
    padding-left: 32px !important;
}

/* Cash split cells: Odoo (left) | Actual (right) */
.cash-split-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.cash-odoo-val {
    color: #2563eb;
    font-size: 0.78rem;
    font-weight: 500;
    padding-right: 5px;
    border-right: 1px solid #cbd5e1;
    min-width: 75px;
    text-align: right;
}

.cash-actual-val {
    font-weight: 600;
    font-size: 0.82rem;
    min-width: 75px;
    text-align: right;
}

.cash-split-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.cash-odoo-hdr {
    color: #2563eb;
    font-weight: 600;
    font-size: 0.72rem;
    padding-right: 5px;
    border-right: 1px solid #94a3b8;
    min-width: 75px;
    text-align: right;
}

.cash-actual-hdr {
    font-weight: 700;
    font-size: 0.75rem;
    min-width: 75px;
    text-align: right;
}

/* Borders between Cash split columns */
.cash-split-td {
    border-left: 2px solid #e2e8f0 !important;
    border-right: 2px solid #e2e8f0 !important;
}

/* Odoo vs Actual row: column layout (vals on top, diff below) */
.cash-split-cell--col {
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.cash-split-cell__vals {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.cash-diff-row {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    width: 100%;
}

/* Separator for actual val when Difference column follows */
.cash-actual-val--sep {
    border-right: 1px solid #cbd5e1;
    padding-right: 5px;
}

.cash-actual-hdr--sep {
    border-right: 1px solid #94a3b8;
    padding-right: 5px;
}

/* Difference column */
.cash-diff-val {
    font-size: 0.78rem;
    font-weight: 600;
    min-width: 70px;
    text-align: right;
    padding-left: 5px;
}

.cash-diff-hdr {
    font-weight: 700;
    font-size: 0.72rem;
    min-width: 70px;
    text-align: right;
    padding-left: 5px;
}

.summary-detail-table tr:last-child td {
    border-bottom: none;
}

/* Sessions detail table in summary */
#summarySessionsBody td {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.82rem;
}

#summarySessionsBody td:nth-child(1),
#summarySessionsBody td:nth-child(2) {
    font-family: inherit;
}

.over-short-positive { color: var(--success-color); font-weight: 600; }
.over-short-negative { color: var(--danger-color); font-weight: 600; }
.over-short-zero { color: #64748b; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

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

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sessions-counter {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    font-size: 0.95rem;
    font-weight: 500;
}

.sessions-counter.hidden { display: none; }

.cnt-total  { color: #1e293b; font-weight: 600; }
.cnt-posted { color: #2563eb; font-weight: 700; font-size: 1rem; }
.cnt-pending-zero { color: #1e293b; font-weight: 600; }
.cnt-pending      { color: #dc2626; font-weight: 700; font-size: 1rem; }

.card-body {
    padding: 20px;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control:disabled {
    background: var(--bg-color);
    cursor: not-allowed;
}

.form-control.is-invalid {
    border-color: var(--danger-color);
}

.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper .form-control {
    padding-right: 42px;
}

.password-toggle {
    position: absolute;
    right: 1px;
    top: 1px;
    bottom: 1px;
    width: 40px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 0 var(--radius) var(--radius) 0;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: #475569;
}

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

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #475569;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background: var(--bg-color);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: var(--bg-color);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.table tbody tr:hover {
    background: rgba(37, 99, 235, 0.05);
}

.table tbody tr.selected {
    background: rgba(37, 99, 235, 0.1);
}

/* ============================================================
   BALANCE FORM LAYOUT
   ============================================================ */
.balance-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 1200px) {
    .balance-container {
        grid-template-columns: 1fr;
    }
}

.balance-panel {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.balance-panel.supervisor {
    border-top: 4px solid var(--primary-color);
}

.balance-panel.accounting {
    border-top: 4px solid var(--success-color);
}

.panel-header {
    padding: 15px 20px;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    margin: 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-header h3 i {
    opacity: 0.7;
}

.balance-section {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.balance-section:last-child {
    border-bottom: none;
}

.section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 600;
}

.balance-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.balance-row label {
    font-size: 0.875rem;
    color: var(--text-color);
}

.balance-row .value {
    font-weight: 600;
    min-width: 100px;
    text-align: right;
}

.balance-row input {
    width: 120px;
    padding: 6px 10px;
    text-align: right;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.balance-row input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.balance-row.total {
    background: var(--bg-color);
    margin: 0 -20px;
    padding: 12px 20px;
    font-weight: 600;
}

.balance-row.highlight {
    background: rgba(37, 99, 235, 0.1);
    margin: 0 -20px;
    padding: 12px 20px;
    border-left: 3px solid var(--primary-color);
}

/* Field highlighting for reconciliation */
.field-highlight {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: var(--success-color) !important;
    transition: var(--transition);
}

.field-match {
    color: var(--success-color);
}

.field-mismatch {
    color: var(--danger-color);
    font-weight: 600;
}

/* ============================================================
   BADGES & STATUS
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 20px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-color);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-color);
}

.badge-info {
    background: rgba(6, 182, 212, 0.15);
    color: var(--info-color);
}

.badge-secondary {
    background: rgba(100, 116, 139, 0.15);
    color: var(--secondary-color);
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================================
   LOADING & SPINNER
   ============================================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 15px;
    color: var(--text-muted);
}

/* ============================================================
   ALERTS & TOASTS
   ============================================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
}

.toast {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 15px 20px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success { border-left: 4px solid var(--success-color); }
.toast.error { border-left: 4px solid var(--danger-color); }
.toast.warning { border-left: 4px solid var(--warning-color); }
.toast.info { border-left: 4px solid var(--info-color); }

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .sidebar,
    .header,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin: 0;
        padding: 0;
    }
    
    .balance-container {
        grid-template-columns: 1fr;
    }
    
    .balance-panel {
        box-shadow: none;
        border: 1px solid #000;
        page-break-inside: avoid;
    }
    
    body {
        background: white;
        font-size: 12px;
    }
}

/* ============================================================
   PRINT FORM SPECIFIC
   ============================================================ */
.print-form {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: white;
}

.print-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #000;
}

.print-header img {
    height: 50px;
    margin-bottom: 10px;
}

.print-header h1 {
    font-size: 1.25rem;
    margin: 0;
}

.print-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.print-info-row {
    display: flex;
    align-items: center;
}

.print-info-row label {
    font-weight: 600;
    min-width: 150px;
}

.print-info-row .value {
    flex: 1;
    border-bottom: 1px solid #000;
    padding: 2px 5px;
}

.print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.print-table th,
.print-table td {
    border: 1px solid #000;
    padding: 8px 10px;
}

.print-table th {
    background: #f0f0f0;
    font-weight: 600;
    text-align: left;
}

.print-table .amount {
    text-align: right;
    font-family: monospace;
}

.print-signatures {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 40px;
}

.signature-box {
    text-align: center;
}

.signature-line {
    border-top: 1px solid #000;
    padding-top: 5px;
    margin-top: 40px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo img {
    height: 60px;
}

.login-logo h1 {
    font-size: 1.25rem;
    margin-top: 15px;
    color: var(--text-color);
}

.login-logo p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.hidden { display: none !important; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-mono { font-family: monospace; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

/* ============================================================
   CASH DENOMINATION ROWS
   ============================================================ */
.denom-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.denom-row label {
    min-width: 60px;
}

.denom-row .qty-input {
    width: 70px;
    text-align: center;
    flex-shrink: 0;
}

.denom-row .equals {
    font-weight: bold;
    color: var(--text-muted);
}

.denom-row input:last-of-type {
    flex: 1;
    background: var(--bg-color);
}

/* ============================================================
   DIFFERENCE ROWS
   ============================================================ */
.diff-row {
    border-top: 1px dashed var(--border-color);
    padding-top: 5px;
    margin-top: 5px;
}

.diff-value {
    font-weight: bold;
    font-family: monospace;
}

.diff-positive {
    color: #2563eb;
    font-weight: bold;
}

.diff-negative {
    color: #ef4444;
    font-weight: bold;
}

/* ============================================================
   POSTED BUTTON STATE
   ============================================================ */
.btn-posted {
    background: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
    cursor: not-allowed;
    opacity: 0.8;
}

.btn-edit-save {
    background: #f59e0b !important;
    border-color: #f59e0b !important;
    color: #fff !important;
}

.btn-edit-save:hover {
    background: #d97706 !important;
}

/* Edit Modified Field */
.edit-modified {
    background: #fef9c3 !important;
    border-color: #eab308 !important;
    color: #854d0e !important;
}

.edit-modified:disabled {
    background: #fef9c3 !important;
    border-color: #eab308 !important;
    color: #854d0e !important;
    opacity: 1 !important;
}

/* Edit Tooltip */
.edit-tooltip-wrapper {
    position: relative;
}

.edit-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    z-index: 1000;
    background: #1e293b;
    color: #f1f5f9;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.75rem;
    min-width: 260px;
    max-width: 360px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    pointer-events: none;
}

.edit-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 20px;
    border: 6px solid transparent;
    border-top-color: #1e293b;
}

.edit-tooltip-wrapper:hover .edit-tooltip {
    display: block;
}

.edit-tooltip-title {
    font-weight: 700;
    font-size: 0.78rem;
    margin-bottom: 6px;
    color: #fbbf24;
    border-bottom: 1px solid #334155;
    padding-bottom: 4px;
}

.edit-tooltip-row {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 4px 0;
    border-bottom: 1px solid #334155;
}

.edit-tooltip-row:last-child {
    border-bottom: none;
}

.edit-tooltip-date {
    color: #94a3b8;
    font-size: 0.7rem;
}

.edit-tooltip-by {
    color: #67e8f9;
    font-size: 0.7rem;
}

.edit-tooltip-vals {
    color: #fde68a;
    font-weight: 600;
}

/* ============================================================
   DROPS BADGE IN HEADER
   ============================================================ */
.drops-badge {
    background: #fef3c7;
    color: #92400e;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #f59e0b;
}

.over-short-badge {
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 600;
    margin-left: 8px;
    white-space: nowrap;
}

.badge-float {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.badge-shortage {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* ============================================================
   ARCHIVED CASHIERS IN SELECT
   ============================================================ */
#searchCashier optgroup[label="Archived"] {
    font-style: italic;
    color: #6b7280;
}

#searchCashier .archived-option {
    background-color: #fce7f3;
    color: #831843;
}

/* ============================================================
   FOREIGN CURRENCY DENOMINATIONS
   ============================================================ */
.fc-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 8px 0 !important;
}

.fc-label-col {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.fc-label-col .fc-rate {
    font-size: 10px;
    color: #6b7280;
    line-height: 1.2;
}

.fc-label-col .fc-name {
    font-size: 0.875rem;
    color: var(--text-color);
    line-height: 1.3;
}

.fc-denoms-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 6px;
}

.fc-denom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.fc-denom span {
    font-size: 11px;
    color: #6b7280;
}

.fc-denom input {
    width: 45px;
    padding: 5px 3px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
}

.fc-denom input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.fc-equals {
    color: #9ca3af;
    font-weight: bold;
    margin: 0 4px;
    margin-bottom: 6px;
}

.fc-total {
    width: 120px;
    padding: 6px 10px;
    text-align: right;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    flex-shrink: 0;
}
/* ============================================================
   DIFFERENCE DETAIL MODAL
   ============================================================ */

/* Clickable group wrapping arrow + diff value */
.diff-clickable-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.diff-clickable-group:hover .diff-value {
    text-decoration: underline;
}

/* Blinking arrow immediately left of diff value */
.diff-detail-arrow {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 900;
    cursor: pointer;
    animation: diff-arrow-blink 0.6s ease-in-out infinite;
    color: #3665eb;
    vertical-align: middle;
}

.diff-detail-arrow.hidden { display: none; }

@keyframes diff-arrow-blink {
    0%, 100% { opacity: 1; transform: translateX(0); }
    50% { opacity: 0.3; transform: translateX(4px); }
}

/* Modal */
.diff-detail-modal {
    max-width: 640px;
    width: 95vw;
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
}

.diff-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color);
    background: #f8fafc;
}

.diff-modal-title {
    margin: 0 0 4px 0;
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
}

.diff-modal-subtitle {
    margin: 0;
    font-size: 0.82rem;
    color: #64748b;
}

.diff-modal-body {
    padding: 16px 24px;
    max-height: 55vh;
    overflow-y: auto;
}

.diff-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.diff-detail-table th {
    text-align: left;
    padding: 8px 10px;
    background: #f1f5f9;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.diff-amount-col {
    text-align: right;
    width: 140px;
    min-width: 140px;
}

.diff-detail-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.diff-desc-cell {
    font-size: 0.83rem;
    color: #334155;
    line-height: 1.35;
    word-break: break-word;
    white-space: normal;
}

.diff-amount-input {
    width: 100%;
    text-align: right;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 0.85rem;
    font-family: 'SF Mono', 'Consolas', monospace;
    background: #fff;
    color: #1e293b;
    transition: border-color 0.15s;
}

.diff-amount-input:-webkit-autofill,
.diff-amount-input:-webkit-autofill:hover,
.diff-amount-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px #fff inset;
    -webkit-text-fill-color: #1e293b;
    transition: background-color 5000s ease-in-out 0s;
}

.diff-amount-input:focus {
    outline: none;
    border-color: #3665eb;
    box-shadow: 0 0 0 3px rgba(54,101,235,0.1);
}

.diff-amount-input:read-only {
    background: #f8fafc;
    color: #94a3b8;
    cursor: not-allowed;
}

.diff-total-row td {
    padding: 10px 10px;
    border-top: 2px solid #e2e8f0;
    border-bottom: none;
    font-size: 0.9rem;
}

.diff-validation-row td {
    padding: 6px 10px;
    border-bottom: none;
}

.diff-validation-msg {
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 6px;
    padding: 6px 10px !important;
    text-align: center;
}

.diff-validation-msg.valid {
    background: #f0fdf4;
    color: #16a34a;
}

.diff-validation-msg.invalid {
    background: #fef2f2;
    color: #dc2626;
}

.diff-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
}