/* =========================================================
   BLOOD LIFELINE - MASTER STYLESHEET
   ========================================================= */

:root {
    --primary: #e11d48;
    --primary-hover: #be123c;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.5);
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Segoe UI', system-ui, sans-serif; 
}

body { 
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    color: var(--text-main); 
    min-height: 100vh; 
    display: flex; 
    flex-direction: column;
}

/* --- 1. GLASSMORPHISM UTILITY --- */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    border-radius: 16px;
}

/* --- 2. HEADER & NAVIGATION --- */
header {
    padding: 20px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    background: rgba(255, 255, 255, 0.8);
    position: sticky;
    top: 0;
    z-index: 50;
}
header h1 { 
    color: var(--primary); font-size: 1.8rem; font-weight: 800; letter-spacing: -0.5px;
}
header span { 
    font-weight: 400; color: var(--text-muted); font-size: 1rem; margin-left: 8px;
}

.header-buttons {
    display: flex; gap: 10px;
}

/* --- 3. BUTTONS --- */
.btn-outline {
    background: transparent; color: var(--primary);
    border: 2px solid var(--primary); padding: 8px 20px;
    border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.3s ease;
}
.btn-outline:hover { background: var(--primary); color: white; }

#openStatusBtn { border-color: var(--text-muted); color: var(--text-muted); }
#openStatusBtn:hover { background: var(--text-muted); color: white; }

.btn-solid {
    background: var(--primary); color: white; border: none; padding: 14px; 
    border-radius: 10px; font-size: 1rem; font-weight: 700; width: 100%; 
    cursor: pointer; transition: 0.3s; box-shadow: 0 4px 12px rgba(225, 29, 72, 0.3);
}
.btn-solid:hover { background: var(--primary-hover); transform: translateY(-2px); }

/* Danger Button (Delete Profile) */
.btn-danger-outline {
    background: transparent; 
    color: #ef4444; 
    border: 2px solid #ef4444; 
    padding: 14px; 
    border-radius: 10px; 
    font-size: 1rem; 
    font-weight: 700; 
    cursor: pointer; 
    transition: 0.3s;
}
.btn-danger-outline:hover { 
    background: #ef4444; 
    color: white; 
    transform: translateY(-2px); 
}

/* --- 4. DASHBOARD LAYOUT --- */
.dashboard {
    display: grid; grid-template-columns: 350px 1fr; gap: 30px;
    padding: 40px 5%; flex-grow: 1;
}

/* --- 5. FORMS & INPUTS --- */
.form-group { margin-bottom: 20px; }
label { 
    display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); 
    margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; 
}

input { 
    width: 100%; 
    padding: 14px; 
    border: 1px solid rgba(0,0,0,0.1); 
    border-radius: 10px; 
    font-size: 1rem; 
    background: rgba(255,255,255,0.9);
    transition: all 0.3s; 
    outline: none;
    color: var(--text-main);
}

input:focus { 
    border-color: var(--primary); 
    box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.15); 
}
select {
    width: 100%;
    padding: 14px 40px 14px 14px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-main);
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 10px;
    transition: all 0.3s;
    outline: none;
    
    /* Remove default ugly arrow */
    appearance: none; 
    -webkit-appearance: none;
    -moz-appearance: none;
    
    /* Inject custom chevron arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    cursor: pointer;
}

select:focus { 
    border-color: var(--primary); 
    box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.15); 
}

select option {
    padding: 10px;
    background: white;
    color: var(--text-main);
}
/* --- 6. PREMIUM CUSTOM DROPDOWNS --- */
.custom-select-wrapper {
    position: relative;
    user-select: none;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-size: 1rem;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.3s ease;
}

.custom-select-wrapper.open .custom-select-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.15);
}

.custom-select-wrapper.open .custom-select-trigger svg {
    transform: rotate(180deg);
    transition: transform 0.3s ease;
}

.custom-select-options {
    position: absolute;
    top: 110%; 
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
}

.custom-select-wrapper.open .custom-select-options {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.custom-option {
    padding: 12px 16px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.custom-option:hover {
    background: #fff1f2; 
    color: var(--primary);
}

.custom-option.selected {
    background: #ffe4e6;
    color: var(--primary);
    font-weight: 600;
}

/* --- 7. RESULTS GRID & CARDS --- */
.results-header { margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; }
.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }

.donor-card { 
    padding: 24px; transition: 0.3s; position: relative; overflow: hidden; 
    display: flex; flex-direction: column; justify-content: space-between;
}
.donor-card:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(0,0,0,0.1); }
.donor-card::before { content: ''; position: absolute; top: 0; left: 0; width: 5px; height: 100%; background: var(--primary); }

.donor-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.donor-header h3 { font-size: 1.25rem; color: var(--text-main); margin: 0; font-weight: 700; }

.blood-badge { 
    background: #fff1f2; color: #e11d48; padding: 6px 12px; border-radius: 8px; 
    font-size: 0.95rem; font-weight: 800; box-shadow: 0 2px 4px rgba(225, 29, 72, 0.1);
    border: 1px solid #ffe4e6;
}

.donor-location {
    display: flex; align-items: center; gap: 6px; color: var(--text-muted);
    font-size: 0.95rem; margin-bottom: 22px;
}

/* Card Action Buttons */
.action-buttons {
    display: flex; gap: 10px; margin-top: 10px;
}

.whatsapp-btn { 
    background: linear-gradient(135deg, #25D366, #128C7E); color: white; 
    padding: 12px; border-radius: 10px; text-decoration: none; 
    font-weight: 600; font-size: 0.95rem; display: flex; justify-content: center; 
    align-items: center; gap: 8px; box-shadow: 0 4px 12px rgba(37, 211, 102, 0.2);
    transition: 0.3s ease; flex: 1;
}
.whatsapp-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(37, 211, 102, 0.35); }

