/* Typography: IRANSans font family */
@font-face {
    font-family: 'IRANSans';
    font-style: normal;
    font-weight: 400;
    src: url('../fonts/IRANSansWeb.woff2') format('woff2'),
         url('../fonts/IRANSansWeb.woff') format('woff'),
         url('../fonts/IRANSansWeb.ttf') format('truetype');
    font-display: swap;
}
@font-face {
    font-family: 'IRANSans';
    font-style: normal;
    font-weight: 300;
    src: url('../fonts/IRANSansWeb_Light.woff2') format('woff2'),
         url('../fonts/IRANSansWeb_Light.woff') format('woff');
    font-display: swap;
}
@font-face {
    font-family: 'IRANSans';
    font-style: normal;
    font-weight: 500;
    src: url('../fonts/IRANSansWeb_Medium.woff2') format('woff2'),
         url('../fonts/IRANSansWeb_Medium.woff') format('woff');
    font-display: swap;
}
@font-face {
    font-family: 'IRANSans';
    font-style: normal;
    font-weight: 700;
    src: url('../fonts/IRANSansWeb_Bold.woff2') format('woff2'),
         url('../fonts/IRANSansWeb_Bold.woff') format('woff');
    font-display: swap;
}

/* CSS variables for easy theming */
:root {
    --color-bg: #0f172a;
    --color-surface: #111827;
    --color-border: #1f2937;
    --color-text: #e5e7eb;
    --color-muted: #9ca3af;
    --color-primary: #3b82f6;
    --radius: 12px;
    --shadow: 0 10px 30px rgba(0,0,0,0.35);
}

/* Light theme variables override */
body[data-theme="light"] {
    --color-bg: #f3f4f6;
    --color-surface: #ffffff;
    --color-border: #e5e7eb;
    --color-text: #111827;
    --color-muted: #6b7280;
    --color-primary: #2563eb;
}

