/* Modern Premium Stylesheet for Church Management System */

:root {
    --brand-primary: #4f46e5;
    --brand-secondary: #7c3aed;
    --primary-gradient: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    --secondary-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --accent-gradient: linear-gradient(135deg, #f43f5e 0%, #ec4899 100%);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(226, 232, 240, 0.8);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 10px 30px rgba(79, 70, 229, 0.08);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.06);
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
    min-height: 100vh;
}

/* Navbar Styling */
.navbar {
    background: var(--primary-gradient) !important;
    padding: 0.85rem 0;
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.15);
}

.brand-icon-wrapper {
    background: rgba(255, 255, 255, 0.2);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    backdrop-filter: blur(5px);
}

.brand-text {
    font-weight: 800;
    font-size: 1.2rem;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.brand-text small {
    font-size: 0.65rem;
    font-weight: 500;
    opacity: 0.8;
}

.avatar-placeholder {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
}

.btn-login-nav {
    border-radius: 12px;
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.btn-login-nav:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

/* Modern Cards */
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--glass-border);
    padding: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}

/* Stat Cards */
.stat-card {
    position: relative;
    border-left: none;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
}

.stat-card.primary::before { background: var(--brand-primary); }
.stat-card.success::before { background: #10b981; }
.stat-card.info::before { background: #06b6d4; }
.stat-card.warning::before { background: #f59e0b; }
.stat-card.danger::before { background: #ef4444; }

.stat-icon-wrapper {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
}

/* Buttons */
.btn-gradient {
    background: var(--primary-gradient);
    border: none;
    color: white;
    font-weight: 700;
    border-radius: 14px;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.25);
    transition: all 0.2s;
}

.btn-gradient:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
    color: white;
}

/* Dynamic brand color utilities (overridden by header inline :root) */
.text-primary { color: var(--brand-primary) !important; }
.bg-primary { background-color: var(--brand-primary) !important; }
.border-primary { border-color: var(--brand-primary) !important; }

/* Page Header */
.page-header {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 24px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
}

.page-header h1 {
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #0f172a;
}

/* Form Controls */
.form-control, .form-select {
    border-radius: 14px;
    padding: 0.75rem 1rem;
    border: 1px solid #cbd5e1;
    background-color: #f8fafc;
    transition: all 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-secondary);
    background-color: white;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15);
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: #64748b;
    border-bottom: 2px solid #f1f5f9;
    padding: 1rem 1.5rem;
}

.table td {
    padding: 1.2rem 1.5rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

/* Badges */
.badge {
    font-weight: 600;
    padding: 0.45em 0.85em;
    border-radius: 8px;
}

/* Application sidebar shell */
.has-app-sidebar {
    overflow-x: hidden;
}

.app-shell {
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    width: 286px;
    display: flex;
    flex-direction: column;
    color: #f8fafc;
    background: #172554;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 18px 0 50px rgba(15, 23, 42, 0.12);
}

.sidebar-brand-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 88px;
    padding: 1.25rem 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.sidebar-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: #fff;
    text-decoration: none;
}

.sidebar-brand:hover {
    color: #fff;
}

