/* CSS Variables */
:root {
    --primary-color: #1e3a5f;
    --secondary-color: #3d6b99;
    --accent-color: #f4c430;
    --gold-color: #d4af37;
    --text-light: #ffffff;
    --text-dark: #2c3e50;
    --background-light: #f8f9fa;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    color: var(--text-dark);
    position: relative;
}

/* Background Overlay for custom images */
.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    opacity: 0.3;
    z-index: -1;
    pointer-events: none;
}

/* Map Section */
.map-section {
    position: relative;
    width: 100%;
    height: 300px;
    background: var(--primary-color);
    z-index: 1;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.location-badge {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
}

.location-icon {
    font-size: 1.5rem;
}

#locationName {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* Container */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    z-index: 10;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
}

.header-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.header-profile-photo {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.header-flag {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

.header-login {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.btn-login {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-login:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

.btn-login.logged-in {
    background: rgba(34, 197, 94, 0.3);
    border-color: rgba(34, 197, 94, 0.6);
}

.btn-login.logged-in:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.6);
}

.church-logo {
    max-width: 280px;
    height: auto;
    margin-bottom: 16px;
    filter: brightness(0) invert(1);
}

.title {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    color: var(--text-light);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--accent-color);
    font-style: italic;
}

/* Section Titles */
.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 25px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

/* Countdown Section */
.countdown-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.countdown-section .section-title {
    color: var(--primary-color);
}

.countdown-subtitle {
    text-align: center;
    color: #666;
    font-size: 1.1rem;
    margin: -10px 0 20px 0;
    display: none;
}

.countdown-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
}

@media (max-width: 768px) {
    .countdown-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.countdown-item {
    text-align: center;
    padding: 20px 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.countdown-item.seconds {
    background: linear-gradient(135deg, var(--gold-color), var(--accent-color));
}

.countdown-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-light);
    line-height: 1;
}

.countdown-label {
    display: block;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Progress Section */
.progress-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.progress-section .section-title {
    color: var(--primary-color);
}

.progress-container {
    margin-bottom: 30px;
}

.progress-bar {
    position: relative;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: visible;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), var(--gold-color));
    border-radius: 15px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%) scaleX(-1);
    font-size: 2rem;
    transition: left 0.5s ease;
    left: 0%;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-weight: 600;
    color: var(--text-dark);
}

.percentage-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
}

.percentage-item {
    text-align: center;
}

.percentage-value {
    font-size: 2.5rem;
    font-weight: 700;
}

.percentage-symbol {
    font-size: 1.5rem;
    font-weight: 600;
}

.percentage-item.complete .percentage-value,
.percentage-item.complete .percentage-symbol {
    color: var(--success-color);
}

.percentage-item.remaining .percentage-value,
.percentage-item.remaining .percentage-symbol {
    color: var(--secondary-color);
}

.percentage-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
}

.percentage-days {
    display: block;
    font-size: 0.85rem;
    color: #888;
    margin-top: 3px;
    font-weight: 500;
}

.percentage-divider {
    font-size: 2rem;
    color: #ccc;
}

/* Time Served Display */
.time-served-display {
    text-align: center;
    margin-top: 25px;
    padding: 15px 25px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 12px;
    color: white;
}

.time-served-label {
    font-size: 1rem;
    margin-right: 10px;
}

.time-served-value {
    font-size: 1.3rem;
    font-weight: 700;
    font-family: 'Playfair Display', serif;
}

.time-served-total {
    font-size: 1rem;
    margin-left: 10px;
    opacity: 0.9;
}

/* Timeline Section */
.timeline-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.timeline-section .section-title {
    color: var(--primary-color);
}

.timeline {
    position: relative;
    padding: 20px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary-color), var(--gold-color));
    border-radius: 2px;
}

@media (max-width: 768px) {
    .timeline::before {
        left: 20px;
    }
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
    width: 50%;
    padding-right: 40px;
}

.timeline-item:nth-child(even) {
    margin-left: 50%;
    padding-right: 0;
    padding-left: 40px;
}

@media (max-width: 768px) {
    .timeline-item,
    .timeline-item:nth-child(even) {
        width: 100%;
        margin-left: 0;
        padding-left: 50px;
        padding-right: 0;
    }
}

