/* ===== CSS VARIABLES ===== */
:root {
    --primary: #c62828;
    --primary-dark: #b71c1c;
    --primary-light: #ffcdd2;
    --secondary: #2e7d32;
    --accent: #1565c0;
    --warning: #f57c00;
    --bg: #f5f7fa;
    --surface: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

/* ===== RESET & BASE ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* ===== NAVIGATION ===== */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 0 2rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    transition: var(--transition);
}

.navbar.hidden { display: none; }

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
}

.nav-brand i { font-size: 1.6rem; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary);
    background: var(--primary-light);
}

.nav-link.logout:hover { color: var(--primary); background: #fee2e2; }

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text);
    cursor: pointer;
}

/* ===== PAGES ===== */
.page {
    display: none;
    padding-top: 64px;
    min-height: 100vh;
    animation: fadeIn 0.3s ease;
}

.page.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* ===== AUTH PAGE ===== */
.auth-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

.auth-hero {
    background: linear-gradient(135deg, var(--primary) 0%, #8e0000 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.auth-hero::before {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    top: -100px; right: -100px;
}

.auth-hero::after {
    content: '';
    position: absolute;
    width: 200px; height: 200px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    bottom: -50px; left: -50px;
}

.hero-content { text-align: center; position: relative; z-index: 1; }

.logo-large {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.logo-large i { font-size: 3rem; }
.logo-large h1 { font-size: 2.5rem; font-weight: 800; }

.hero-tagline {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 3rem;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
}

.stat-item { text-align: center; }
.stat-number { display: block; font-size: 2rem; font-weight: 700; }
.stat-label { font-size: 0.85rem; opacity: 0.8; }

.auth-forms {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: var(--bg);
}

.auth-form {
    display: none;
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.auth-form.active { display: block; animation: slideUp 0.4s ease; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-form h2 { font-size: 1.75rem; margin-bottom: 0.5rem; }
.auth-form > p { color: var(--text-secondary); margin-bottom: 1.5rem; }

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-switch a {
    color: var(--primary);
    font-weight: 600;
}

/* ===== FORM ELEMENTS ===== */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.form-group label i { margin-right: 0.3rem; color: var(--primary); }

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
    background: var(--surface);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.1);
}

.form-group input:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    accent-color: var(--primary);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(198, 40, 40, 0.3);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
}

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

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

.btn-success:hover { background: #1b5e20; }

.btn-full { width: 100%; }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }

/* ===== CARDS ===== */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header h3 { font-size: 1.1rem; font-weight: 600; }
.card-header i { color: var(--primary); }

.card-body { padding: 1.5rem; }

/* ===== PAGE HEADER ===== */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.page-header h1 i { color: var(--primary); margin-right: 0.5rem; }

.page-header p { color: var(--text-secondary); }

.welcome-text { font-size: 1.1rem; }
.welcome-text span { color: var(--primary); font-weight: 600; }

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

.stat-icon {
    width: 50px; height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
}

.bg-red { background: linear-gradient(135deg, #ef5350, #c62828); }
.bg-green { background: linear-gradient(135deg, #66bb6a, #2e7d32); }
.bg-blue { background: linear-gradient(135deg, #42a5f5, #1565c0); }
.bg-orange { background: linear-gradient(135deg, #ffa726, #f57c00); }

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===== DASHBOARD GRID ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.status-indicator { text-align: center; margin-bottom: 1rem; }
.status-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
}

.status-badge.eligible {
    background: #e8f5e9;
    color: var(--secondary);
}

.status-badge.not-eligible {
    background: #fff3e0;
    color: var(--warning);
}

.status-details {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== DONATIONS LIST ===== */
.donations-list { max-height: 300px; overflow-y: auto; }

.donation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.donation-item:hover { background: #fafafa; }

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

.donation-info h4 { font-size: 0.95rem; margin-bottom: 0.2rem; }
.donation-info p { font-size: 0.8rem; color: var(--text-secondary); }

.donation-actions { display: flex; gap: 0.5rem; }

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-style: italic;
}

/* ===== BLOOD GROUP CHART ===== */
.blood-group-chart {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.bg-item {
    text-align: center;
    padding: 1rem 1.5rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    min-width: 80px;
}

.bg-item .bg-label {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

.bg-item .bg-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===== SEARCH FILTERS ===== */
.search-filters { margin-bottom: 2rem; }

.filter-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-row .form-group { flex: 1; min-width: 150px; margin-bottom: 0; }

/* ===== SEARCH RESULTS ===== */
.results-header {
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.donors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.donor-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border-left: 4px solid var(--primary);
}

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

.donor-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.donor-avatar {
    width: 50px; height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #8e0000);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
}

.donor-name { font-size: 1.1rem; font-weight: 600; }
.donor-meta { font-size: 0.8rem; color: var(--text-secondary); }

.donor-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.donor-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.donor-detail strong { color: var(--text); }

.blood-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
}

/* ===== EVENTS ===== */
.events-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    background: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-family: inherit;
}

.tab-btn:hover { color: var(--primary); background: var(--primary-light); }
.tab-btn.active { color: var(--primary); background: var(--primary-light); }

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

.events-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.event-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.event-title { font-size: 1.1rem; font-weight: 600; }

.event-city {
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.event-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.event-meta {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.event-meta i { width: 18px; color: var(--primary); }

.event-actions { display: flex; gap: 0.5rem; }

.subscriptions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sub-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.4rem 0.8rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
}

.sub-tag button {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.8rem;
}

/* ===== PROFILE ===== */
.profile-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.profile-stats {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.profile-stat {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.ps-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.ps-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===== ALERTS ===== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert.hidden { display: none; }

.alert-success { background: #e8f5e9; color: var(--secondary); border-left: 4px solid var(--secondary); }
.alert-error { background: #ffebee; color: #c62828; border-left: 4px solid #c62828; }
.alert-warning { background: #fff3e0; color: var(--warning); border-left: 4px solid var(--warning); }
.alert-info { background: #e3f2fd; color: var(--accent); border-left: 4px solid var(--accent); }

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-sm);
    padding: 1rem 1.5rem;
    z-index: 9999;
    animation: slideInRight 0.3s ease;
}

.toast.hidden { display: none; }

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.toast-content .fa-check-circle { color: var(--secondary); }
.toast-content .fa-exclamation-circle { color: #c62828; }
.toast-content .fa-info-circle { color: var(--accent); }

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

/* ===== MODAL ===== */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.modal.hidden { display: none; }

.modal-content {
    background: var(--surface);
    border-radius: var(--radius);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 1.1rem; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body { padding: 1.5rem; }

.modal-body img { width: 100%; border-radius: var(--radius-sm); margin-bottom: 1rem; }

.modal-actions { text-align: center; }

/* ===== UTILITIES ===== */
.mt-4 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .profile-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .auth-container { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
    .auth-forms { padding: 1.5rem; }

    .nav-links {
        position: fixed;
        top: 64px; left: 0; right: 0;
        background: var(--surface);
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow);
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
        transition: var(--transition);
    }

    .nav-links.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: all;
    }

    .nav-toggle { display: block; }

    .container { padding: 1rem; }
    .page-header h1 { font-size: 1.4rem; }

    .stats-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .filter-row { flex-direction: column; }
    .filter-row .form-group { width: 100%; }

    .events-list { grid-template-columns: 1fr; }
    .donors-grid { grid-template-columns: 1fr; }

    .events-tabs { overflow-x: auto; flex-wrap: nowrap; }

    .hero-stats { gap: 1.5rem; }
}

@media (max-width: 480px) {
    .stat-card { flex-direction: column; text-align: center; }
    .donor-header { flex-direction: column; text-align: center; }
    .donor-details { grid-template-columns: 1fr; }
}
