/* ============================================================
   विश्वमंगल मराठी फाऊंडेशन - Main Stylesheet (Laravel build)
   Theme colours derived from the foundation logo.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Tiro+Devanagari+Marathi:ital@0;1&family=Noto+Sans+Devanagari:wght@400;500;600;700&family=Mukta:wght@300;400;500;600;700&display=swap');

:root {
    --brand-primary: #C0392B;
    --brand-primary-dark: #8E2A1F;
    --brand-primary-light: #E55A48;
    --brand-secondary: #D4A24C;
    --brand-secondary-dark: #A07A2E;
    --brand-accent: #F5E6CA;
    --brand-accent-light: #FFF8E7;
    --brand-maroon: #6E2C1C;

    --bg-body: #FBF6EC;
    --bg-surface: #FFFFFF;
    --bg-surface-2: #FAF3E4;
    --bg-sidebar: linear-gradient(180deg, #8E2A1F 0%, #6E2C1C 100%);

    --text-primary: #2B1810;
    --text-secondary: #5A4032;
    --text-muted: #8A7560;
    --text-on-dark: #FFF8E7;

    --border-light: #EBDFC4;
    --border-medium: #D4C49A;
    --shadow-sm: 0 1px 2px rgba(110, 44, 28, 0.06);
    --shadow-md: 0 4px 12px rgba(110, 44, 28, 0.10);
    --shadow-lg: 0 10px 30px rgba(110, 44, 28, 0.15);

    --status-success: #2E7D32;
    --status-warning: #ED8936;
    --status-danger: #C53030;
    --status-info: #2B6CB0;

    --radius: 10px;
    --radius-sm: 6px;
    --sidebar-w: 256px;
}

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

body {
    font-family: 'Mukta', 'Noto Sans Devanagari', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 15px;
}

a { color: var(--brand-primary); text-decoration: none; }
a:hover { color: var(--brand-primary-dark); }

h1, h2, h3, h4 {
    font-family: 'Tiro Devanagari Marathi', serif;
    color: var(--brand-maroon);
    font-weight: 600;
    line-height: 1.35;
}

/* ---------------- Auth pages ---------------- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #8E2A1F 0%, #6E2C1C 60%, #4A1E13 100%);
}
.auth-card {
    background: var(--bg-surface);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}
.auth-head {
    background: var(--bg-sidebar);
    padding: 28px 28px 22px;
    text-align: center;
    color: var(--text-on-dark);
}
.auth-logo {
    width: 64px; height: 64px;
    margin: 0 auto 12px;
    background: var(--brand-accent-light);
    color: var(--brand-primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Tiro Devanagari Marathi', serif;
    font-size: 30px; font-weight: 700;
}
.auth-head h1 { color: var(--text-on-dark); font-size: 20px; }
.auth-head p  { color: var(--brand-accent); font-size: 13px; margin-top: 4px; }
.auth-body { padding: 28px; }

/* ---------------- Layout shell ---------------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    color: var(--text-on-dark);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 50;
    transition: transform .25s ease;
}
.sidebar-brand {
    padding: 20px 18px;
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-brand .logo {
    width: 42px; height: 42px;
    background: var(--brand-accent-light);
    color: var(--brand-primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Tiro Devanagari Marathi', serif;
    font-size: 21px; font-weight: 700;
    flex-shrink: 0;
}
.sidebar-brand .txt strong { display: block; font-size: 14px; color: var(--text-on-dark); }
.sidebar-brand .txt span { font-size: 11px; color: var(--brand-accent); }

.sidebar-nav { padding: 14px 10px; overflow-y: auto; flex: 1; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--brand-accent);
    font-size: 14px; font-weight: 500;
    margin-bottom: 3px;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.10); color: #fff; }
.sidebar-nav a.active {
    background: var(--brand-secondary);
    color: var(--brand-maroon);
    font-weight: 600;
}
.sidebar-nav .nav-ico { width: 18px; text-align: center; }
.sidebar-foot {
    padding: 14px;
    border-top: 1px solid rgba(255,255,255,.12);
    font-size: 12px; color: var(--brand-accent);
}

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }

.topbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
    padding: 12px 22px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 40;
}
.topbar h2 { font-size: 18px; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.user-chip {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px;
}
.user-avatar {
    width: 34px; height: 34px;
    background: var(--brand-primary);
    color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
}
.role-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11px; font-weight: 600;
    background: var(--brand-accent);
    color: var(--brand-maroon);
}
.menu-toggle {
    display: none;
    background: none; border: none;
    font-size: 22px; color: var(--brand-primary);
    cursor: pointer;
}

.content { padding: 22px; max-width: 1180px; }
.page-head {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
    margin-bottom: 18px;
}
.page-head h1 { font-size: 22px; }
.page-head .sub { color: var(--text-muted); font-size: 13px; }

/* ---------------- Cards ---------------- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 18px;
}
.card-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
}
.card-head h3 { font-size: 16px; }
.card-body { padding: 18px; }

/* stat cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--brand-primary);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
}
.stat-card.gold   { border-left-color: var(--brand-secondary); }
.stat-card.green  { border-left-color: var(--status-success); }
.stat-card.blue   { border-left-color: var(--status-info); }
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--brand-maroon); font-family: 'Tiro Devanagari Marathi', serif; }
.stat-card .lbl { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.stat-card-label { font-size: 13px; color: var(--text-muted); }
.stat-card-value {
    font-size: 28px; font-weight: 700;
    color: var(--brand-maroon);
    font-family: 'Tiro Devanagari Marathi', serif;
    margin-top: 4px;
}
.topbar-title { font-size: 18px; font-weight: 700; color: var(--brand-maroon); }
.ss-input.ss-placeholder { color: var(--text-muted); }

/* English-only fields: brief red flash when a non-English char is blocked */
.en-only-bad {
    border-color: var(--status-danger) !important;
    box-shadow: 0 0 0 3px rgba(197,48,48,.15) !important;
}

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary   { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-primary-dark); color: #fff; }
.btn-secondary { background: var(--brand-secondary); color: var(--brand-maroon); }
.btn-secondary:hover { background: var(--brand-secondary-dark); color:#fff; }
.btn-outline   { background: transparent; border-color: var(--border-medium); color: var(--text-secondary); }
.btn-outline:hover { background: var(--bg-surface-2); }
.btn-danger    { background: var(--status-danger); color: #fff; }
.btn-danger:hover { background: #9b2222; color:#fff; }
.btn-success   { background: var(--status-success); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------------- Forms ---------------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.form-group { display: flex; flex-direction: column; }
.form-group.full { grid-column: 1 / -1; }
label {
    font-size: 13px; font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
}
label .req { color: var(--status-danger); }
input[type=text], input[type=email], input[type=tel], input[type=number],
input[type=date], input[type=search], select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-family: inherit; font-size: 14px;
    background: var(--bg-surface);
    color: var(--text-primary);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(192,57,43,.12);
}
textarea { resize: vertical; min-height: 70px; }
select:disabled { background: var(--bg-surface-2); color: var(--text-muted); }
.field-error { color: var(--status-danger); font-size: 12px; margin-top: 4px; }
.form-actions {
    display: flex; gap: 10px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

/* searchable dropdown */
.ss-wrap { position: relative; }
.ss-input { cursor: pointer; background: var(--bg-surface); }
.ss-panel {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    z-index: 30;
    margin-top: 3px;
    display: none;
    max-height: 240px;
    overflow: hidden;
}
.ss-panel.open { display: block; }
.ss-search { padding: 7px; border-bottom: 1px solid var(--border-light); }
.ss-search input { padding: 6px 9px; font-size: 13px; }
.ss-list { max-height: 185px; overflow-y: auto; }
.ss-opt {
    padding: 8px 12px;
    font-size: 14px; cursor: pointer;
}
.ss-opt:hover, .ss-opt.hl { background: var(--brand-accent); }
.ss-opt.empty { color: var(--text-muted); cursor: default; }
.ss-opt.empty:hover { background: transparent; }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; }
.table-wrap table,
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.table-wrap table th, .table-wrap table td,
table.data th, table.data td {
    padding: 10px 12px;
    text-align: right;
    border-bottom: 1px solid var(--border-light);
}
.table-wrap table thead th,
table.data thead th {
    background: var(--bg-surface-2);
    color: var(--brand-maroon);
    font-weight: 600;
    white-space: nowrap;
}
.table-wrap table tbody tr:hover,
table.data tbody tr:hover { background: var(--bg-surface-2); }
.table-wrap table .actions,
table.data .actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------------- Badges ---------------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px; font-weight: 600;
}
.badge-pending  { background: #FEF0D9; color: #B8651A; }
.badge-approved { background: #DBF0DC; color: #1E6B22; }
.badge-rejected { background: #FBDEDE; color: #A12525; }
.badge-active   { background: #DBF0DC; color: #1E6B22; }
.badge-inactive { background: #EEE6D5; color: #8A7560; }
.badge-admin    { background: #FBDEDE; color: #A12525; }
.badge-operator { background: #DCE8F5; color: #245A8C; }
.badge-public   { background: #EEE6D5; color: #6E5A40; }

/* ---------------- Alerts ---------------- */
.alert {
    padding: 11px 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid transparent;
}
.alert-success { background: #DBF0DC; border-color:#9FD3A2; color: #1E6B22; }
.alert-danger  { background: #FBDEDE; border-color:#E8A9A9; color: #A12525; }
.alert-info    { background: #DCE8F5; border-color:#A9C5E0; color: #245A8C; }
.alert ul { margin: 4px 0 0; padding-right: 18px; }

/* ---------------- Toolbar / filters ---------------- */
.toolbar {
    display: flex; flex-wrap: wrap; gap: 10px;
    align-items: flex-end;
    margin-bottom: 16px;
}
.toolbar .form-group { margin: 0; }
.toolbar .grow { flex: 1; min-width: 180px; }

/* ---------------- Pagination ---------------- */
.pagination {
    display: flex; gap: 4px; flex-wrap: wrap;
    list-style: none;
    margin-top: 16px;
    justify-content: center;
}
.pagination a, .pagination span {
    padding: 6px 11px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
}
.pagination a:hover { background: var(--bg-surface-2); }
.pagination .active span,
.pagination span.active {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
}
.pagination .disabled span,
.pagination span.disabled { opacity: .45; }

/* ---------------- Misc ---------------- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.empty-state .big { font-size: 40px; margin-bottom: 8px; }
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 22px;
}
.detail-row .k { font-size: 12px; color: var(--text-muted); }
.detail-row .v { font-size: 15px; color: var(--text-primary); font-weight: 500; }
.muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.flex-between { display:flex; align-items:center; justify-content:space-between; gap:12px; }

.otp-inputs { display: flex; gap: 8px; justify-content: center; margin: 8px 0 4px; }
.otp-inputs input {
    width: 44px; height: 52px;
    text-align: center;
    font-size: 22px; font-weight: 700;
    font-family: 'Tiro Devanagari Marathi', serif;
}
.demo-otp {
    background: var(--brand-accent);
    border: 1px dashed var(--brand-secondary-dark);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-size: 13px;
    text-align: center;
    margin-bottom: 14px;
    color: var(--brand-maroon);
}
.demo-otp b { font-size: 17px; letter-spacing: 2px; }

.master-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px,1fr));
    gap: 14px;
}
.master-tile {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    text-align: center;
}
.master-tile:hover { box-shadow: var(--shadow-md); }
.master-tile .ico { font-size: 30px; }
.master-tile .nm { font-size: 15px; font-weight: 600; color: var(--brand-maroon); margin-top: 6px; }
.master-tile .ct { font-size: 12px; color: var(--text-muted); }

/* public-search results — exactly 3 cards per row */
.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

/* ---------------- Responsive ---------------- */
.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 45;
}

/* Tablet — 3-column grids drop to 2 */
@media (max-width: 1024px) {
    .results-grid { grid-template-columns: repeat(2, 1fr); }
    .content { padding: 18px; }
}

/* Below 880px — sidebar collapses to an off-canvas drawer */
@media (max-width: 880px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop.show { display: block; }
    .main { margin-left: 0; }
    .menu-toggle { display: block; }
    .form-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
}

/* Phone — single column everywhere, stacked controls */
@media (max-width: 640px) {
    .content { padding: 14px; }
    .results-grid { grid-template-columns: 1fr; }
    .master-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-grid  { grid-template-columns: repeat(2, 1fr); }

    /* page header + toolbar stack vertically */
    .page-head { flex-direction: column; align-items: stretch; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar .form-group,
    .toolbar .grow { width: 100%; min-width: 0; }
    .form-actions { flex-wrap: wrap; }
    .form-actions .btn { flex: 1; }

    /* tables scroll sideways instead of squashing */
    .table-wrap { -webkit-overflow-scrolling: touch; }
    .table-wrap table { min-width: 560px; }

    /* topbar tightens up */
    .topbar { padding: 10px 14px; }
    .topbar-user .user-chip span { display: none; }   /* keep avatar, hide long name */
    .role-badge { display: none; }

    /* buttons easier to tap */
    .btn { padding: 10px 14px; }
    .otp-inputs input { width: 38px; height: 46px; font-size: 19px; }
}

/* Very small phones — stat cards single column */
@media (max-width: 380px) {
    .stat-grid, .master-grid { grid-template-columns: 1fr; }
}

/* ---------------- Print ---------------- */
@media print {
    .sidebar, .topbar, .form-actions, .toolbar, .pagination,
    .btn, .menu-toggle, .sidebar-backdrop { display: none !important; }
    .main { margin-left: 0; }
    .content { padding: 0; }
    .card { box-shadow: none; border-color: #999; }
    body { background: #fff; }
}
