/* Sahal Typing Services — Custom CSS */
/* Tailwind CDN handles utilities; this file covers gaps only */

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

* { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background-color: #F8FAFC;
    color: #0F172A;
    -webkit-font-smoothing: antialiased;
}

/* ── Sidebar layout ───────────────────────────────── */
#sidebar {
    width: 240px;
    flex-shrink: 0;
}

@media (max-width: 767px) {
    #sidebar { display: none; }
    #main-content { margin-left: 0 !important; padding-bottom: 80px; }
}

@media (min-width: 768px) {
    #bottom-nav { display: none !important; }
    #main-content { margin-left: 240px; }
}

/* ── Bottom nav (mobile) ──────────────────────────── */
#bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 64px;
    background: #fff;
    border-top: 1px solid #E2E8F0;
    z-index: 50;
    display: flex;
    align-items: stretch;
}
#bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 10px;
    font-weight: 500;
    color: #94A3B8;
    text-decoration: none;
    transition: color .15s;
}
#bottom-nav a.active,
#bottom-nav a:hover  { color: #4F46E5; }
#bottom-nav a.new-btn {
    background: #4F46E5;
    color: #fff;
    border-radius: 16px 16px 0 0;
    margin: 0 8px;
}
#bottom-nav a.new-btn:hover { background: #4338CA; color: #fff; }