.sidebar-brand-mark {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 15px;
    color: #172554;
    background: #f8fafc;
    font-size: 1.1rem;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

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

.sidebar-brand-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-brand-copy strong {
    overflow: hidden;
    font-size: 0.93rem;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-brand-copy small {
    margin-top: 0.16rem;
    color: #a5b4fc;
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-close,
.sidebar-toggle,
.topbar-icon-button {
    border: 0;
    display: inline-grid;
    place-items: center;
}

.sidebar-close {
    width: 36px;
    height: 36px;
    margin-left: auto;
    border-radius: 12px;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.9rem 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.sidebar-section + .sidebar-section {
    margin-top: 1.15rem;
}

.sidebar-section-label {
    padding: 0 0.8rem 0.45rem;
    color: #94a3b8;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 44px;
    padding: 0.58rem 0.72rem;
    border-radius: 13px;
    color: #cbd5e1;
    font-size: 0.87rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(2px);
}

.sidebar-link.active {
    color: #172554;
    background: #fff;
    box-shadow: 0 8px 24px rgba(2, 6, 23, 0.2);
}

.sidebar-link-icon {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: #a5b4fc;
    background: rgba(255, 255, 255, 0.07);
}

.sidebar-link.active .sidebar-link-icon {
    color: var(--brand-primary);
    background: color-mix(in srgb, var(--brand-primary) 12%, white);
}

.sidebar-account {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin: 0.8rem;
    padding: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: #172554;
    background: #c7d2fe;
    font-size: 0.8rem;
    font-weight: 800;
}

.sidebar-account-copy {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sidebar-account-copy strong {
    overflow: hidden;
    color: #fff;
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-account-copy span {
    color: #94a3b8;
    font-size: 0.7rem;
}

.sidebar-logout {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #cbd5e1;
    text-decoration: none;
}

.sidebar-logout:hover {
    color: #fff;
    background: rgba(244, 63, 94, 0.2);
}

.app-main {
    min-height: 100vh;
    margin-left: 286px;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    min-height: 76px;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.75rem;
    border-bottom: 1px solid #e2e8f0;
    background: rgba(248, 250, 252, 0.94);
    backdrop-filter: blur(14px);
}

.sidebar-toggle {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 14px;
    color: #172554;
    background: #e0e7ff;
}

.app-topbar-title {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar-title strong {
    overflow: hidden;
    color: #0f172a;
    font-size: 1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-topbar-eyebrow {
    color: #64748b;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.app-topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.topbar-icon-button {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    color: #475569;
    background: #fff;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    text-decoration: none;
}

.topbar-icon-button:hover {
    color: var(--brand-primary);
    background: #eef2ff;
}

.topbar-user {
    min-width: 120px;
    margin-left: 0.3rem;
    padding-left: 0.9rem;
    border-left: 1px solid #e2e8f0;
    flex-direction: column;
}

.topbar-user span {
    color: #0f172a;
    font-size: 0.78rem;
    font-weight: 700;
}

.topbar-user small {
    color: #64748b;
    font-size: 0.68rem;
}

.app-content {
    width: 100%;
    flex: 1;
    padding-right: 1.75rem;
    padding-left: 1.75rem;
}

.app-footer,
.public-footer {
    color: #64748b;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}

.app-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.75rem;
    font-size: 0.75rem;
}

.public-navbar {
    background: var(--brand-primary) !important;
}

.public-register-link {
    margin-left: 0.5rem;
    padding-right: 1rem !important;
    padding-left: 1rem !important;
    border-radius: 12px;
    color: var(--brand-primary) !important;
    background: #fff;
    font-weight: 700;
}

.sidebar-overlay {
    display: none;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        width: min(88vw, 310px);
        transform: translateX(-105%);
        transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
    }

    .app-main {
        margin-left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 1035;
        display: block;
        visibility: hidden;
        opacity: 0;
        background: rgba(15, 23, 42, 0.55);
        backdrop-filter: blur(3px);
        transition: opacity 220ms ease, visibility 220ms ease;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-overlay {
        visibility: visible;
        opacity: 1;
    }
}

@media (max-width: 575.98px) {
    .app-topbar {
        min-height: 68px;
        padding: 0.65rem 1rem;
    }

    .app-content {
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .app-footer {
        align-items: center;
        flex-direction: column;
        padding: 1rem;
        text-align: center;
    }

    .page-header {
        padding: 1.25rem;
        border-radius: 18px;
    }

    .page-header h1 {
        font-size: 1.55rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-sidebar,
    .sidebar-overlay,
    .sidebar-link {
        transition: none;
    }
}


/* Settings page layout safeguards */
.settings-page .app-content {
    min-width: 0;
    overflow-x: clip;
}
.settings-page .card:hover {
    transform: none;
}
.settings-page .table-responsive {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.settings-page .form-control,
.settings-page .form-select,
.settings-page textarea {
    max-width: 100%;
}
.settings-page .btn {
    white-space: normal;
}
@media (max-width: 767.98px) {
    .settings-page .card-body,
    .settings-page .card-header {
        padding: 1rem !important;
    }
    .settings-page .table th,
    .settings-page .table td {
        padding: .75rem;
        white-space: nowrap;
    }
}