.timeline-marker {
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border: 4px solid var(--text-light);
    border-radius: 50%;
    top: 10px;
    right: -10px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.timeline-item:nth-child(even) .timeline-marker {
    left: -10px;
    right: auto;
}

@media (max-width: 768px) {
    .timeline-marker,
    .timeline-item:nth-child(even) .timeline-marker {
        left: 10px;
        right: auto;
    }
}

.timeline-item.completed .timeline-marker {
    background: var(--success-color);
    transform: scale(1.2);
}

.timeline-item.current .timeline-marker {
    background: var(--gold-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(244, 196, 48, 0.7); }
    50% { box-shadow: 0 0 0 10px rgba(244, 196, 48, 0); }
}

.timeline-content {
    background: var(--background-light);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.timeline-item.completed .timeline-content {
    border-left: 4px solid var(--success-color);
}

.timeline-item.current .timeline-content {
    border-left: 4px solid var(--gold-color);
    background: #fffef0;
}

.timeline-content h3 {
    color: var(--primary-color);
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.timeline-content p {
    color: #666;
    font-size: 0.9rem;
}

.timeline-content.has-photo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.timeline-photo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
    flex-shrink: 0;
}

.timeline-text {
    flex: 1;
}

.timeline-companion-photo {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--secondary-color);
    flex-shrink: 0;
    margin-left: auto;
}

/* Missionary Links */
.missionary-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.missionary-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.missionary-link:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

/* Settings Section */
.settings-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 100;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.settings-header:hover {
    opacity: 0.8;
}

.collapse-icon {
    font-size: 1.2rem;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

.settings-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.settings-content {
    overflow: visible;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: none;
    opacity: 1;
}

.settings-section.collapsed .settings-content {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    overflow: hidden;
}

.settings-section:not(.collapsed) .settings-content {
    margin-top: 20px;
}

.settings-section .section-title {
    color: var(--primary-color);
    margin-bottom: 0;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-item label {
    font-weight: 600;
    color: var(--text-dark);
}

.setting-item input {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.setting-item input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.setting-item small {
    color: #888;
    font-size: 0.8rem;
}

/* Buttons */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--text-light);
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--text-light);
    padding: 8px 15px;
    font-size: 0.9rem;
    margin-top: 5px;
}

.btn-secondary:hover {
    background: var(--primary-color);
}

.btn-danger {
    background: var(--danger-color);
    color: var(--text-light);
    padding: 8px 15px;
    font-size: 0.9rem;
    margin-top: 5px;
}

/* Transfers Management Section */
.transfers-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}

.subsection-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.transfers-help {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.transfers-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.transfers-list {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    background: #fafafa;
}

#saveTransfers {
    display: block !important;
    margin-top: 20px;
    position: sticky;
    bottom: 0;
}

.transfer-item {
    background: var(--background-light);
    border-radius: 10px;
    padding: 15px;
    border-left: 4px solid var(--secondary-color);
}

.transfer-item.completed {
    border-left-color: var(--success-color);
    opacity: 0.8;
}

.transfer-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.transfer-item-header h4 {
    color: var(--primary-color);
    font-size: 1rem;
    margin: 0;
}

.btn-delete-transfer {
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-delete-transfer:hover {
    background: #c82333;
    transform: scale(1.1);
}

.transfer-date {
    color: #888;
    font-size: 0.85rem;
}

.transfer-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

@media (max-width: 768px) {
    .transfer-fields {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 500px) {
    .transfer-fields {
        grid-template-columns: 1fr;
    }
}

.transfer-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.transfer-field label {
    font-size: 0.8rem;
    color: #666;
    font-weight: 600;
}

.transfer-field input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.transfer-field input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.companion-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.companion-input-row input {
    flex: 1;
}

.companion-photo-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f0f0f0;
    border: 2px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    flex-shrink: 0;
}

.companion-photo-btn:hover {
    border-color: var(--secondary-color);
    background: #e8f4f8;
}

.companion-photo-btn .photo-icon {
    font-size: 16px;
}

.companion-photo-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.btn-danger:hover {
    background: #c82333;
}

/* Quote Section */
.quote-section {
    text-align: center;
    padding: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    margin-bottom: 30px;
}

.quote-section blockquote {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-style: italic;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 15px;
}

.quote-section cite {
    color: var(--accent-color);
    font-size: 1rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.7);
}

