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

:root {
    --primary: #ffcc00;
    --primary-hover: #e6b800;
    --primary-light: rgba(255, 204, 0, 0.15);
    --secondary: #ffffff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    
    /* Dark glassmorphic black-yellow-white palette */
    --bg-color: #000000;
    --bg-gradient: linear-gradient(135deg, #000000 0%, #0d0d0d 50%, #151515 100%);
    --surface: rgba(20, 20, 20, 0.75);
    --surface-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #e5e5e5;
    --text-muted: #a3a3a3;
    
    --card-bg: rgba(25, 25, 25, 0.65);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.65);
    
    --sidebar-width: 280px;
    --header-height: 70px;
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    direction: rtl;
    overflow-x: hidden;
}

/* Glassmorphism scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Auth Page layout */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: var(--primary);
    filter: blur(120px);
    border-radius: 50%;
    top: 10%;
    left: 10%;
    opacity: 0.3;
    z-index: 1;
}

.auth-wrapper::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: var(--secondary);
    filter: blur(120px);
    border-radius: 50%;
    bottom: 10%;
    right: 10%;
    opacity: 0.3;
    z-index: 1;
}

.auth-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    border-radius: 24px;
    width: 100%;
    max-width: 450px;
    padding: 40px;
    z-index: 2;
    animation: fadeIn 0.6s ease;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(to left, var(--primary), #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.auth-title {
    font-size: 1.4rem;
    color: var(--text-primary);
    font-weight: 700;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* App Main Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    background: rgba(10, 10, 10, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid var(--surface-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    right: 0;
    top: 0;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 25px;
    border-bottom: 1px solid var(--surface-border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-logo img {
    height: 35px;
    width: 35px;
    object-fit: contain;
    border-radius: 8px;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 15px;
    flex-grow: 1;
    overflow-y: auto;
}

.menu-item {
    margin-bottom: 6px;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

.menu-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.menu-item.active .menu-link {
    background: var(--primary);
    color: #000000;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(255, 204, 0, 0.35);
}

.menu-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--surface-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
}

.logout-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Main Content Area */
.app-content {
    flex-grow: 1;
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

/* Header */
.app-header {
    height: var(--header-height);
    background: rgba(10, 10, 10, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--surface-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 90;
}

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

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

.network-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--primary-light);
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}

/* Main Body Content */
.content-body {
    padding: 30px;
    flex-grow: 1;
}

/* Grid & Layout System */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

/* Cards style */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
}

.glass-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.12);
}

/* KPI Card */
.kpi-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kpi-details h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 5px;
}

.kpi-details .kpi-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.kpi-details .kpi-currency {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.kpi-icon-wrapper {
    width: 55px;
    height: 55px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-icon-wrapper.primary { background: var(--primary-light); color: var(--primary); }
.kpi-icon-wrapper.success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.kpi-icon-wrapper.warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.kpi-icon-wrapper.danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.kpi-icon-wrapper.info { background: rgba(6, 182, 212, 0.15); color: var(--info); }

.kpi-icon-wrapper svg {
    width: 26px;
    height: 26px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(5, 5, 5, 0.5);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: rgba(5, 5, 5, 0.7);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-error {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 5px;
    display: block;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-check-input {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    accent-color: var(--primary);
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #000000;
    font-weight: 700;
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 204, 0, 0.35);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--surface-border);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 8px;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    width: 100%;
    margin-top: 20px;
}

.glass-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
}

.glass-table th {
    background: rgba(5, 5, 5, 0.45);
    padding: 16px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--surface-border);
}

.glass-table td {
    padding: 16px 20px;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.glass-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge-info { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }

/* Alert Styles */
.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Tree COA View */
.coa-tree {
    list-style: none;
}

.coa-node {
    margin: 8px 0;
    padding-right: 20px;
    position: relative;
}

.coa-node::before {
    content: '';
    position: absolute;
    top: 15px;
    right: 0;
    width: 12px;
    height: 1px;
    background: var(--text-muted);
}

.coa-node::after {
    content: '';
    position: absolute;
    top: -5px;
    right: 0;
    width: 1px;
    height: 21px;
    background: var(--text-muted);
}

.coa-node:last-child::after {
    height: 20px;
}

.coa-node-content {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--surface-border);
    padding: 10px 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.coa-code {
    font-weight: 700;
    color: var(--primary);
    font-family: monospace;
    font-size: 0.95rem;
}

.coa-type {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mobile responsive fixes */
@media (max-width: 991px) {
    .app-sidebar {
        right: -100%;
    }
    
    .app-sidebar.show {
        right: 0;
    }
    
    .app-content {
        margin-right: 0;
    }
    
    .mobile-toggle {
        display: block;
    }
}

@media (max-width: 576px) {
    .auth-card {
        padding: 25px;
    }
    
    .content-body {
        padding: 15px;
    }
    
    .app-header {
        padding: 0 15px;
    }
}

/* Responsive Grid for all form/table page layouts */
.responsive-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
    align-items: start;
}
.responsive-grid.single-col {
    grid-template-columns: 1fr;
}
@media (max-width: 991px) {
    .responsive-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Hide native number input spinners for clean numeric inputs */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}

/* Flatpickr Calendar theme styling to match Black-Yellow-White theme */
.flatpickr-calendar {
    background: rgba(15, 15, 15, 0.95) !important;
    border: 1px solid var(--surface-border) !important;
    box-shadow: var(--card-shadow) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    font-family: 'Cairo', sans-serif !important;
    direction: rtl !important;
}
.flatpickr-calendar.arrowTop:before,
.flatpickr-calendar.arrowTop:after {
    border-bottom-color: var(--surface-border) !important;
}
.flatpickr-day {
    color: var(--text-primary) !important;
}
.flatpickr-day.today {
    border-color: var(--primary) !important;
}
.flatpickr-day.today:hover {
    background: var(--primary) !important;
    color: #000000 !important;
}
.flatpickr-day.selected, 
.flatpickr-day.selected:focus, 
.flatpickr-day.selected:hover {
    background: var(--primary) !important;
    color: #000000 !important;
    border-color: var(--primary) !important;
}
.flatpickr-day:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}
.flatpickr-months .flatpickr-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year,
span.flatpickr-weekday,
.flatpickr-months .flatpickr-prev-month, 
.flatpickr-months .flatpickr-next-month {
    color: var(--text-primary) !important;
    fill: var(--text-primary) !important;
}
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover {
    color: var(--text-muted) !important;
}

