﻿/* ============================================
   THEME VARIABLES
   ============================================ */
:root {
    --bg: #ffffff;
    --text: #222222;

    --nav-bg: #2c2c2c;
    --header-bg: #ffffff;
    --header-text: #ffffff;

    --card-bg: #ffffff;
    --accent: #333333;
    --muted: #666666;

    --footer-bg: #1a1a1a;
    --footer-text: #ffffff;

    --btn-bg: #333333;
    --btn-text: #ffffff;

    --link-color: #ffffff;
}

/* ============================================
   GLOBAL RESET + TYPOGRAPHY
   ============================================ */
html, body {
    background-color: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    transition: background-color 250ms ease, color 250ms ease;
}

body.dark img {
    filter: brightness(90%);
}

h1, h2, h3, h4, h5 {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

p {
    margin-bottom: 1rem;
}

.container, .container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
}

label {
    font-weight: 600;
}

/* ============================================
   HEADER BACKGROUND
   ============================================ */
.header-bg {
    width: 100%;
    background-color: var(--nav-bg);
    background-image: linear-gradient(to bottom, #2c2c2c, #1a1a1a);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

/* ============================================
   NAVBAR + LOGO
   ============================================ */
.navbar.small-menu {
    padding-top: 0.2rem !important;
    padding-bottom: 0 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}

.header-logo {
    width: 200px !important;
    max-width: 200px !important;
    height: auto;
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: invert(1) brightness(1.1);
}

.header-logo:hover,
.header-logo:focus {
    transform: scale(1.10);
    outline: 2px solid #fff;
    outline-offset: 2px;
}

[data-theme="dark"] .header-logo {
    filter: none;
}

.navbar.small-menu .nav-link {
    font-size: 0.85rem !important;
    letter-spacing: 0.3px;
}

.navbar.small-menu .navbar-nav {
    margin-top: 0 !important;
}

.navbar.small-menu .nav-link {
    position: relative;
}

.navbar.small-menu .nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0.15rem;
    width: 0%;
    height: 2px;
    background: #fff;
    transition: width 0.25s ease;
}

.navbar.small-menu .nav-link:hover::after,
.navbar.small-menu .nav-link:focus::after {
    width: 100%;
}

.nav-link {
    transition: all 0.3s ease;
    margin: 0 5px;
    font-weight: 500;
    color: #fff !important;
}

.nav-link:hover,
.nav-link:focus {
    transform: scale(1.08);
    outline: none;
}

.navbar.small-menu .nav-link.active {
    border-bottom: 3px solid #fff;
    font-weight: 700;
    background-color: rgba(0,0,0,0.12);
    border-radius: 4px 4px 0 0;
}

/* Staff Portal - subtle far-right nav link */
.nav-staff-portal {
    opacity: 0.65;
    font-size: 0.8rem;
    border-left: 1px solid rgba(255,255,255,0.2);
    padding-left: 0.9rem !important;
    margin-left: 0.25rem !important;
}
.nav-staff-portal:hover,
.nav-staff-portal:focus {
    opacity: 1;
}

/* ============================================
   FOOTER
   ============================================ */
footer,
.footer-content {
    background-color: var(--footer-bg);
    background-image: linear-gradient(to bottom, #2c2c2c, #1a1a1a);
    color: var(--footer-text);
    padding-top: 2rem;
    padding-bottom: 0.5rem;
}

.footer-heading {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 3px solid #666;
    padding-bottom: 10px;
}

.footer-address,
.footer-contact,
.footer-text {
    color: #fff;
    line-height: 1.8;
    font-size: 0.95rem;
}

.footer-contact a,
.footer-links a,
.footer-social a {
    color: #fff !important;
    transition: all 0.3s ease;
}

.footer-links a:hover,
.footer-contact a:hover,
.footer-social a:hover {
    transform: scale(1.08);
    text-decoration: underline;
    text-decoration-thickness: 2px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    background-color: #333;
    border: 2px solid #fff;
    color: #fff;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #555;
    border: 3px solid #fff;
    transform: scale(1.10);
    outline: 2px solid #999;
    outline-offset: 2px;
}

/* ============================================================
   CALENDAR STYLES — STRONGLY SCOPED
   ============================================================ */

/* Calendar header (days of week) */
.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}
.calendar-header > div {
    padding: 10px 6px;
    background: var(--card-bg);
    border: 1px solid #ddd;
    text-align: center;
    color: var(--text);
}

/* Calendar grid container */
#calendar.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    align-items: start;
    grid-auto-rows: minmax(110px, auto);
}

/* Calendar cells */
#calendar .calendar-day {
    box-sizing: border-box;
    padding: 6px;
    background: var(--card-bg);
    border: 1px solid #ddd;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: background 0.15s ease;
    color: var(--text);
}

/* Muted style for other-month blanks */
#calendar .calendar-day.other-month {
    background: var(--muted);
    color: #999;
}

/* Hover */
#calendar .calendar-day:hover {
    background: #eef7ff;
}

/* Day highlighted via ticker deep-link */
#calendar .calendar-day.ticker-highlight {
    outline: 3px solid #ffd700;
    outline-offset: -3px;
    background: #fffbe6;
}