.call-btn {
    background: linear-gradient(135deg, #3b82f6, #2563eb); color: white; 
    padding: 12px; border-radius: 10px; text-decoration: none; 
    font-weight: 600; font-size: 0.95rem; display: flex; justify-content: center; 
    align-items: center; gap: 8px; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    transition: 0.3s ease; flex: 1;
}
.call-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35); }

/* --- 8. SPONSOR CARDS --- */
.sponsor-card {
    display: block; padding: 0; text-decoration: none; border: 2px solid rgba(0,0,0,0.05);
    background: transparent; cursor: pointer; min-height: 220px;
}
.sponsor-card::before { display: none; }
.sponsor-img-container { width: 100%; height: 100%; display: flex; }
.sponsor-img-container img { width: 100%; height: 100%; object-fit: cover; border-radius: 14px; }

.sponsored-label {
    position: absolute; top: 12px; right: 12px; background: rgba(15, 23, 42, 0.7);
    color: white; font-size: 0.7rem; padding: 4px 8px; border-radius: 4px;
    text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; z-index: 2;
    backdrop-filter: blur(4px);
}

/* --- 9. MODALS & DISCLAIMERS --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(4px);
    display: flex; justify-content: center; align-items: center;
    opacity: 0; pointer-events: none; transition: 0.3s ease; z-index: 1000;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content { width: 100%; max-width: 450px; padding: 30px; transform: translateY(20px); transition: 0.3s ease; max-height: 90vh; overflow-y: auto; }
.modal-overlay.active .modal-content { transform: translateY(0); }
.close-modal { position: absolute; top: 15px; right: 20px; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); }

.registration-disclaimer {
    display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px;
    background: rgba(248, 250, 252, 0.5); padding: 15px; border-radius: 8px;
    border: 1px dashed #cbd5e1;
}
.registration-disclaimer input[type="checkbox"] {
    width: 20px; height: 20px; margin-top: 2px; accent-color: var(--primary); 
    cursor: pointer; flex-shrink: 0;
}
.registration-disclaimer label {
    font-size: 0.8rem; color: var(--text-muted); line-height: 1.5;
    margin-bottom: 0; text-transform: none; letter-spacing: normal;
    font-weight: 500; cursor: pointer; text-align: justify;
}
.registration-disclaimer label strong { color: var(--text-main); }

/* --- 10. LOADERS & TOASTS --- */
.loader {
    border: 4px solid rgba(0,0,0,0.05); border-top: 4px solid var(--primary);
    border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 40px auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.toast-container { position: fixed; bottom: 30px; right: 30px; display: flex; flex-direction: column; gap: 10px; z-index: 2000; }
.toast { 
    padding: 15px 25px; border-radius: 8px; font-weight: 600; font-size: 0.9rem; 
    color: white; opacity: 0; transform: translateX(50px); animation: slideIn 0.3s forwards; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); 
}
.toast.success { background: #10b981; }
.toast.error { background: #ef4444; }
@keyframes slideIn { to { opacity: 1; transform: translateX(0); } }

/* --- 11. DEEP SLATE FOOTER --- */
footer {
    background-color: #1e293b; 
    color: #f8fafc; 
    padding: 40px 20px;
    margin-top: 50px; 
    border-top: 1px solid #0f172a; 
}
.footer-content { max-width: 1200px; margin: 0 auto; }

/* Adjusted Details Box for Dark Mode */
details.disclaimer {
    background: rgba(255, 255, 255, 0.05); /* Dark transparent background */
    padding: 15px 20px; 
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1); 
    margin-bottom: 20px;
}
details.disclaimer summary {
    font-size: 0.9rem; color: #cbd5e1; cursor: pointer;
    font-weight: 500; outline: none; user-select: none;
}
details.disclaimer summary strong { color: #ef4444; }
details.disclaimer p {
    font-size: 0.85rem; color: #94a3b8; line-height: 1.6;
    text-align: justify; margin-top: 12px; padding-top: 12px; 
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

/* Adjusted Footer Bottom for Dark Mode */
.footer-bottom {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.9rem; color: #94a3b8; 
    border-top: 1px solid #334155; /* Darker border instead of light gray */
    padding-top: 15px;
}
.footer-bottom a { color: #38bdf8; text-decoration: none; font-weight: 600; transition: 0.2s; }
.footer-bottom a:hover { color: #7dd3fc; text-decoration: underline; }

.developer-info { display: flex; align-items: center; gap: 15px; }

/* Support Button designed for Dark Footer */
.support-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white !important;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    text-decoration: none !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: 0.3s;
    font-weight: 600;
}
.support-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* --- 12. MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    .dashboard { grid-template-columns: 1fr; padding: 20px 5%; }
    
    header { flex-direction: column; gap: 15px; padding: 20px 5%; text-align: center; }
    
    /* Updated Mobile Header Text */
    header h1 { 
        font-size: 1.6rem; 
        display: flex; 
        flex-direction: column; 
        align-items: center; 
    }
    
    header span { 
        display: block; /* This brings the text back on mobile */
        font-size: 0.85rem; 
        margin-left: 0; 
        margin-top: 4px;
        line-height: 1.4;
    }
    
    .header-buttons { width: 100%; justify-content: center; }
    .header-buttons .btn-outline { flex: 1; font-size: 0.85rem; padding: 10px 8px; }
    
    .footer-bottom { flex-direction: column; text-align: center; gap: 10px; }
    .developer-info { flex-direction: column; gap: 10px; }
}

@media (max-width: 400px) {
    .whatsapp-btn, .call-btn { font-size: 0.85rem; padding: 10px; }
}