/* ============================================
   YS TECH DEVELOPERS - Invoice System Styles
   ============================================ */

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

:root {
    --blue-dark:    #0a1628;
    --blue-mid:     #0d2650;
    --blue-core:    #1455c0;
    --blue-bright:  #2176ff;
    --blue-light:   #4d9fff;
    --blue-pale:    #ddeeff;
    --blue-ghost:   #f0f6ff;
    --white:        #ffffff;
    --gray-100:     #f7f9fc;
    --gray-200:     #edf2f7;
    --gray-300:     #d0daea;
    --gray-500:     #7a8fa6;
    --gray-700:     #3d4f63;
    --gray-900:     #1a2535;
    --success:      #10b981;
    --warning:      #f59e0b;
    --danger:       #ef4444;
    --shadow-sm:    0 1px 3px rgba(20,85,192,0.08);
    --shadow-md:    0 4px 16px rgba(20,85,192,0.12);
    --shadow-lg:    0 8px 32px rgba(20,85,192,0.18);
    --radius:       12px;
    --radius-sm:    8px;
}

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

body {
    font-family: 'Sora', sans-serif;
    background: var(--gray-100);
    color: var(--gray-900);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- SIDEBAR ---- */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: 260px; height: 100vh;
    background: var(--blue-dark);
    display: flex; flex-direction: column;
    z-index: 100;
    border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo {
    padding: 28px 24px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo-mark {
    display: flex; align-items: center; gap: 12px;
}

.logo-icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--blue-bright), var(--blue-light));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500; font-size: 16px;
    color: white; letter-spacing: -1px;
    box-shadow: 0 4px 12px rgba(33,118,255,0.4);
}

.logo-text { line-height: 1.2; }
.logo-text .brand { font-size: 13px; font-weight: 700; color: var(--white); letter-spacing: 1.5px; text-transform: uppercase; }
.logo-text .tagline { font-size: 10px; color: var(--blue-light); font-weight: 400; letter-spacing: 0.5px; }

.sidebar-nav { flex: 1; padding: 20px 12px; overflow-y: auto; }

.nav-section-label {
    font-size: 10px; font-weight: 600; letter-spacing: 1.8px;
    color: var(--gray-500); text-transform: uppercase;
    padding: 0 12px 8px; margin-top: 16px;
}

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.6); text-decoration: none;
    font-size: 13.5px; font-weight: 500;
    transition: all 0.2s; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: var(--white); }
.nav-item.active { background: var(--blue-core); color: var(--white); box-shadow: 0 2px 8px rgba(20,85,192,0.4); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 11px; color: var(--gray-500);
}

/* ---- MAIN LAYOUT ---- */
.main-wrap { margin-left: 260px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 32px;
    height: 68px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 50;
    box-shadow: var(--shadow-sm);
}

.topbar-title { font-size: 20px; font-weight: 700; color: var(--gray-900); }
.topbar-sub   { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

.topbar-actions { display: flex; gap: 10px; align-items: center; }

.page-content { padding: 32px; flex: 1; }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px; border-radius: var(--radius-sm);
    font-family: 'Sora', sans-serif; font-size: 13.5px; font-weight: 600;
    cursor: pointer; border: none; text-decoration: none;
    transition: all 0.2s;
}
.btn-primary { background: var(--blue-bright); color: var(--white); box-shadow: 0 2px 8px rgba(33,118,255,0.3); }
.btn-primary:hover { background: var(--blue-core); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(33,118,255,0.4); }
.btn-outline { background: transparent; color: var(--blue-bright); border: 1.5px solid var(--blue-bright); }
.btn-outline:hover { background: var(--blue-ghost); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #c0392b; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn svg { width: 15px; height: 15px; }

/* ---- STATS CARDS ---- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 32px; }

.stat-card {
    background: var(--white); border-radius: var(--radius);
    padding: 24px; box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    position: relative; overflow: hidden;
    transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0;
    height: 3px; border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card.blue::before   { background: var(--blue-bright); }
.stat-card.green::before  { background: var(--success); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.red::before    { background: var(--danger); }

.stat-icon {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}
.stat-icon.blue   { background: var(--blue-ghost); color: var(--blue-bright); }
.stat-icon.green  { background: #ecfdf5; color: var(--success); }
.stat-icon.orange { background: #fffbeb; color: var(--warning); }
.stat-icon.red    { background: #fef2f2; color: var(--danger); }

.stat-value { font-size: 26px; font-weight: 800; color: var(--gray-900); }
.stat-label { font-size: 12px; color: var(--gray-500); font-weight: 500; margin-top: 4px; }

/* ---- TABLE CARD ---- */
.card {
    background: var(--white); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200);
}
.card-header {
    padding: 20px 24px; border-bottom: 1px solid var(--gray-200);
    display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--gray-900); }