/* Day number */
#calendar .day-number {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 6px;
    color: var(--text);
}

/* ============================================================
   EVENT PILL STYLING
   ============================================================ */

#calendar .event {
    /* Default pill styling: ensure readable text even if specific color class is missing */
    background: #2c3e50;
    color: #fff;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.78rem;
    margin-top: 4px;
    display: block;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

/* Rotating event colors (church + user events share these) */
.event-color-1 { background: #6fbf73; }   /* soft green */
.event-color-2 { background: #5da3f7; }   /* soft blue */
.event-color-3 { background: #f39c12; }   /* amber (used for federal holidays) */
.event-color-4 { background: #8e44ad; }   /* purple */
.event-color-5 { background: #d9534f; }   /* red (used for christian holidays) */
.event-color-6 { background: #2c3e50; }   /* dark */

/* Holiday specific class so theme can style consistently */
.event-holiday { background: #d9534f; color: #fff; }

/* Small responsive adjustments */
@media (max-width: 576px) {
    #calendar.calendar-grid { grid-auto-rows: minmax(90px, auto); }
    #calendar .day-number { font-size: 0.85rem; }
    #calendar .event { font-size: 0.7rem; padding: 2px 5px; }
}

/* ============================================
   DARK MODE
   ============================================ */
[data-theme="dark"] {
    --bg: #1a1a1a;
    --text: #e0e0e0;
    --nav-bg: #0d63e0;
    --header-bg: #0d63e0;
    --footer-bg: #0d63e0;
    --card-bg: #2c2c2c;
    --muted: #aaaaaa;
}

/* Dark mode navbar adjustments */
[data-theme="dark"] .header-bg {
    background-color: var(--nav-bg);
    background-image: linear-gradient(to bottom, #0d63e0, #0b5ed7);
}

/* Dark mode footer adjustments */
[data-theme="dark"] footer,
[data-theme="dark"] .footer-content {
    background-color: var(--footer-bg);
    background-image: linear-gradient(to bottom, #0d63e0, #0b5ed7);
    color: var(--footer-text);
}

/* Dark mode footer heading */
[data-theme="dark"] .footer-heading {
    border-bottom-color: #555;
    color: var(--text);
}

[data-theme="dark"] .bg-white,
[data-theme="dark"] .bg-light {
    background-color: var(--card-bg) !important;
    color: var(--text) !important;
}

[data-theme="dark"] .border {
    border-color: #444 !important;
}

[data-theme="dark"] .modal-content {
    background-color: var(--card-bg);
    color: var(--text);
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: #444;
}

[data-theme="dark"] .dropdown-menu {
    background-color: var(--card-bg);
    border-color: #444;
}

[data-theme="dark"] .dropdown-item {
    color: var(--text);
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: #3c3c3c;
}

/* Dark mode calendar adjustments */
[data-theme="dark"] .calendar-header > div {
    background: var(--card-bg);
    border-color: #444;
    color: var(--text);
}

[data-theme="dark"] #calendar .calendar-day {
    background: var(--card-bg);
    border-color: #444;
    color: var(--text);
}

[data-theme="dark"] #calendar .calendar-day.other-month {
    background: #1a1a1a;
    color: #666;
}

[data-theme="dark"] #calendar .calendar-day:hover {
    background: #3c3c3c;
}

[data-theme="dark"] #calendar .calendar-day.ticker-highlight {
    outline: 3px solid #ffd700;
    outline-offset: -3px;
    background: #3a3000;
}

[data-theme="dark"] #calendar .day-number {
    color: var(--text);
}

/* Theme toggle button - integrated in navbar */
.theme-toggle {
    background: transparent !important;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0.5rem 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    margin-left: 10px;
    color: #fff !important;
    min-width: 50px;
}

/* ============================================
   Navbar Social Icons
   ============================================ */
.navbar-social {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.5rem;
}

.navbar-social a {
    color: #fff !important;
    font-size: 1.1rem;
    line-height: 1;
    transition: transform 0.25s ease;
    text-decoration: none;
}

.navbar-social a:hover,
.navbar-social a:focus {
    transform: scale(1.2);
    outline: none;
}

/* ============================================
   Give Button - Navbar
   ============================================ */
.btn-give {
    background-color: #996633;
    border: 2px solid #fff;
    color: #fff !important;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.3rem 0.85rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    text-decoration: none;
    margin-left: 0.5rem;
    white-space: nowrap;
}

.btn-give:hover,
.btn-give:focus {
    background-color: #7a4d26;
    border-color: #fff;
    transform: scale(1.08);
    /* Enhanced focus indicator for 508c compliance */
    outline: 3px solid rgba(255,255,255,0.8);
    outline-offset: 2px;
}

/* Dark mode adjustments for give button - maintain brand consistency and 508c compliance */
[data-theme="dark"] .btn-give {
    background-color: #996633;
    color: #fff !important;
    border: 2px solid #fff;
}

[data-theme="dark"] .btn-give:hover,
[data-theme="dark"] .btn-give:focus {
    background-color: #b8773d;
    color: #fff !important;
    border-color: #fff;
    /* Enhanced focus indicator for 508c compliance */
    outline: 3px solid #fff;
    outline-offset: 2px;
}
