/* Church Testimony Hub - Futuristic Winners Chapel Theme */

/* --- Root Variables --- */
:root {
    --primary: #1e40af;
    --primary-dark: #1e3a8a;
    --secondary: #0ea5e9;
    --accent: #f59e0b;
    --accent-gold: #d97706;
    --light: #f8fafc;
    --dark: #1e293b;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --gray: #64748b;
    --gray-light: #e2e8f0;
}

/* --- Base & Body Styles --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    position: relative; /* Needed for positioning the animated background */
    overflow-x: hidden; /* Prevents horizontal scrollbars */
}

/* Animated background with Bible icons */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 200%; /* Taller to allow for scrolling animation */
    z-index: -1;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3e%3ctext x='50' y='80' font-size='40' fill='rgba(255,255,255,0.1)'%3e✝%3c/text%3e%3ctext x='250' y='150' font-size='40' fill='rgba(255,255,255,0.08)'%3e📖%3c/text%3e%3ctext x='150' y='300' font-size='40' fill='rgba(255,255,255,0.12)'%3e🕊️%3c/text%3e%3ctext x='350' y='350' font-size='40' fill='rgba(255,255,255,0.09)'%3e✝%3c/text%3e%3c/svg%3e");
    animation: floatUp 40s linear infinite;
}


.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Header & Navigation --- */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Animation for the header */
    animation: slideDown 0.8s ease-out 0.3s forwards;
}

.logo h1 {
    color: var(--primary);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo p {
    color: var(--gray);
    font-size: 0.9rem;
}

.nav {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(30, 64, 175, 0.3);
}
.nav-link.danger {
    background: var(--error);
    color: rgb(255, 255, 255);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(210, 20, 14, 0.3);
}

/* --- Hero Section --- */
.hero {
    text-align: center;
    padding: 4rem 0;
    color: white;
}

.hero-content h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* --- Buttons --- */
.btn-glow {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(30, 64, 175, 0.4);
    text-decoration: none;
    display: inline-block;
}

.btn-glow:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(30, 64, 175, 0.6);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--gray-light);
    color: var(--dark);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary:hover {
    background: var(--gray);
    color: white;
}

.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: rgb(181, 141, 24); }
.btn-info { background: var(--secondary); color: white; }
.btn-danger { background: var(--error); color: rgb(255, 0, 0); }
.btn-danger:hover { background: var(--error); filter: brightness(90%); }

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 8px; /* Added from new styles */
}