.footer .contact-admin {
    margin-top: 10px;
}

.footer .contact-admin a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: color 0.2s;
}

.footer .contact-admin a:hover {
    color: white;
    text-decoration: underline;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.countdown-section,
.progress-section,
.timeline-section,
.settings-section,
.quote-section {
    animation: fadeIn 0.6s ease forwards;
}

/* Leaflet Map Customization */
.leaflet-container {
    font-family: 'Open Sans', sans-serif;
}

/* Ensure Leaflet panes don't overlap content */
.leaflet-pane,
.leaflet-control {
    z-index: 1 !important;
}

.leaflet-top,
.leaflet-bottom {
    z-index: 2 !important;
}

/* Ensure all inputs are clickable */
input, button, select, textarea {
    position: relative;
    z-index: 100;
}

/* Page Navigation */
.page-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.nav-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: var(--primary-color);
    color: white;
}

.settings-link {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    color: white;
}

.settings-link:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ==================== HOME PAGE STYLES ==================== */

.home-container {
    padding-top: 20px;
}

.add-missionary-section {
    text-align: center;
    margin-bottom: 40px;
}

.data-actions {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-large {
    padding: 18px 40px;
    font-size: 1.2rem;
}

/* Missionaries Grid */
.missionaries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.no-missionaries {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    color: #666;
}

.no-missionaries p {
    margin: 10px 0;
    font-size: 1.1rem;
}

/* Missionary Card */
.missionary-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.missionary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.card-photo {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.card-flag-container {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    padding: 3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.card-flag {
    display: block;
    height: 24px;
    width: auto;
    border-radius: 2px;
}

.missionary-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.missionary-photo-placeholder {
    font-size: 4rem;
    opacity: 0.5;
}

.card-content {
    padding: 20px;
}

.card-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    color: var(--primary-color);
    margin: 0 0 10px 0;
}

.card-location {
    color: #666;
    margin: 5px 0;
}

.card-dates {
    color: #888;
    font-size: 0.9rem;
    margin: 5px 0;
}

.card-status {
    color: var(--secondary-color);
    font-weight: 600;
    margin: 10px 0 5px 0;
}

.card-days-served {
    color: #6b7280;
    font-size: 0.85rem;
    margin: 8px 0 0 0;
}

.card-content .progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.card-content .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color), var(--accent-color));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.card-content .progress-bar.pre-mission {
    background: repeating-linear-gradient(
        45deg,
        #e0e0e0,
        #e0e0e0 10px,
        #d0d0d0 10px,
        #d0d0d0 20px
    );
}

/* Reorder Mode */
.missionaries-grid.reorder-mode .missionary-card {
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
}

.missionaries-grid.reorder-mode .missionary-card:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.missionary-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.missionary-card.drag-over {
    border: 2px dashed var(--secondary-color);
    transform: scale(1.02);
}

.btn.active {
    background: var(--secondary-color);
    color: white;
}

.card-actions {
    padding: 15px 20px;
    background: #f8f9fa;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    margin: 0;
    color: var(--primary-color);
    font-family: 'Playfair Display', serif;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.modal-close:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.photo-preview {
    margin-top: 10px;
}

.photo-preview img {
    max-width: 150px;
    max-height: 150px;
    border-radius: 10px;
    object-fit: cover;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ==================== SETTINGS PAGE STYLES ==================== */

.settings-page {
    background: #f8fafc;
    min-height: 100vh;
}

.settings-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.settings-sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid #e2e8f0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.logout-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.logout-btn:hover {
    background: #fee2e2;
    border-color: #fecaca;
    color: #dc2626;
}

.user-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 8px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name {
    font-weight: 500;
    color: #1e293b;
}

.user-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: #e2e8f0;
    color: #64748b;
}

.user-badge.admin {
    background: #dbeafe;
    color: #1d4ed8;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #475569;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.add-user-form h3 {
    margin-bottom: 16px;
    font-size: 1rem;
    color: #334155;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--primary-color);
}

.back-icon {
    font-size: 1.2rem;
}

