/* =========================================================
   VHP Devotee Management System — Custom Styles
   ========================================================= */

/* ── CSS Variables ─────────────────────────────────────── */
:root {
    --vhp-orange: #FF6B00;
    --vhp-orange-dark: #c44e00;
    --sidebar-width: 260px;
    --sidebar-bg: #1a1a2e;
    --sidebar-hover: rgba(255, 107, 0, 0.15);
    --sidebar-active-bg: rgba(255, 107, 0, 0.25);
    --transition-speed: 0.25s;
}

/* ── Global ────────────────────────────────────────────── */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f4f6f9;
    color: #2d3748;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg) !important;
    min-height: 100vh;
    transition: transform var(--transition-speed) ease;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
    box-shadow: 2px 0 12px rgba(0,0,0,0.3);
    z-index: 100;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}

/* Sidebar brand */
.sidebar .navbar-brand,
.sidebar a.text-white {
    color: #fff !important;
    text-decoration: none;
    font-size: 1rem;
    letter-spacing: 0.3px;
}

/* Nav items */
.sidebar .nav-pills .nav-link {
    color: rgba(255, 255, 255, 0.75);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 2px;
    font-size: 0.875rem;
    transition: background var(--transition-speed), color var(--transition-speed);
    display: flex;
    align-items: center;
}

.sidebar .nav-pills .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar .nav-pills .nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--vhp-orange) !important;
    font-weight: 600;
    border-left: 3px solid var(--vhp-orange);
}

.sidebar .nav-pills .nav-link i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Section headers */
.nav-item-header {
    font-size: 0.65rem;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4) !important;
    padding: 6px 14px 2px;
    text-transform: uppercase;
    list-style: none;
}

/* ── Avatar Circle ─────────────────────────────────────── */
.avatar-circle {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--vhp-orange), var(--vhp-orange-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    box-shadow: 0 2px 6px rgba(255, 107, 0, 0.4);
}

/* ── Main Content ──────────────────────────────────────── */
.main-content {
    min-height: 100vh;
    background: #f4f6f9;
    padding: 24px;
}

/* ── Cards ─────────────────────────────────────────────── */
.card {
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    transition: box-shadow var(--transition-speed);
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

/* Stat cards on dashboards */
.stat-card {
    border-radius: 14px;
    border: none;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* ── DataTables ─────────────────────────────────────────── */
.dataTables_wrapper .dataTables_processing {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 16px 24px;
    font-size: 0.875rem;
    color: var(--vhp-orange);
    font-weight: 500;
    z-index: 50;
}

.dataTables_wrapper .dataTables_processing::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--vhp-orange);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

.table thead th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
    vertical-align: middle;
}

.table tbody tr {
    transition: background var(--transition-speed);
}

.table tbody tr:hover {
    background: rgba(255, 107, 0, 0.03);
}

.table td {
    vertical-align: middle;
    font-size: 0.875rem;
}

/* DT buttons */
div.dt-buttons .btn {
    border-radius: 6px;
    font-size: 0.8rem;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn-warning {
    background: linear-gradient(135deg, #FF6B00, #e55f00);
    border-color: #e55f00;
    color: #fff !important;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(255, 107, 0, 0.3);
    transition: all var(--transition-speed);
}

.btn-warning:hover, .btn-warning:focus {
    background: linear-gradient(135deg, #e55f00, #cc5200);
    border-color: #cc5200;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.4);
    color: #fff !important;
}

.btn-warning.text-dark {
    color: #fff !important;
}

/* ── Badges ─────────────────────────────────────────────── */
.badge {
    font-weight: 500;
    letter-spacing: 0.3px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
}

/* ── Forms ──────────────────────────────────────────────── */
.form-control:focus,
.form-select:focus {
    border-color: var(--vhp-orange);
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 0, 0.15);
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
}

.select2-container--bootstrap-5 .select2-selection--single:focus,
.select2-container--bootstrap-5 .select2-selection--single.select2-selection--focus {
    border-color: var(--vhp-orange) !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 0, 0.15) !important;
}

/* ── Multi-step form progress ───────────────────────────── */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 2rem;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
    max-width: 160px;
}

.step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 18px;
    left: 50%;
    right: -50%;
    height: 2px;
    background: #dee2e6;
    z-index: 0;
    transition: background var(--transition-speed);
}

.step-item.completed:not(:last-child)::after {
    background: var(--vhp-orange);
}

.step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #dee2e6;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    z-index: 1;
    transition: all var(--transition-speed);
    position: relative;
}

.step-item.active .step-circle {
    background: var(--vhp-orange);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.2);
}

.step-item.completed .step-circle {
    background: #198754;
    color: #fff;
}

.step-label {
    font-size: 0.72rem;
    margin-top: 6px;
    color: #6c757d;
    font-weight: 500;
    text-align: center;
}

.step-item.active .step-label {
    color: var(--vhp-orange);
    font-weight: 600;
}

.step-item.completed .step-label {
    color: #198754;
}

/* ── Loading / Spinner ──────────────────────────────────── */
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

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

.page-loader {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.88);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s;
}