.btn-telegram { background: #0088cc; color: white; }
.btn-instagram { background: linear-gradient(45deg, #405de6, #5851db, #833ab4, #c13584, #e1306c, #fd1d1d); color: white; }
.btn-link { background: none; color: var(--primary); text-decoration: underline; border: none; cursor: pointer; }

/* --- Forms & Inputs --- */
.testimony-form,
.login-form,
.settings-form,
.filter-form,
.horizontal-filters { /* Added horizontal-filters to share base style */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.form-group { margin-bottom: 1.5rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="color"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-light);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

/* NEW: Checkbox styles */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* --- NEW: Horizontal Filters --- */
.horizontal-filters { padding: 1.5rem; border-radius: 15px; } /* Override padding */

.horizontal-filter-form .filter-row {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-item { flex: 1; min-width: 150px; }
.filter-item label { font-size: 0.9rem; }
.filter-actions { display: flex; gap: 0.5rem; align-items: flex-end; }


/* --- Location Detection --- */
.church-selection { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.location-status { margin-top: 0.5rem; }
.location-loading { color: var(--warning); }
.location-success { color: var(--success); }
.location-error { color: var(--error); }
.location-detecting { animation: pulse 2s infinite ease-in-out; }
.nearest-church { font-weight: bold; background-color: #f0f9ff; }


/* --- Form Meta & Warnings --- */
.message-meta { display: flex; justify-content: space-between; margin-top: 0.5rem; font-size: 0.875rem; color: var(--gray); }
.warning { background: #fef3c7; color: #92400e; padding: 0.75rem; border-radius: 8px; margin-top: 0.5rem; border-left: 4px solid var(--warning); }

/* --- Testimony Cards & Content --- */
.testimonies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.testimony-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.testimony-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.testimony-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.testimony-header h3 { color: var(--primary); flex: 1; margin-right: 1rem; }
.section-badge { background: var(--secondary); color: white; padding: 0.25rem 0.75rem; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }

/* FIXED: Scoped enhanced testimony content with line-clamp to CARDS only */
.testimony-card .testimony-content {
    position: relative;
    color: var(--dark);
    flex-grow: 1;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5; /* Truncates text after 5 lines */
    overflow: hidden;
    margin-bottom: 1rem;
}

/* FIXED: Scoped read more button to CARDS only */
.testimony-card .read-more {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    text-align: right;
    background: linear-gradient(to right, transparent, white 70%);
    padding: 0.5rem 0 0 2rem;
    color: var(--primary);
    cursor: pointer;
}

.testimony-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-light);
}

.meta-left strong { color: var(--primary); }
.meta-right { color: var(--gray); font-size: 0.875rem; }

/* MERGED: Enhanced testimony actions */
.testimony-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto; /* Pushes actions to the bottom of the card */
}

.testimony-actions .btn-primary,
.testimony-actions .btn-glow {
    flex: 1;
    text-align: center;
    padding: 0.75rem 1rem;
}


/* --- NEW: AI Summary Preview --- */
.ai-summary-preview {
    background: #f0f9ff;
    border: 2px solid var(--secondary);
    border-radius: 10px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.ai-summary-preview h4 { color: var(--primary); margin-bottom: 1rem; }
.summary-content { background: white; padding: 1rem; border-radius: 8px; margin-bottom: 1rem; border-left: 4px solid var(--secondary); }
.summary-actions { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }


/* --- NEW: Bulk Actions --- */
.bulk-actions {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 1rem;
    margin: 1rem 0;
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.bulk-select-all { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.bulk-action-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }


/* --- Alerts & Badges --- */
.alert { padding: 1.5rem; border-radius: 15px; margin: 1rem 0; border-left: 6px solid; }
.alert-success { background: #d1fae5; color: #065f46; border-color: var(--success); }
.alert-error { background: #fee2e2; color: #991b1b; border-color: var(--error); }
.alert-warning { background: #fef3c7; color: #92400e; border-color: var(--warning); }

.status-badge, .badge { padding: 0.25rem 0.75rem; border-radius: 20px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.status-badge.published, .badge-success { background: #d1fae5; color: #065f46; }
.status-badge.unpublished, .badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }


/* --- Stats & Tables --- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin: 2rem 0; }
.stat-card { background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 15px; padding: 1.5rem; text-align: center; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); }
.stat-number { font-size: 2.5rem; font-weight: 700; color: var(--primary); margin: 0.5rem 0; }

.admin-table-section { background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 20px; padding: 2rem; margin: 2rem 0; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); }
.table-container { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--gray-light); }
.admin-table th { background: var(--primary); color: white; font-weight: 600; }
.admin-table tr:hover { background: rgba(30, 64, 175, 0.05); }
.actions { display: flex; gap: 0.25rem; flex-wrap: wrap; }


/* --- NEW: Admin View Enhancements --- */
.admin-testimony-view {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.testimony-detail-admin .original-message { background: #fff3cd; border: 1px solid #ffeaa7; border-radius: 8px; padding: 1rem; margin: 1rem 0; }
.testimony-detail-admin .summary-text { background: #d1ecf1; border: 1px solid #bee5eb; border-radius: 8px; padding: 1rem; margin: 1rem 0; }


/* --- Modals & Popups --- */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.modal-content { background: white; margin: 10% auto; padding: 2rem; border-radius: 20px; width: 90%; max-width: 500px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); position: relative; }
.close { position: absolute; right: 1rem; top: 1rem; font-size: 1.5rem; cursor: pointer; color: var(--gray); }
.close:hover { color: var(--dark); }
.modal-actions { display: flex; gap: 1rem; margin-top: 1.5rem; justify-content: flex-end; }
.popup-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.popup-actions .btn-glow { min-width: 140px; }


/* --- Sunday Popup --- */
.sunday-popup { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.popup-content { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: white; padding: 3rem; border-radius: 20px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); max-width: 500px; margin: 2rem; }
.popup-content h3 { font-size: 2rem; margin-bottom: 1rem; }


/* --- Login Page --- */
.login-container { max-width: 400px; margin: 4rem auto; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 20px; padding: 2rem; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); }
.login-header { text-align: center; margin-bottom: 2rem; }
.login-header h1 { color: var(--primary); margin-bottom: 0.5rem; }
.login-footer { text-align: center; margin-top: 1.5rem; }


/* --- Testimony Detail Page --- */
.testimony-detail { background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 20px; padding: 2rem; margin: 2rem 0; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); }
.testimony-header h1 { color: var(--primary); font-size: 2.5rem; margin-bottom: 1.5rem; }
.testimony-meta-large { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; padding: 1.5rem; background: var(--light); border-radius: 15px; }
.meta-item { display: flex; flex-direction: column; }
.meta-item strong { color: var(--gray); font-size: 0.875rem; margin-bottom: 0.25rem; }
.summary-section, .original-section, .message-full { margin-bottom: 2rem; }
.summary-section h3, .original-section h3 { color: var(--primary); margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--primary); }


/* --- Share & Success Actions --- */
/* MERGED: Share button styles */
.share-buttons {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}
.share-buttons .btn-glow {
    flex: 1;
    min-width: 150px;
}
.success-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}
.success-actions .btn-glow {
    margin: 0.25rem;
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
/* NEW: Pulse animation */
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.85; }
}

/* NEW: Animation for floating background icons */
@keyframes floatUp {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-800px); /* A large value to ensure they scroll fully off-screen */
    }
}

/* NEW: Animation for header sliding down */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.testimony-card, .alert, .stat-card { animation: fadeIn 0.6s ease-out; }


/* --- Utility Classes --- */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.no-testimonies, .no-data { text-align: center; padding: 3rem; color: var(--gray); }


/* --- Responsive Design --- */
@media (max-width: 768px) {
    /*
      ** Mobile Viewport Adjustment **
      The following rules ensure the main content fits perfectly on mobile screens.
      - We prevent horizontal scrolling on the body.
      - All primary layout containers are set to 95% of the screen width and centered.
      - This creates a "zoomed-out" feel with consistent, clean margins on both sides.
    */
    body {
        overflow-x: hidden; /* Prevents accidental horizontal scrollbars */
    }

    .container,
    .header,
    .testimony-form,
    .login-form,
    .settings-form,
    .filter-form,
    .horizontal-filters,
    .bulk-actions,
    .stats-grid,
    .admin-table-section,
    .admin-testimony-view,
    .login-container,
    .testimony-detail {
        width: 95%;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* The original .container had padding to keep content off the edges.
       Since we now control the width of the container itself, we reset it
       to prevent double-spacing issues. */
    .container {
        padding-left: 0;
        padding-right: 0;
    }

    /* Original mobile styles below */
    .header { flex-direction: column; text-align: center; gap: 1rem; }
    .nav { flex-wrap: wrap; justify-content: center; }
    .hero-content h2 { font-size: 2rem; }
    .form-row { grid-template-columns: 1fr; }
    .testimonies-grid { grid-template-columns: 1fr; }
    .testimony-meta-large { grid-template-columns: 1fr; }
    .share-buttons { flex-direction: column; }
    .modal-content { margin: 5% auto; width: 95%; }

    /* NEW & MERGED: Responsive styles for filters and actions */
    .horizontal-filter-form .filter-row { flex-direction: column; align-items: stretch; }
    .filter-item { min-width: auto; }
    .filter-actions { justify-content: center; }
    .bulk-actions { flex-direction: column; align-items: stretch; }
    .bulk-action-buttons { justify-content: center; }
    .success-actions { flex-direction: column; }
    .success-actions .btn-glow { width: 100%; }
}