.card-body { padding: 0; }

table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--gray-100); }
thead th {
    padding: 12px 20px; text-align: left;
    font-size: 11px; font-weight: 700; letter-spacing: 1px;
    color: var(--gray-500); text-transform: uppercase;
}
tbody tr { border-bottom: 1px solid var(--gray-200); transition: background 0.15s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--blue-ghost); }
tbody td { padding: 14px 20px; font-size: 13.5px; color: var(--gray-700); }
tbody td strong { color: var(--gray-900); font-weight: 600; }

/* ---- BADGES ---- */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase;
}
.badge-draft   { background: var(--gray-200); color: var(--gray-700); }
.badge-sent    { background: var(--blue-pale); color: var(--blue-core); }
.badge-paid    { background: #d1fae5; color: #065f46; }
.badge-overdue { background: #fee2e2; color: #991b1b; }

/* ---- FORMS ---- */
.form-grid { display: grid; gap: 20px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--gray-700); letter-spacing: 0.3px; }

.form-control {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm);
    font-family: 'Sora', sans-serif; font-size: 13.5px; color: var(--gray-900);
    background: var(--white); transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.form-control:focus { border-color: var(--blue-bright); box-shadow: 0 0 0 3px rgba(33,118,255,0.12); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ---- INVOICE ITEMS TABLE ---- */
.items-table { width: 100%; border-collapse: collapse; }
.items-table th {
    background: var(--blue-ghost); padding: 10px 12px;
    font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
    color: var(--blue-core); text-transform: uppercase; text-align: left;
}
.items-table td { padding: 8px 6px; vertical-align: middle; }
.items-table .form-control { margin: 0; }

.items-total-section { background: var(--blue-ghost); padding: 20px 24px; border-radius: 0 0 var(--radius) var(--radius); }
.total-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13.5px; color: var(--gray-700); }
.total-row.grand { font-size: 17px; font-weight: 800; color: var(--gray-900); border-top: 2px solid var(--blue-bright); padding-top: 12px; margin-top: 8px; }

/* ---- ALERTS ---- */
.alert { padding: 12px 18px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 13.5px; font-weight: 500; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ---- EMPTY STATE ---- */
.empty-state { padding: 60px 24px; text-align: center; }
.empty-state svg { color: var(--gray-300); margin-bottom: 16px; }
.empty-state h3 { font-size: 16px; font-weight: 700; color: var(--gray-700); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; color: var(--gray-500); }

/* ---- PRINT INVOICE ---- */
@media print {
    .sidebar, .topbar, .topbar-actions, .no-print { display: none !important; }
    .main-wrap { margin-left: 0; }
    .page-content { padding: 0; }
    .card { box-shadow: none; border: none; }
    body { background: white; }
}

/* ---- INVOICE PRINT LAYOUT ---- */
.invoice-print-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: 32px; background: var(--blue-dark);
    border-radius: var(--radius) var(--radius) 0 0; color: white;
}
.invoice-print-logo { font-size: 22px; font-weight: 800; letter-spacing: 1px; }
.invoice-print-logo span { color: var(--blue-light); }
.invoice-print-number { text-align: right; }
.invoice-print-number .inv-num { font-size: 28px; font-weight: 800; font-family: 'JetBrains Mono', monospace; }
.invoice-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; padding: 28px 32px; background: var(--gray-100); }
.invoice-meta-section h4 { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gray-500); margin-bottom: 8px; font-weight: 700; }
.invoice-meta-section p  { font-size: 14px; line-height: 1.7; color: var(--gray-900); }

/* ---- MODAL ---- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(10,22,40,0.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; backdrop-filter: blur(4px);
}
.modal { background: var(--white); border-radius: var(--radius); width: 480px; box-shadow: var(--shadow-lg); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray-500); padding: 4px; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-200); display: flex; gap: 10px; justify-content: flex-end; }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-grid-3 { grid-template-columns: 1fr 1fr; }
}
