/* ==========================================================================
   SBCON ERP & Accounting System - Premium UI & Design System
   Arabic RTL First - Ultra-Modern Clean SaaS Aesthetics
   ========================================================================== */

@import url('../vendor/fonts/cairo.css');

:root {
    --primary: #059669;
    --primary-hover: #047857;
    --primary-light: #ecfdf5;
    --primary-glow: rgba(16, 185, 129, 0.25);
    
    --slate-bg: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --sidebar-bg: #0f172a;
    --sidebar-card: #1e293b;
    --sidebar-border: #1e293b;
    --sidebar-hover: rgba(51, 65, 85, 0.6);
}

* {
    font-family: 'Cairo', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    letter-spacing: -0.01em;
}

html, body {
    background-color: var(--slate-bg);
    color: var(--text-primary);
    direction: rtl;
    text-align: right;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Custom Sleek Scrollbars
   ========================================================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

#main-sidebar ::-webkit-scrollbar-thumb {
    background: #334155;
}
#main-sidebar ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* ==========================================================================
   Glassmorphism & Header Bar
   ========================================================================== */
.glass-header {
    background: rgba(255, 255, 255, 0.88) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

/* ==========================================================================
   Sidebar Styling & Active States
   ========================================================================== */
#main-sidebar {
    background: linear-gradient(180deg, #0b1120 0%, #0f172a 100%) !important;
    box-shadow: -4px 0 25px -5px rgba(0, 0, 0, 0.2);
}

.nav-tab {
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.nav-tab:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff !important;
    transform: translateX(-2px);
}

.nav-tab.active {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.05) 100%) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 4px 14px -3px rgba(16, 185, 129, 0.25);
}

.nav-tab.active::before {
    content: '';
    position: absolute;
    right: -1px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 65%;
    background: linear-gradient(180deg, #34d399 0%, #059669 100%);
    border-radius: 4px 0 0 4px;
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
}

/* ==========================================================================
   Card Styling & Micro-elevations
   ========================================================================== */
.card-hover {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.07), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

.kpi-card {
    position: relative;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    transition: background 0.2s ease;
}

.kpi-card-emerald::after { background: linear-gradient(90deg, #10b981, #34d399); }
.kpi-card-blue::after { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.kpi-card-rose::after { background: linear-gradient(90deg, #f43f5e, #fb7185); }
.kpi-card-amber::after { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.kpi-card-purple::after { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

/* ==========================================================================
   Table Aesthetics & Responsive Wrappers
   ========================================================================== */
.table-container {
    background: #ffffff;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
}

table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

table thead th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

table tbody tr {
    transition: background-color 0.15s ease;
}

table tbody tr:nth-child(even) {
    background-color: #fafbfd;
}

table tbody tr:hover {
    background-color: #f1f5f9 !important;
}

table tbody td {
    border-bottom: 1px solid #f1f5f9;
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* ==========================================================================
   Badges & Pills
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 9999px;
    white-space: nowrap;
    line-height: 1.25;
}

.badge-success {
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.badge-warning {
    background-color: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.badge-danger {
    background-color: #fff1f2;
    color: #9f1239;
    border: 1px solid #fecdd3;
}

.badge-info {
    background-color: #f0f9ff;
    color: #075985;
    border: 1px solid #bae6fd;
}

.badge-primary {
    background-color: #eef2ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
}

/* ==========================================================================
   Buttons & Micro-interactions
   ========================================================================== */
.btn-primary {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    font-weight: 700;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px -1px rgba(5, 150, 105, 0.35);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    box-shadow: 0 4px 14px -2px rgba(5, 150, 105, 0.45);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.625rem;
    transition: all 0.15s ease;
}

.btn-action-icon:hover {
    transform: scale(1.08);
}

/* ==========================================================================
   Form Controls & Select Elements
   ========================================================================== */
input, select, textarea {
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    color: #0f172a;
}

select {
    color: #0f172a !important;
    background-color: #f8fafc;
}

select option {
    background-color: #ffffff !important;
    color: #0f172a !important;
    font-weight: 600;
    padding: 8px 12px;
}

input:focus, select:focus, textarea:focus {
    outline: none !important;
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18) !important;
    background-color: #ffffff !important;
    color: #0f172a !important;
}

/* Dashboard Period Buttons */
.dashboard-period-btn {
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
.dashboard-period-btn.active, .dashboard-period-btn.bg-emerald-600 {
    background-color: #059669 !important;
    color: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Modals & Lightbox Animation
   ========================================================================== */
.modal-backdrop-blur {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background-color: rgba(15, 23, 42, 0.78);
}

.modal-scale-in {
    animation: modalScaleIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(6px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Print Stylesheet
   ========================================================================== */
@media print {
    body {
        background: white !important;
        color: black !important;
        font-size: 11pt;
    }
    .no-print {
        display: none !important;
    }
    .print-only {
        display: block !important;
    }
    .print-container {
        width: 100% !important;
        margin: 0 !important;
        padding: 12px !important;
        box-shadow: none !important;
        border: none !important;
    }
    table {
        width: 100% !important;
        border-collapse: collapse !important;
    }
    th, td {
        border: 1px solid #333 !important;
        padding: 6px 8px !important;
    }
    th {
        background-color: #f3f4f6 !important;
        color: #000 !important;
    }
    .page-break {
        page-break-after: always;
    }
}

.print-only {
    display: none;
}

/* ==========================================================================
   Modern Enterprise Login Screen Aesthetics
   ========================================================================== */
.login-bg-pattern {
    background-color: #030712;
    background-image: 
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(59, 130, 246, 0.10) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
        radial-gradient(#1e293b 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 100% 100%, 28px 28px;
}

.login-glow-1 {
    position: absolute;
    top: -10%;
    right: 15%;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.18) 0%, rgba(16, 185, 129, 0) 70%);
    filter: blur(40px);
    pointer-events: none;
    animation: floatGlow 8s ease-in-out infinite alternate;
}

.login-glow-2 {
    position: absolute;
    bottom: -10%;
    left: 15%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.15) 0%, rgba(14, 165, 233, 0) 70%);
    filter: blur(45px);
    pointer-events: none;
    animation: floatGlow 10s ease-in-out infinite alternate-reverse;
}

@keyframes floatGlow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(25px, 25px) scale(1.1); }
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.shake-animation {
    animation: shakeError 0.4s ease-in-out;
}

.login-glass-card {
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.login-input {
    background: rgba(30, 41, 59, 0.9) !important;
    border: 1px solid rgba(71, 85, 105, 0.8) !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    transition: all 0.2s ease;
}

.login-input:focus {
    background: #0f172a !important;
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25) !important;
    outline: none;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

.login-input::placeholder {
    color: #94a3b8 !important;
}

/* ==========================================================================
   Chrome/Edge/Safari/Firefox Autofill Contrast Fix
   ========================================================================== */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-text-fill-color: #ffffff !important;
    -webkit-box-shadow: 0 0 0px 1000px #1e293b inset !important;
    box-shadow: 0 0 0px 1000px #1e293b inset !important;
    transition: background-color 5000s ease-in-out 0s;
    caret-color: #ffffff !important;
    color: #ffffff !important;
}

#login-username, #login-password {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    background-color: #1e293b !important;
}

#login-username:focus, #login-password:focus {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    background-color: #0f172a !important;
}


