/* Mizan — Modern colors, flat icons, save animations */

:root {
    /* لوحة ميزان — كحلي وذهبي، مطابقة لتطبيق الجوال وصفحات المكتب */
    --white: #ffffff;
    --bg: #f6f8fc;
    --surface: #ffffff;
    --border: #e6eaf1;
    --border-light: #f0f3f8;
    --primary: #1a3a6b;
    --primary-dark: #12294d;
    --primary-hover: #15305a;
    --primary-light: #e9eef7;
    --primary-bright: #2b5a9e;
    --accent: #c9a227;
    --accent-light: #f7efd6;
    --cyan: #2c8cb4;
    --cyan-light: #e0f0f6;
    --amber: #c9a227;
    --amber-light: #f7efd6;
    --rose: #c65b6e;
    --text: #16223a;
    --text-secondary: #3a4a63;
    --text-muted: #7a8699;
    --success: #1e9e6a;
    --success-light: #ddf3ea;
    --error: #d64550;
    --gradient-primary: linear-gradient(135deg, #1a3a6b 0%, #2b5a9e 100%);
    --gradient-accent: linear-gradient(135deg, #dab84a 0%, #c9a227 100%);
    --gradient-hero: linear-gradient(160deg, #eef3fb 0%, #f8fafc 42%, #fbf7ec 100%);
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(18,41,77,0.06);
    --shadow: 0 8px 24px rgba(26,58,107,0.08);
    --shadow-3d: 0 10px 20px rgba(26,58,107,0.15), 0 4px 8px rgba(18,41,77,0.06);
    --sidebar-width: 268px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 80% 50% at 20% -10%, rgba(26,58,107,0.07), transparent),
        radial-gradient(ellipse 60% 40% at 90% 10%, rgba(201,162,39,0.05), transparent);
}

a:hover { color: var(--primary); }

.min-btn-primary, .mx-btn-primary, .neu-btn-primary {
    background: var(--gradient-primary);
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(26,58,107,0.32);
}

.min-btn-primary:hover, .mx-btn-primary:hover, .neu-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(26,58,107,0.4);
}

.min-btn-accent, .mx-btn-gold, .neu-btn-gold {
    background: var(--gradient-accent);
    color: var(--white);
    border-color: transparent;
}

.stat-card .stat-value {
    color: var(--primary);
    -webkit-text-fill-color: var(--primary);
    background: none;
    font-size: 2.1rem;
}

/* ─── COLORED ICON BACKGROUNDS (icons stay visible) ─── */
.nav-icon, .page-icon, .stat-icon-flat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 17px;
    line-height: 1;
    border: 1px solid transparent;
}