.settings-nav {
    padding: 16px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #475569;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover {
    background: #f1f5f9;
    color: var(--primary-color);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.nav-icon {
    font-size: 1.1rem;
}

/* Main Content */
.settings-main {
    flex: 1;
    margin-left: 260px;
    padding: 40px 60px;
    max-width: 900px;
}

.settings-page-header {
    margin-bottom: 40px;
}

.settings-page-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    color: #1e293b;
    margin: 0 0 8px 0;
}

.settings-subtitle {
    color: #64748b;
    font-size: 1rem;
    margin: 0;
}

/* Settings Cards */
.settings-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 24px 28px 0;
}

.card-header h2 {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 4px 0;
}

.card-description {
    color: #64748b;
    font-size: 0.875rem;
    margin: 0;
}

.card-body {
    padding: 24px 28px 28px;
}

/* Form Elements */
.form-row {
    margin-bottom: 20px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-row.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.input-modern {
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #1e293b;
    background: #f8fafc;
    transition: all 0.2s;
}

.input-modern:focus {
    outline: none;
    border-color: var(--secondary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.field-hint {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 4px;
}

.input-with-button {
    display: flex;
    gap: 8px;
}

.input-with-button .input-modern {
    flex: 1;
}

.btn-icon {
    padding: 12px 16px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--primary-color);
}

/* Map Preview */
.map-preview {
    margin-top: 16px;
    border-radius: 12px;
    overflow: hidden;
    height: 250px;
}

#settingsMap {
    height: 100%;
    width: 100%;
}

/* Transfers */
.transfers-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.transfers-list-modern {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.transfer-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s;
}

.transfer-card.completed {
    border-left: 3px solid #10b981;
}

.transfer-card.upcoming {
    border-left: 3px solid var(--secondary-color);
}

.transfer-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.transfer-number {
    width: 28px;
    height: 28px;
    background: var(--secondary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.transfer-status {
    font-size: 0.75rem;
    color: #64748b;
    flex: 1;
}

.btn-delete {
    width: 24px;
    height: 24px;
    border: none;
    background: #fee2e2;
    color: #ef4444;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: all 0.2s;
}

.btn-delete:hover {
    background: #ef4444;
    color: white;
}

.transfer-fields-grid {
    display: grid;
    grid-template-columns: 140px 1fr 1fr;
    gap: 12px;
}

.transfer-field label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    margin-bottom: 4px;
    display: block;
}

/* File Upload */
.file-upload-area {
    position: relative;
    border: 2px dashed #e2e8f0;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload-area:hover {
    border-color: var(--secondary-color);
    background: #f8fafc;
}

.file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-icon {
    font-size: 2rem;
}

.upload-text {
    color: #475569;
    font-weight: 500;
}

.upload-hint {
    font-size: 0.8rem;
    color: #94a3b8;
}

.image-preview img {
    max-width: 200px;
    max-height: 120px;
    border-radius: 8px;
    margin-top: 16px;
    object-fit: cover;
}

/* Settings Footer */
.settings-footer {
    padding: 24px 0;
    position: sticky;
    bottom: 0;
    background: #f8fafc;
    z-index: 10000;
}

/* Button Variants */
.btn-outline-danger {
    background: transparent;
    border: 1px solid #fecaca;
    color: #ef4444;
}

.btn-outline-danger:hover {
    background: #fef2f2;
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1rem;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
}

/* Notification */
.notification {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 16px 24px;
    background: #10b981;
    color: white;
    border-radius: 10px;
    font-weight: 500;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 10000;
    animation: slideInRight 0.3s ease;
}

.notification.error {
    background: #ef4444;
}

.notification.fade-out {
    animation: slideOutRight 0.3s ease forwards;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
    font-style: italic;
}

/* Responsive */
@media (max-width: 900px) {
    .settings-sidebar {
        display: none;
    }
    
    .settings-main {
        margin-left: 0;
        padding: 24px;
    }
    
    .form-row.two-col {
        grid-template-columns: 1fr;
    }
    
    .transfer-fields-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .missionaries-grid {
        grid-template-columns: 1fr;
    }
    
    .card-actions {
        flex-direction: column;
    }
    
    .card-actions .btn {
        width: 100%;
    }
}