/* ── Sidebar nav links ────────────────────────────── */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #64748B;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.sidebar-link:hover  { background: #F1F5F9; color: #0F172A; }
.sidebar-link.active { background: #EEF2FF; color: #4F46E5; }
.sidebar-link svg    { width: 18px; height: 18px; flex-shrink: 0; }

/* ── Cards ────────────────────────────────────────── */
.card {
    background: #fff;
    border: 1px solid #F1F5F9;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 24px -4px rgba(0,0,0,0.03);
    transition: box-shadow .2s ease;
}
.card:hover { box-shadow: 0 8px 32px -4px rgba(0,0,0,0.05); }

/* ── Status badges ────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
}
.badge-paid    { background: #DCFCE7; color: #15803D; }
.badge-partial { background: #FEF3C7; color: #B45309; }
.badge-unpaid  { background: #FEE2E2; color: #DC2626; }
.badge-voided  { background: #F1F5F9; color: #94A3B8; }

/* ── Stat card ────────────────────────────────────── */
.stat-card {
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 20px 24px;
}
.stat-card .label { font-size: 13px; color: #64748B; font-weight: 500; }
.stat-card .value { font-size: 26px; font-weight: 700; color: #0F172A; margin-top: 4px; line-height: 1.2; }
.stat-card .sub   { font-size: 12px; color: #94A3B8; margin-top: 2px; }

/* ── Buttons ──────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
    cursor: pointer; text-decoration: none; min-height: 40px;
    transition: all .2s cubic-bezier(.4,0,.2,1); white-space: nowrap; border: none; outline: none;
}
.btn:active    { transform: translateY(1px); }
.btn-primary   { 
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); 
    color: #fff; 
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25); 
}
.btn-primary:hover { 
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%); 
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35); 
}
.btn-secondary { background: #F1F5F9; color: #475569; }
.btn-secondary:hover { background: #E2E8F0; color: #1E293B; }
.btn-danger    { background: #FEE2E2; color: #DC2626; }
.btn-danger:hover { background: #FECACA; color: #B91C1C; }
.btn-whatsapp  { background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%); color: #fff; box-shadow: 0 4px 14px rgba(34, 197, 94, 0.2); }
.btn-whatsapp:hover { background: linear-gradient(135deg, #16a34a 0%, #15803d 100%); box-shadow: 0 6px 20px rgba(34, 197, 94, 0.3); }
.btn-ghost     { background: transparent; color: #64748B; }
.btn-ghost:hover { background: #F1F5F9; color: #0F172A; }
.btn-sm        { padding: 6px 12px; font-size: 13px; min-height: 36px; }
.btn-lg        { padding: 12px 24px; font-size: 15px; min-height: 48px; }
.btn-full      { width: 100%; justify-content: center; }

/* ── Form elements ────────────────────────────────── */
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 5px;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 16px; /* 16px prevents iOS zoom */
    color: #0F172A;
    background: #fff;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    font-family: 'Inter', sans-serif;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.form-input::placeholder { color: #9CA3AF; }
.form-textarea { resize: vertical; min-height: 80px; }

/* ── Table ────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    font-size: 12px;
    font-weight: 600;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 10px 16px;
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
    text-align: left;
}
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #F1F5F9;
    font-size: 14px;
    color: #1E293B;
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td      { background: #F8FAFC; }

/* ── Tab filter bar ───────────────────────────────── */
.tab-bar   { display: flex; gap: 4px; border-bottom: 2px solid #E2E8F0; }
.tab-item  { padding: 8px 16px; font-size: 14px; font-weight: 500; color: #64748B; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; text-decoration: none; }
.tab-item.active,
.tab-item:hover { color: #4F46E5; border-bottom-color: #4F46E5; }

/* ── Alert / flash ────────────────────────────────── */
.alert         { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-success { background: #F0FDF4; color: #15803D; border: 1px solid #BBF7D0; }
.alert-error   { background: #FFF1F2; color: #BE123C; border: 1px solid #FECDD3; }
.alert-warning { background: #FFFBEB; color: #B45309; border: 1px solid #FDE68A; }

/* ── Page header ──────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}
.page-header h1 { font-size: 20px; font-weight: 700; color: #0F172A; margin: 0; }

/* ── Mobile card (replaces table rows on mobile) ───── */
.mobile-card {
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
}

/* ── Invoice items table ──────────────────────────── */
.items-table th, .items-table td { padding: 8px 10px; }
.items-table th { font-size: 12px; font-weight: 600; color: #64748B; background: #F8FAFC; }
.items-table td { border-bottom: 1px solid #F1F5F9; }

/* ── Customer search dropdown ─────────────────────── */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
}
.search-dropdown-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    transition: background .1s;
}
.search-dropdown-item:hover { background: #F1F5F9; }

/* ── Step wizard (mobile invoice create) ──────────── */
.step-indicator { display: flex; gap: 0; margin-bottom: 24px; }
.step-dot {
    flex: 1;
    height: 4px;
    background: #E2E8F0;
    border-radius: 2px;
    margin: 0 2px;
    transition: background .2s;
}
.step-dot.done    { background: #4F46E5; }
.step-dot.current { background: #818CF8; }

/* ── PDF action bar ───────────────────────────────── */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 0;
    border-top: 1px solid #E2E8F0;
    margin-top: 20px;
}

/* ── Totals panel ─────────────────────────────────── */
.totals-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.totals-row.total { font-size: 16px; font-weight: 700; border-top: 1px solid #E2E8F0; padding-top: 10px; margin-top: 4px; }
.totals-row.due   { font-size: 17px; font-weight: 700; color: #4F46E5; }

/* ── Spinner ──────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 20px; height: 20px; border: 2px solid #E2E8F0; border-top-color: #4F46E5; border-radius: 50%; animation: spin .6s linear infinite; display: inline-block; }


/* ── Scrollbar ────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }

/* ── Disabled button ──────────────────────────────── */
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ── Collection rate bar ─────────────────────────── */
.collection-bar { height: 8px; background: #F1F5F9; border-radius: 4px; overflow: hidden; }
.collection-bar-fill { height: 100%; background: linear-gradient(90deg, #22c55e, #16a34a); border-radius: 4px; transition: width .4s ease; }

/* ── Flush card variant (no padding) ─────────────── */
.card-flush { background:#fff; border:1px solid #E2E8F0; border-radius:12px; overflow:hidden; }

/* ── Invoice doc header arabic text ─────────────── */
.inv-arabic-name { color:#b45309; font-size:1.1rem; font-weight:700; }