.ic-blue   { background: #e9eef7; border-color: #d3ddf0; }
.ic-purple { background: #ece7f5; border-color: #ddd4ee; }
.ic-cyan   { background: #e0f0f6; border-color: #c4e4ef; }
.ic-amber  { background: #f7efd6; border-color: #efe0b0; }
.ic-green  { background: #ddf3ea; border-color: #bfe6d5; }
.ic-rose   { background: #f7e3e7; border-color: #eecad1; }

.page-icon { width: 44px; height: 44px; font-size: 22px; border-radius: 12px; }
.stat-icon-flat { width: 44px; height: 44px; font-size: 20px; border-radius: 12px; margin-bottom: 14px; }
.nav-icon { width: 36px; height: 36px; font-size: 17px; border-radius: 10px; }

/* ─── أيقونات ثلاثية الأبعاد (تدرّج + ظل ناعم) مطابقة للتطبيق ─── */
.page-icon, .stat-icon-flat {
    border: 0.8px solid rgba(255,255,255,0.6);
    box-shadow: 0 6px 14px rgba(26,58,107,0.10), inset 0 1px 0 rgba(255,255,255,0.7);
}
.page-icon.ic-blue,   .stat-icon-flat.ic-blue   { background: linear-gradient(145deg, #3660a3, #1a3a6b); box-shadow: 0 7px 16px rgba(26,58,107,0.32), inset 0 1px 0 rgba(255,255,255,0.28); }
.page-icon.ic-purple, .stat-icon-flat.ic-purple { background: linear-gradient(145deg, #7566a6, #5a4a8a); box-shadow: 0 7px 16px rgba(90,74,138,0.32), inset 0 1px 0 rgba(255,255,255,0.28); }
.page-icon.ic-cyan,   .stat-icon-flat.ic-cyan   { background: linear-gradient(145deg, #49a7ce, #2c8cb4); box-shadow: 0 7px 16px rgba(44,140,180,0.32), inset 0 1px 0 rgba(255,255,255,0.28); }
.page-icon.ic-amber,  .stat-icon-flat.ic-amber  { background: linear-gradient(145deg, #dab84a, #c9a227); box-shadow: 0 7px 16px rgba(201,162,39,0.32), inset 0 1px 0 rgba(255,255,255,0.30); }
.page-icon.ic-green,  .stat-icon-flat.ic-green  { background: linear-gradient(145deg, #34c48a, #1e9e6a); box-shadow: 0 7px 16px rgba(30,158,106,0.32), inset 0 1px 0 rgba(255,255,255,0.28); }
.page-icon.ic-rose,   .stat-icon-flat.ic-rose   { background: linear-gradient(145deg, #d97e8d, #c65b6e); box-shadow: 0 7px 16px rgba(198,91,110,0.32), inset 0 1px 0 rgba(255,255,255,0.28); }

/* ─── DASHBOARD ─── */
.dash-welcome {
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    margin-bottom: 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    box-shadow: 0 10px 28px rgba(26,58,107,0.28);
}

.dash-welcome h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 6px; }
.dash-welcome p { opacity: 0.9; font-size: 14px; }
.dash-welcome .dash-date { font-size: 13px; opacity: 0.85; background: rgba(255,255,255,0.15); padding: 8px 14px; border-radius: 8px; }

.dash-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.dash-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 1100px) {
    .dash-grid, .dash-grid-3 { grid-template-columns: 1fr; }
}

.dash-panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.dash-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
}

.dash-panel-head h3 { font-size: 16px; font-weight: 700; color: var(--text); }
.dash-panel-head a { font-size: 13px; color: var(--primary); font-weight: 600; }

.chart-bars { display: flex; flex-direction: column; gap: 14px; }
.chart-row { display: grid; grid-template-columns: 100px 1fr 40px; align-items: center; gap: 12px; }
.chart-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; text-align: right; }
.chart-track { height: 10px; background: var(--border-light); border-radius: 99px; overflow: hidden; }
.chart-fill { height: 100%; border-radius: 99px; background: var(--gradient-primary); transition: width 0.6s ease; }
.chart-fill.purple { background: var(--gradient-accent); }
.chart-fill.cyan { background: linear-gradient(90deg, #49a7ce, #2c8cb4); }
.chart-fill.amber { background: linear-gradient(90deg, #dab84a, #c9a227); }
.chart-fill.green { background: linear-gradient(90deg, #34c48a, #1e9e6a); }
.chart-val { font-size: 13px; font-weight: 700; color: var(--text); text-align: left; }

.report-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.report-mini {
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: var(--bg);
}
.report-mini .label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.report-mini .value { font-size: 1.25rem; font-weight: 800; color: var(--text); }
.report-mini .value.income { color: var(--success); }
.report-mini .value.expense { color: var(--rose); }

.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.quick-actions .min-btn { font-size: 13px; padding: 9px 18px; }

.stat-card { position: relative; overflow: hidden; }
.stat-card .stat-label { font-size: 14px; font-weight: 500; color: var(--text-secondary); }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
}

.sidebar-nav a.active {
    font-weight: 700;
    color: var(--primary-dark);
    background: var(--primary-light);
    border-right: 3px solid var(--primary);
}

.hero { background: transparent; }
.hero h1 { color: var(--primary-dark); }

.top-bar h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
}

.min-table td, .mx-table td, .neu-table td {
    font-size: 15px;
    color: var(--text);
}

.feature-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.feature-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.75;
}

/* ─── SAVE OVERLAY ─── */
.mizan-save-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.45);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

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

.mizan-save-modal {
    background: var(--white);
    border-radius: 20px;
    padding: 40px 48px;
    text-align: center;
    box-shadow: 0 24px 64px rgba(15,23,42,0.2);
    transform: scale(0.7) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mizan-save-overlay.active .mizan-save-modal {
    transform: scale(1) translateY(0);
}

.mizan-save-overlay.success .mizan-check-circle {
    stroke-dashoffset: 0;
}

.mizan-check-wrap {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    position: relative;
}

.mizan-check-circle-bg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: mizanPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    box-shadow: 0 8px 24px rgba(26,58,107,0.38);
}

.mizan-save-overlay.success .mizan-check-circle-bg {
    background: linear-gradient(135deg, #34c48a, #1e9e6a);
    box-shadow: 0 8px 24px rgba(30,158,106,0.4);
}

.mizan-check-svg {
    width: 36px;
    height: 36px;
    stroke: white;
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mizan-check-path {
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: mizanDrawCheck 0.4s 0.3s ease forwards;
}

.mizan-save-overlay.success .mizan-check-path {
    animation: mizanDrawCheck 0.4s 0.1s ease forwards;
}

.mizan-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: mizanSpin 0.8s linear infinite;
    margin: 0 auto 20px;
}

.mizan-save-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.mizan-save-sub {
    font-size: 14px;
    color: var(--text-muted);
}

/* ─── TOAST ─── */
.mizan-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--white);
    border: 1px solid var(--success-light);
    border-radius: 14px;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 12px 40px rgba(30,158,106,0.2);
    z-index: 9998;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
}

.mizan-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.mizan-toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #34c48a, #1e9e6a);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    animation: mizanPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mizan-toast-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

/* ─── BUTTON LOADING ─── */
.min-btn.loading, .mx-btn-primary.loading {
    pointer-events: none;
    opacity: 0.85;
    position: relative;
    color: transparent !important;
}

.min-btn.loading::after, .mx-btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: mizanSpin 0.7s linear infinite;
    left: 50%;
    top: 50%;
    margin: -9px 0 0 -9px;
}

/* ─── CARD HOVER ─── */
.min-card-sm, .stat-card {
    transition: transform 0.25s, box-shadow 0.25s;
}

.min-card-sm:hover, .stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.feature-card {
    transition: transform 0.25s;
}

.feature-card:hover {
    transform: translateY(-2px);
}

/* ─── ANIMATIONS ─── */
@keyframes mizanSpin {
    to { transform: rotate(360deg); }
}

@keyframes mizanPop {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes mizanDrawCheck {
    to { stroke-dashoffset: 0; }
}

@keyframes mizanFadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.stats-grid .stat-card {
    animation: mizanFadeUp 0.5s ease backwards;
}

.stats-grid .stat-card:nth-child(1) { animation-delay: 0.05s; }
.stats-grid .stat-card:nth-child(2) { animation-delay: 0.1s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: 0.15s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: 0.2s; }
.stats-grid .stat-card:nth-child(5) { animation-delay: 0.25s; }
.stats-grid .stat-card:nth-child(6) { animation-delay: 0.3s; }
.stats-grid .stat-card:nth-child(7) { animation-delay: 0.35s; }

.alert-success {
    background: var(--success-light);
    border: 1px solid rgba(30,158,106,0.3);
    color: #157a52;
    animation: mizanFadeUp 0.4s ease;
}
