/* ==========================================================================
   Global Styles - Farming Bank Ledger
   ========================================================================== */

@font-face {
    font-family: 'NotoNastaliqUrdu';
    src: url('../fonts/NotoNastaliqUrdu-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'NotoNastaliqUrdu';
    src: url('../fonts/NotoNastaliqUrdu-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary: #2563eb;
    --primary-2: #1d4ed8;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;

    --page-bg: #0b1220;
    --page-bg-2: #0f1b33;
    --card-bg: rgba(255, 255, 255, .06);
    --card-border: rgba(255, 255, 255, .12);

    --text-main: #eaf0ff;
    --text-muted: rgba(234, 240, 255, .72);
    --text-soft: rgba(234, 240, 255, .55);

    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 18px;

    --container: 1120px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
    background: radial-gradient(1200px 700px at 20% -10%, rgba(37, 99, 235, .35), transparent 55%),
                radial-gradient(900px 600px at 95% 10%, rgba(34, 197, 94, .20), transparent 55%),
                linear-gradient(180deg, var(--page-bg), var(--page-bg-2));
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.55;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 18px;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-link:focus {
    left: 16px;
    top: 16px;
    width: auto;
    height: auto;
    padding: 10px 12px;
    background: #fff;
    color: #000;
    border-radius: 10px;
    z-index: 9999;
}

/* Header & Navigation */
.header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    background: linear-gradient(90deg, rgba(10, 18, 38, .78), rgba(13, 27, 64, .55));
    border-bottom: 1px solid rgba(255, 255, 255, .10);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    gap: 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .14);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-title {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-title strong {
    font-size: 14px;
    letter-spacing: .2px;
}

.brand-title span {
    font-size: 12px;
    color: var(--text-muted);
}

.nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-links a {
    font-size: 13px;
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, .07);
    color: var(--text-main);
}

.nav-links a.active {
    background: rgba(37, 99, 235, .18);
    color: var(--text-main);
    border: 1px solid rgba(37, 99, 235, .35);
}

.nav-cta {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background: rgba(15, 27, 51, 0.95);
    border: 1px solid var(--card-border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow);
    padding: 8px 0;
    display: none;
    z-index: 100;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.dropdown-menu a:hover {
    background: rgba(255, 255, 255, .07);
    color: var(--text-main);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(255, 255, 255, .06);
    color: var(--text-main);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: transform .12s ease, background .12s ease, border-color .12s ease;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, .10);
}

.btn-primary {
    background: linear-gradient(180deg, var(--primary), var(--primary-2));
    border-color: rgba(255, 255, 255, .16);
}

.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-success {
    background: linear-gradient(180deg, var(--success), #16a34a);
    border-color: rgba(255, 255, 255, .16);
}

.btn-danger {
    background: linear-gradient(180deg, var(--danger), #dc2626);
    border-color: rgba(255, 255, 255, .16);
}

.btn-warning {
    background: linear-gradient(180deg, var(--warning), #d97706);
    border-color: rgba(255, 255, 255, .16);
    color: #1a1a1a;
}

.btn-outline {
    background: transparent;
    border-color: rgba(255, 255, 255, .20);
}

.btn-sm {
    padding: 8px 11px;
    border-radius: 11px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 20px;
    font-size: 15px;
}

.btn-block {
    width: 100%;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2, .card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Forms */
.form {
    padding: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(0, 0, 0, .18);
    color: var(--text-main);
    outline: none;
    font-size: 14px;
    font-family: inherit;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input:focus, select:focus, textarea:focus {
    border-color: rgba(37, 99, 235, .55);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .18);
}

input[type="file"] {
    padding: 10px;
}

input:disabled, select:disabled, textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.field-hint {
    font-size: 11px;
    color: var(--text-soft);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--card-border);
}

th {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    font-size: 14px;
}

tr:hover {
    background: rgba(255, 255, 255, .03);
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.text-nowrap {
    white-space: nowrap;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: rgba(34, 197, 94, .2);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, .2);
    color: var(--danger);
}

.badge-warning {
    background: rgba(245, 158, 11, .2);
    color: var(--warning);
}

.badge-info {
    background: rgba(37, 99, 235, .2);
    color: var(--primary);
}

.badge-muted {
    background: rgba(255, 255, 255, .1);
    color: var(--text-muted);
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--r-md);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: rgba(34, 197, 94, .15);
    border: 1px solid rgba(34, 197, 94, .3);
    color: #86efac;
}

.alert-danger {
    background: rgba(239, 68, 68, .15);
    border: 1px solid rgba(239, 68, 68, .3);
    color: #fca5a5;
}

.alert-warning {
    background: rgba(245, 158, 11, .15);
    border: 1px solid rgba(245, 158, 11, .3);
    color: #fcd34d;
}

.alert-info {
    background: rgba(37, 99, 235, .15);
    border: 1px solid rgba(37, 99, 235, .3);
    color: #93c5fd;
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--r-lg);
    padding: 20px;
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    margin-bottom: 12px;
    font-size: 20px;
}

.stat-card .stat-icon.blue {
    background: rgba(37, 99, 235, .2);
    color: var(--primary);
}

.stat-card .stat-icon.green {
    background: rgba(34, 197, 94, .2);
    color: var(--success);
}

.stat-card .stat-icon.red {
    background: rgba(239, 68, 68, .2);
    color: var(--danger);
}

.stat-card .stat-icon.yellow {
    background: rgba(245, 158, 11, .2);
    color: var(--warning);
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

.stat-card .stat-sub {
    font-size: 12px;
    color: var(--text-soft);
    margin-top: 8px;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 0;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.page-header .actions {
    display: flex;
    gap: 10px;
}

/* Filters */
.filters {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--r-lg);
    padding: 16px 20px;
    margin-bottom: 20px;
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.filters .field {
    margin-bottom: 0;
    min-width: 150px;
    flex: 1;
}

/* Urdu Text Support */
.ur {
    font-family: 'NotoNastaliqUrdu', serif;
    direction: rtl;
    unicode-bidi: plaintext;
    line-height: 2;
}

.mix {
    unicode-bidi: plaintext;
}

/* Amount formatting */
.amount {
    font-family: ui-monospace, 'SF Mono', Monaco, 'Courier New', monospace;
    font-weight: 600;
}

.amount.credit {
    color: var(--success);
}

.amount.debit {
    color: var(--danger);
}

/* Attachments */
.attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.attachment-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.attachment-item:hover {
    background: rgba(255, 255, 255, .08);
    color: var(--text-main);
}

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

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    margin: 0 0 8px;
    color: var(--text-main);
}

.empty-state p {
    margin: 0 0 20px;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 400px;
}

.login-box .card {
    padding: 32px;
}

.login-box .brand {
    justify-content: center;
    margin-bottom: 24px;
}

.login-box h1 {
    text-align: center;
    font-size: 20px;
    margin: 0 0 24px;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    padding: 16px 0;
}

.pagination a, .pagination span {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
}

.pagination a:hover {
    background: rgba(255, 255, 255, .1);
}

.pagination .active {
    background: var(--primary);
    border-color: var(--primary);
}

/* Transaction View */
.detail-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--card-border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 13px;
    color: var(--text-muted);
}

.detail-value {
    font-size: 14px;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
}

/* Responsive */
@media (max-width: 940px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(10, 18, 38, 0.98);
        flex-direction: column;
        padding: 16px;
        border-bottom: 1px solid var(--card-border);
    }

    .nav-links.active {
        display: flex;
    }

    .menu-toggle {
        display: block;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .filters-row {
        flex-direction: column;
    }

    .filters .field {
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .field-row {
        grid-template-columns: 1fr;
    }

    .detail-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

/* Main Content Wrapper */
main {
    padding-bottom: 40px;
}

/* Actions column in tables */
.actions-cell {
    display: flex;
    gap: 6px;
}

/* Status indicators */
.status-active {
    color: var(--success);
}

.status-inactive {
    color: var(--text-soft);
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, .2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Tooltip */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: rgba(0, 0, 0, .9);
    color: #fff;
    font-size: 12px;
    white-space: nowrap;
    border-radius: 6px;
    z-index: 100;
}

/* Print utilities */
@media print {
    .no-print {
        display: none !important;
    }
}