.page-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 107, 0, 0.2);
    border-top-color: var(--vhp-orange);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loader-text {
    margin-top: 14px;
    color: var(--vhp-orange);
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* Button loading state */
.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.5);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
    border-radius: 10px;
    border: none;
    font-size: 0.875rem;
}

.alert-danger  { background: #fef2f2; color: #991b1b; border-left: 4px solid #ef4444; }
.alert-success { background: #f0fdf4; color: #166534; border-left: 4px solid #22c55e; }
.alert-warning { background: #fffbeb; color: #92400e; border-left: 4px solid #f59e0b; }
.alert-info    { background: #eff6ff; color: #1e40af; border-left: 4px solid #3b82f6; }

/* ── Modal ──────────────────────────────────────────────── */
.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
    border-radius: 16px 16px 0 0;
    border-bottom: 1px solid rgba(0,0,0,0.07);
    padding: 1.25rem 1.5rem;
}

.modal-footer {
    border-top: 1px solid rgba(0,0,0,0.07);
    padding: 1rem 1.5rem;
    border-radius: 0 0 16px 16px;
}

/* ── Navbar (public) ────────────────────────────────────── */
.navbar-dark.bg-gradient-orange {
    background: linear-gradient(90deg, #FF6B00, #c44e00) !important;
}

/* ── Verify page card ───────────────────────────────────── */
.verify-result-card {
    border-radius: 16px;
    overflow: hidden;
    animation: fadeIn 0.4s ease;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 767.98px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        z-index: 1040;
        height: 100%;
        overflow-y: auto;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1039;
        display: none;
    }

    .sidebar-backdrop.show {
        display: block;
    }

    .main-content {
        padding: 16px;
        padding-top: 56px; /* room for fixed sidebar toggle button */
        width: 100%;
        min-width: 0;
    }

    #sidebarToggle {
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 1045;
        display: flex !important;
    }

    /* Tables: shrink font on very small screens */
    .table td, .table th {
        font-size: 0.8rem;
    }

    /* Modal: full screen on small phones for xl modals */
    .modal-dialog.modal-xl,
    .modal-dialog.modal-lg {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }

    .modal-dialog.modal-xl .modal-content,
    .modal-dialog.modal-lg .modal-content {
        border-radius: 0;
        height: 100%;
        overflow-y: auto;
    }

    /* Stat cards: ensure they don't overflow */
    .stat-card .card-body {
        padding: 0.75rem;
    }

    /* Input group full width on mobile */
    .input-group {
        max-width: 100% !important;
        width: 100% !important;
    }
}

@media (max-width: 575.98px) {
    .main-content {
        padding: 12px;
        padding-top: 56px;
    }

    /* Stack d-flex headers on very small screens */
    .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Badges slightly smaller */
    .badge {
        font-size: 0.7rem;
        padding: 4px 7px;
    }
}

/* ── Utility ────────────────────────────────────────────── */
.text-orange { color: var(--vhp-orange) !important; }
.bg-orange   { background: var(--vhp-orange) !important; }
.border-orange { border-color: var(--vhp-orange) !important; }

.rounded-xl { border-radius: 16px; }
.rounded-lg { border-radius: 12px; }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }

.cursor-pointer { cursor: pointer; }

code.text-primary {
    background: #eff6ff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8125rem;
}

/* ── Input group focus ring ─────────────────────────────── */
.input-group:focus-within .input-group-text {
    border-color: var(--vhp-orange);
}

.input-group:focus-within .form-control {
    border-color: var(--vhp-orange);
    box-shadow: none;
}

/* ── Progress bar ───────────────────────────────────────── */
.progress {
    border-radius: 8px;
    background: #e9ecef;
}

.progress-bar {
    transition: width 0.5s ease;
}

/* ── SweetAlert2 overrides ──────────────────────────────── */
.swal2-popup {
    border-radius: 16px !important;
    font-family: 'Segoe UI', system-ui, sans-serif !important;
}

.swal2-confirm {
    border-radius: 8px !important;
}

/* ── Impersonation banner ───────────────────────────────── */
.alert.rounded-0 {
    border-radius: 0 !important;
}

/* ── Section fade animation ─────────────────────────────── */
.fade-in {
    animation: fadeIn 0.35s ease;
}

/* ── Registration form specific ─────────────────────────── */
.reg-step-panel {
    display: none;
}

.reg-step-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.category-card {
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all var(--transition-speed);
    text-align: center;
}

.category-card:hover {
    border-color: var(--vhp-orange);
    background: rgba(255, 107, 0, 0.04);
}

.category-card.selected {
    border-color: var(--vhp-orange);
    background: rgba(255, 107, 0, 0.08);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.15);
}

.category-card .cat-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

/* Field validation states */
.form-control.is-valid,
.form-select.is-valid {
    border-color: #198754;
    background-image: none;
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #dc3545;
    background-image: none;
}

/* ── Review summary table ───────────────────────────────── */
.review-table td:first-child {
    color: #6c757d;
    font-size: 0.8rem;
    width: 42%;
    font-weight: 500;
}

.review-table td:last-child {
    font-weight: 600;
    font-size: 0.875rem;
}