/* Base */
* { box-sizing: border-box; }
html, body { height: 100%; }
body.app-body {
    margin: 0;
    background: linear-gradient(180deg, #0b1020 0%, #0a0f1d 100%);
    color: var(--color-text);
    font-family: 'IRANSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Liberation Sans', sans-serif;
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

/* Light background base */
body.app-body[data-theme="light"] {
    background: #f8fafc;
}

.container { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

/* Header */
.app-header { position: sticky; top: 0; z-index: 10; background: rgba(2, 6, 23, 0.75); backdrop-filter: blur(10px); border-bottom: 1px solid var(--color-border); }
.app-body[data-theme="light"] .app-header { background: rgba(255,255,255,0.85); }
/* Header groups layout */
.app-header .container { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.header-right { display: inline-flex; align-items: center; gap: 16px; }
.header-left { display: inline-flex; align-items: center; gap: 16px; }
.brand-link { color: var(--color-text); text-decoration: none; font-weight: 700; letter-spacing: -0.3px; }
.nav { display: flex; align-items: center; gap: 12px; }
.nav-link { color: var(--color-muted); text-decoration: none; padding: 8px 10px; border-radius: 8px; transition: color .2s ease, background .2s ease; }
.nav-link:hover { color: var(--color-text); background: rgba(255,255,255,0.04); }
.nav-form { display: inline; }
.btn.btn-link { background: transparent; border: none; color: var(--color-muted); cursor: pointer; padding: 8px 10px; border-radius: 8px; }
.btn.btn-link:hover { color: var(--color-text); background: rgba(255,255,255,0.05); }

/* Main */
.app-main { padding: 40px 0; flex: 1 0 auto; }

/* Card */
.card {
    background: radial-gradient(1200px 600px at -10% -10%, rgba(59,130,246,0.14), transparent 40%),
                radial-gradient(800px 400px at 110% 10%, rgba(99,102,241,0.12), transparent 50%),
                linear-gradient(180deg, #0b1223 0%, #0a111f 100%);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
}
.app-body[data-theme="light"] .card { background: var(--color-surface); }
.card-header { margin-bottom: 18px; }
.card-title { margin: 0; font-size: 18px; font-weight: 700; color: var(--color-text); }
.card-subtitle { margin-top: 6px; color: var(--color-muted); font-size: 13px; }

/* Forms */
.form { display: grid; gap: 14px; }
.form-group { display: grid; gap: 6px; }
.label { color: var(--color-muted); font-size: 13px; }
.input, .btn, input, button, select, textarea { font-family: inherit; }
.input {
    width: 100%;
    background: #0b1223;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 12px 14px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.input:focus { border-color: rgba(59,130,246,0.6); box-shadow: 0 0 0 4px rgba(59,130,246,0.15); }
.app-body[data-theme="light"] .input { background: #ffffff; color: #111827; border-color: #e5e7eb; }
.help { color: var(--color-muted); font-size: 12px; }
.error { color: #fca5a5; font-size: 12px; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--color-muted); }
.checkbox input { width: 16px; height: 16px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-block { width: 100%; }

/* Auth layout helpers */
.auth-wrap { max-width: 420px; margin: 0 auto; }
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: var(--color-text); font-weight: 700; }
.auth-muted { color: var(--color-muted); font-size: 13px; }

/* Dashboard */
.dashboard-empty { text-align: center; padding: 60px 0; color: var(--color-muted); }

/* Footer sticky */
.app-footer { border-top: 1px solid var(--color-border); padding: 16px 0; flex-shrink: 0; background: rgba(2, 6, 23, 0.5); }
.app-body[data-theme="light"] .app-footer { background: #ffffff; }


/* Tabs */
.tabs { display: inline-flex; gap: 8px; margin-top: 12px; }
.tab-btn { background: transparent; border: 1px solid var(--color-border); color: var(--color-muted); padding: 8px 12px; border-radius: 999px; cursor: pointer; }
.tab-btn.active { background: rgba(59,130,246,0.1); color: var(--color-text); border-color: rgba(59,130,246,0.4); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Toolbar */
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; }

/* Table */
.table { width: 100%; border-collapse: collapse; border: 1px solid var(--color-border); border-radius: 12px; overflow: hidden; }
.table thead th { text-align: right; background: rgba(255,255,255,0.03); color: var(--color-muted); font-weight: 600; padding: 10px; border-bottom: 1px solid var(--color-border); }
.table tbody td { padding: 10px; border-bottom: 1px solid var(--color-border); }
.table tbody tr:hover { background: rgba(255,255,255,0.02); }

/* Action icon */
.icon-btn { background: transparent; border: 1px solid var(--color-border); color: var(--color-muted); width: 34px; height: 34px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { color: #ef4444; border-color: #ef4444; }

/* Pagination */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 12px; }
.page-btn { background: transparent; border: 1px solid var(--color-border); color: var(--color-text); padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.page-btn.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.page-btn[disabled] { opacity: 0.5; cursor: default; }

/* Skeleton */
.skeleton-list { display: grid; gap: 8px; }
.skeleton-row { height: 42px; border-radius: 10px; background: linear-gradient(90deg, rgba(255,255,255,0.06), rgba(255,255,255,0.12), rgba(255,255,255,0.06)); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { 0%{ background-position: 200% 0; } 100%{ background-position: -200% 0; } }

/* Modal */
.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 50; }
.modal[aria-hidden="false"] { display: flex; }
.modal-dialog { width: 100%; max-width: 620px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 14px; box-shadow: var(--shadow); position: relative; z-index: 2; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--color-border); }
.modal-body { padding: 16px; display: grid; gap: 10px; }
.modal-footer { padding: 12px 16px; border-top: 1px solid var(--color-border); display: flex; gap: 8px; justify-content: flex-end; }
.modal-close { background: transparent; border: none; color: var(--color-muted); font-size: 18px; cursor: pointer; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 1; }

/* Modal form inputs - enhanced styling */
.modal-body label { color: var(--color-muted); font-size: 13px; }
.modal-body input[type="text"],
.modal-body input[type="email"],
.modal-body input[type="password"],
.modal-body select,
.modal-body textarea {
    width: 100%;
    background: #0b1223;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 12px 14px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.app-body[data-theme="light"] .modal-body input[type="text"],
.app-body[data-theme="light"] .modal-body input[type="email"],
.app-body[data-theme="light"] .modal-body input[type="password"],
.app-body[data-theme="light"] .modal-body select,
.app-body[data-theme="light"] .modal-body textarea {
    background: #ffffff;
    color: #111827;
    border-color: #e5e7eb;
}
.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
    border-color: rgba(59,130,246,0.6);
    box-shadow: 0 0 0 4px rgba(59,130,246,0.15);
}

/* List container for responsive tables */
.list {
    overflow-x: auto;
    margin-bottom: 12px;
}

/* --- UI Enhancements & Overrides --- */
:root {
    --color-bg: #0f172a;
    --color-surface: #111827;
    --color-border: #1f2937;
    --color-text: #e5e7eb;
    --color-muted: #9ca3af;
    --color-primary: #3b82f6;
    --radius: 12px;
    --shadow: 0 10px 30px rgba(0,0,0,0.35);
}

/* Header micro-interactions */
.app-header { transition: background .2s ease, box-shadow .2s ease; }
.app-header.is-scrolled { background: rgba(2, 6, 23, 0.9); box-shadow: 0 6px 20px rgba(0,0,0,0.25); }
.brand-link { transition: opacity .2s ease; }
.brand-link:hover { opacity: .9; }
.nav-link { transition: color .2s ease, background .2s ease, transform .05s ease; }
.nav-link:active { transform: translateY(1px); }
.btn.btn-link { transition: background .2s ease, color .2s ease; }

/* Inputs */
.input { transition: border-color .2s ease, box-shadow .2s ease, background .2s ease; }
.input:hover { border-color: rgba(255,255,255,0.12); }
.app-body[data-theme="light"] .input:hover { border-color: #d1d5db; }

/* Buttons */
.btn { transition: filter .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease, border-color .15s ease; }
.btn-secondary { background: #334155; color: #e5e7eb; border: 1px solid #475569; }
.btn-secondary:hover { filter: brightness(1.05); }
.app-body[data-theme="light"] .btn-secondary { background: #e5e7eb; color: #111827; border-color: #d1d5db; }
.btn-outline { background: transparent; color: var(--color-text); border: 1px solid var(--color-border); }
.btn-outline:hover { border-color: rgba(59,130,246,0.4); }

/* Empty state */
.empty { text-align: center; color: var(--color-muted); padding: 24px 0; }

/* Modal animation (compatible with current display toggling) */
.modal .modal-dialog { transform: translateY(8px) scale(.98); opacity: 0; transition: transform .2s ease, opacity .2s ease; }
.modal[aria-hidden="false"] .modal-dialog { transform: translateY(0) scale(1); opacity: 1; }
.modal .modal-backdrop { opacity: 0; transition: opacity .2s ease; }
.modal[aria-hidden="false"] .modal-backdrop { opacity: 1; }

/* Accessibility helpers */
.skip-link { position: absolute; right: -9999px; top: -9999px; }
.skip-link:focus { right: 12px; top: 12px; background: var(--color-primary); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.visually-hidden { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }

/* --- Modern visual enhancements --- */

/* Primary button with subtle gradient */
.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #2563eb 100%);
}
.app-body[data-theme="light"] .btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #1d4ed8 100%);
}

/* Card hover elevation and smooth transitions */
.card {
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.card:hover {
    transform: translateY(-2px);
    border-color: rgba(59,130,246,0.35);
    box-shadow: 0 12px 32px rgba(0,0,0,0.35);
}

/* Active state for nav links */
.nav-link.active {
    color: var(--color-text);
    background: rgba(59,130,246,0.10);
    border-color: rgba(59,130,246,0.30);
}

/* Tabs with animated underline for active */
.tab-btn {
    position: relative;
    overflow: hidden;
}
.tab-btn.active::after {
    content: "";
    position: absolute;
    right: 12px;
    left: 12px;
    bottom: 6px;
    height: 2px;
    background: var(--color-primary);
    border-radius: 2px;
    opacity: .9;
}

/* Icon button micro interaction */
.icon-btn {
    transition: color .15s ease, border-color .15s ease, transform .08s ease;
}
.icon-btn:active { transform: translateY(1px); }

/* Inputs: improve placeholder */
.input::placeholder { color: var(--color-muted); opacity: .8; }

/* Zebra rows for tables (subtle) */
.table tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }
.app-body[data-theme="light"] .table tbody tr:nth-child(even) { background: rgba(0,0,0,0.02); }

/* Utility shadows */
.shadow-sm { box-shadow: 0 4px 12px rgba(0,0,0,0.18); }
.shadow-md { box-shadow: 0 8px 24px rgba(0,0,0,0.25); }
.shadow-lg { box-shadow: 0 16px 44px rgba(0,0,0,0.35); }

/* Badges and pills */
.badge { display: inline-block; padding: 4px 8px; font-size: 12px; border-radius: 999px; border: 1px solid var(--color-border); color: var(--color-muted); }
.badge.primary { background: rgba(59,130,246,0.12); color: var(--color-text); border-color: rgba(59,130,246,0.35); }

/* --- Top nav UX overrides --- */
.app-header .nav { gap: 16px; }
.app-header .nav .nav-link {
    position: relative;
    padding: 6px 2px;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    color: var(--color-muted);
}
.app-header .nav .nav-link:hover,
.app-header .nav .nav-link:focus-visible {
    color: var(--color-text);
}
.app-header .nav .nav-link::after {
    content: "";
    position: absolute;
    right: 0; left: 0; bottom: -6px;
    height: 2px; border-radius: 2px;
    background: linear-gradient(90deg, var(--color-primary), #6366f1);
    transform: scaleX(0);
    transform-origin: right;
    opacity: 0; transition: transform .18s ease, opacity .18s ease;
}
.app-header .nav .nav-link:hover::after,
.app-header .nav .nav-link.active::after,
.app-header .nav .nav-link:focus-visible::after {
    transform: scaleX(1);
    opacity: 1;
}
/* Make logout button behave like links in header */
.app-header .nav .btn.btn-link {
    padding: 6px 2px;
    border-radius: 0;
    background: transparent;
    color: var(--color-muted);
}
.app-header .nav .btn.btn-link:hover,
.app-header .nav .btn.btn-link:focus-visible {
    color: var(--color-text);
    background: transparent;
}


