/* ============================================
   St. Paul's Anglican Church CRM
   Custom Styles - Brand Palette
   ============================================ */

:root {
    --sp-navy: #1B2A4A;
    --sp-gold: #C5A55A;
    --sp-burgundy: #8B1A1A;
    --sp-bg: #F5F0E8;
    --sp-text: #333333;
    --sp-light-gold: #EDE4C9;
    --sp-dark-navy: #111D33;
    --sp-white: #FFFFFF;
    --sp-gray-100: #F8F9FA;
    --sp-gray-200: #E9ECEF;
    --sp-gray-300: #DEE2E6;
    --sp-gray-500: #ADB5BD;
    --sp-gray-700: #495057;
    --sp-success: #28a745;
    --sp-warning: #ffc107;
    --sp-danger: #dc3545;
    --sp-info: #17a2b8;
}

/* ---- Global ---- */
body {
    background-color: var(--sp-bg);
    color: var(--sp-text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6,
.heading-font {
    font-family: Georgia, 'Times New Roman', serif;
    color: var(--sp-navy);
}

a {
    color: var(--sp-navy);
}
a:hover {
    color: var(--sp-gold);
}

/* ---- Login Page ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--sp-bg) 0%, #EDE4C9 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    border: none;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(27, 42, 74, 0.15);
    background: var(--sp-white);
    overflow: hidden;
}

.login-card .card-header {
    background: var(--sp-navy);
    text-align: center;
    padding: 2rem 1.5rem 1.5rem;
    border-bottom: 3px solid var(--sp-gold);
}

.login-card .card-header img {
    max-width: 200px;
    height: auto;
}

.login-card .card-body {
    padding: 2rem 1.5rem;
}

.login-card .card-footer {
    background: transparent;
    border-top: 1px solid var(--sp-gray-200);
    text-align: center;
    padding: 1rem;
}

.login-tagline {
    color: var(--sp-gold);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 0.75rem;
    margin-bottom: 0;
}

/* ---- Sidebar ---- */
.sidebar {
    width: 260px;
    min-height: 100vh;
    background: var(--sp-navy);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar .sidebar-brand {
    padding: 1.25rem 1rem;
    border-bottom: 2px solid var(--sp-gold);
    text-align: center;
}

.sidebar .sidebar-brand img {
    max-width: 150px;
    height: auto;
}

.sidebar .nav-section {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar .nav-section-title {
    color: var(--sp-gold);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.5rem 1.25rem;
    margin: 0;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.75);
    padding: 0.6rem 1.25rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar .nav-link:hover {
    color: var(--sp-white);
    background: rgba(255, 255, 255, 0.05);
    border-left-color: var(--sp-gold);
}

.sidebar .nav-link.active {
    color: var(--sp-white);
    background: rgba(197, 165, 90, 0.15);
    border-left-color: var(--sp-gold);
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

/* ---- Top Navbar ---- */
.top-navbar {
    background: var(--sp-white);
    border-bottom: 1px solid var(--sp-gray-200);
    padding: 0.75rem 1.5rem;
    margin-left: 260px;
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.top-navbar .navbar-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.1rem;
    color: var(--sp-navy);
    font-weight: 600;
    margin: 0;
}

.top-navbar .navbar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-navbar .navbar-user .user-name {
    font-weight: 600;
    color: var(--sp-navy);
}

.top-navbar .navbar-user .user-role {
    font-size: 0.8rem;
    color: var(--sp-gray-500);
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--sp-navy);
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}

/* ---- Main Content ---- */
.main-content {
    margin-left: 260px;
    margin-top: 60px;
    padding: 1.5rem;
    min-height: calc(100vh - 60px);
}

/* ---- Stat Cards ---- */
.stat-card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

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

.stat-card .card-body {
    padding: 1.25rem;
}

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

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: Georgia, 'Times New Roman', serif;
    color: var(--sp-navy);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--sp-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Stat card accents */
.stat-card.accent-navy { border-top: 3px solid var(--sp-navy); }
.stat-card.accent-gold { border-top: 3px solid var(--sp-gold); }
.stat-card.accent-success { border-top: 3px solid var(--sp-success); }
.stat-card.accent-info { border-top: 3px solid var(--sp-info); }

/* ---- Buttons ---- */
.btn-navy {
    background-color: var(--sp-navy);
    border-color: var(--sp-navy);
    color: var(--sp-white);
}
.btn-navy:hover, .btn-navy:focus {
    background-color: var(--sp-dark-navy);
    border-color: var(--sp-dark-navy);
    color: var(--sp-white);
}

.btn-gold {
    background-color: var(--sp-gold);
    border-color: var(--sp-gold);
    color: var(--sp-white);
}
.btn-gold:hover, .btn-gold:focus {
    background-color: #B8953D;
    border-color: #B8953D;
    color: var(--sp-white);
}

.btn-burgundy {
    background-color: var(--sp-burgundy);
    border-color: var(--sp-burgundy);
    color: var(--sp-white);
}
.btn-burgundy:hover, .btn-burgundy:focus {
    background-color: #6E1414;
    border-color: #6E1414;
    color: var(--sp-white);
}

.btn-outline-navy {
    border-color: var(--sp-navy);
    color: var(--sp-navy);
}
.btn-outline-navy:hover {
    background-color: var(--sp-navy);
    color: var(--sp-white);
}

/* ---- Cards ---- */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.card .card-header {
    background: var(--sp-white);
    border-bottom: 2px solid var(--sp-gold);
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 600;
    color: var(--sp-navy);
    padding: 1rem 1.25rem;
}

/* ---- Campaign Thermometer ---- */
.thermometer-container {
    background: var(--sp-gray-200);
    border-radius: 25px;
    height: 40px;
    overflow: hidden;
    position: relative;
}

.thermometer-fill {
    height: 100%;
    border-radius: 25px;
    background: linear-gradient(90deg, var(--sp-gold), var(--sp-navy));
    transition: width 1s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 12px;
    color: var(--sp-white);
    font-weight: 700;
    font-size: 0.85rem;
    min-width: 60px;
}

/* ---- Activity Feed ---- */
.activity-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--sp-gray-200);
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.activity-icon.encounter { background: #E3F2FD; color: #1976D2; }
.activity-icon.donation { background: #E8F5E9; color: #388E3C; }
.activity-icon.pledge { background: #FFF3E0; color: #F57C00; }
.activity-icon.newsletter { background: #F3E5F5; color: #7B1FA2; }

/* ---- Tags ---- */
.contact-tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
}

/* ---- Status Badges ---- */
.badge-pledged { background: var(--sp-info); color: var(--sp-white); }
.badge-partial { background: var(--sp-warning); color: var(--sp-text); }
.badge-fulfilled { background: var(--sp-success); color: var(--sp-white); }
.badge-pastdue { background: var(--sp-danger); color: var(--sp-white); }
.badge-cancelled { background: var(--sp-gray-500); color: var(--sp-white); }

/* ---- DataTables Overrides ---- */
table.dataTable {
    font-size: 0.875rem;
}
table.dataTable thead th {
    background: var(--sp-navy);
    color: var(--sp-white);
    font-weight: 600;
    border-bottom: 2px solid var(--sp-gold) !important;
}
table.dataTable tbody tr:hover {
    background-color: rgba(197, 165, 90, 0.08) !important;
}
div.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--sp-navy) !important;
    color: var(--sp-white) !important;
    border-color: var(--sp-navy) !important;
}

/* ---- Encounter Timeline ---- */
.encounter-timeline {
    position: relative;
    padding-left: 30px;
}

.encounter-timeline::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--sp-gray-300);
}

.encounter-item {
    position: relative;
    padding-bottom: 1.25rem;
}

.encounter-item .encounter-dot {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--sp-gold);
    background: var(--sp-white);
}

/* Sentiment colors */
.sentiment-positive { color: var(--sp-success); }
.sentiment-neutral { color: var(--sp-gray-500); }
.sentiment-negative { color: var(--sp-danger); }

/* ---- Responsive ---- */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .top-navbar {
        margin-left: 0;
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: block;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1035;
    }
    .sidebar-overlay.show {
        display: block;
    }
}

/* ---- Mobile Touch Targets ---- */
@media (max-width: 575.98px) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    .form-control, .form-select {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* ---- Newsletter Editor ---- */
.newsletter-preview {
    border: 1px solid var(--sp-gray-300);
    border-radius: 8px;
    padding: 1.5rem;
    background: var(--sp-white);
    min-height: 400px;
}

/* ---- Print Styles ---- */
@media print {
    .sidebar, .top-navbar, .sidebar-toggle, .btn {
        display: none !important;
    }
    .main-content {
        margin: 0;
        padding: 0;
    }
}
