/* =========================================
   1. GLOBAL STYLES & DYNAMIC VARIABLES
   ========================================= */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }
html, body { max-width: 100vw; overflow-x: hidden; }

/* Light Mode (Default System) */
:root {
    --primary-blue: #0056b3;
    --light-blue: #e6f0fa;
    --text-dark: #1a1a1a;
    --text-muted: #666666;
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --border-color: #eeeeee;
    --shadow: 0 4px 15px rgba(0,0,0,0.05);
}

/* Dark Mode Override */
[data-theme="dark"] {
    --primary-blue: #38bdf8;
    --light-blue: #1e293b;
    --text-dark: #f8fafc;
    --text-muted: #94a3b8;
    --bg-body: #0f172a;
    --bg-surface: #1e293b;
    --border-color: #334155;
    --shadow: 0 10px 25px rgba(0,0,0,0.5);
}

body {
    background-color: var(--bg-body);
    color: var(--text-dark);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

.flex-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }

/* Utilities */
.hidden { display: none !important; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-15 { margin-bottom: 15px; }
.w-100 { width: 100%; }
.text-left { text-align: left; }
.italic { font-style: italic; }
.highlight { color: var(--primary-blue); }

/* =========================================
   2. TYPOGRAPHY, BUTTONS & FORMS
   ========================================= */
.btn {
    display: inline-block; text-decoration: none; padding: 12px 28px;
    border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.3s;
    border: none; text-align: center;
}
.btn-sm { padding: 8px 15px; font-size: 0.85rem; }
.btn-primary { background-color: var(--primary-blue); color: #ffffff; box-shadow: 0 4px 15px rgba(0, 86, 179, 0.3); }
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.1); }
.btn-secondary { background-color: var(--bg-surface); color: var(--text-dark); border: 1px solid var(--border-color); }
.btn-secondary:hover { border-color: var(--primary-blue); color: var(--primary-blue); }
.btn-danger { background: #ef4444; color: white; }
.btn-success { background: #10b981; color: white; }

.input-group { margin-bottom: 15px; text-align: left; }
.input-group label { display: block; font-size: 0.9rem; font-weight: 500; margin-bottom: 5px; color: var(--text-dark); }
.input-group input, textarea {
    width: 100%; padding: 12px 15px; border: 1px solid var(--border-color); border-radius: 8px; 
    font-size: 1rem; font-family: inherit; background-color: var(--bg-body); color: var(--text-dark); transition: 0.3s;
}
.input-group input:focus, textarea:focus { outline: none; border-color: var(--primary-blue); }
.error-msg { color: #e74c3c; font-size: 0.85rem; margin-bottom: 10px; }

/* =========================================
   3. NAVBAR & FOOTER
   ========================================= */
.navbar {
    display: flex; justify-content: space-between; align-items: center; padding: 15px 8%; 
    background-color: var(--bg-surface); border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100;
}
.logo-container { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo { height: 35px; width: auto; object-fit: contain; }
.brand-text { font-size: 1.3rem; color: var(--text-dark); font-weight: 400; }
.brand-text strong { color: var(--primary-blue); font-weight: 700; }

.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-item { text-decoration: none; color: var(--text-dark); font-weight: 500; transition: 0.3s; }
.nav-item:hover { color: var(--primary-blue); }

.theme-btn { background: transparent; border: none; font-size: 1.5rem; cursor: pointer; transition: transform 0.3s; }
.theme-btn:hover { transform: scale(1.1); }

.menu-toggle { display: none; flex-direction: column; cursor: pointer; gap: 5px; z-index: 101; }
.bar { width: 25px; height: 3px; background-color: var(--primary-blue); border-radius: 3px; transition: 0.3s; }

.site-footer {
    background: var(--bg-surface); text-align: center; padding: 20px; font-size: 0.9rem; 
    color: var(--text-muted); border-top: 1px solid var(--border-color); margin-top: auto;
}

/* =========================================
   4. HOME PAGE (HERO & CARDS)
   ========================================= */
.hero { display: flex; align-items: center; justify-content: space-between; padding: 80px 8%; gap: 40px; }
.hero-content { flex: 1; }
.badge { background-color: var(--light-blue); color: var(--primary-blue); padding: 6px 12px; border-radius: 50px; font-size: 0.9rem; font-weight: 600; margin-bottom: 20px; display: inline-block; }
.hero-content h1 { font-size: 3.5rem; line-height: 1.2; margin-bottom: 20px; color: var(--text-dark); }
.hero-content p { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 30px; }
.hero-graphic { flex: 1; position: relative; height: 400px; display: flex; justify-content: center; align-items: center; }

.focus-areas { display: flex; justify-content: center; gap: 30px; padding: 0 8% 80px 8%; }
.card { background-color: var(--bg-surface); padding: 30px; border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--border-color); flex: 1; transition: transform 0.3s ease; }
.card:hover { transform: translateY(-10px); }
.card-icon { font-size: 2.5rem; margin-bottom: 15px; }

/* =========================================
   5. AUTH PAGES (LOGIN/REGISTER)
   ========================================= */
.auth-page { background-color: var(--bg-body); }
.auth-container { flex: 1; display: flex; justify-content: center; align-items: center; padding: 40px 20px; }
.auth-box { background: var(--bg-surface); padding: 40px; border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--border-color); width: 100%; max-width: 450px; }
.auth-box h2 { color: var(--primary-blue); margin-bottom: 5px; }
.auth-box p { color: var(--text-muted); margin-bottom: 25px; font-size: 0.95rem; }
.auth-switch { margin-top: 20px; text-align: center; font-size: 0.9rem; color: var(--text-muted); }
.highlight-link { color: var(--primary-blue); font-weight: 600; cursor: pointer; }

.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 500; }
.divider { display: flex; align-items: center; text-align: center; margin: 15px 0; color: var(--text-muted); font-size: 0.85rem; }
.divider::before, .divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--border-color); }
.divider span { padding: 0 10px; }

/* =========================================
   6. DASHBOARD & ADMIN PAGES
   ========================================= */
.dashboard-container { width: 100%; max-width: 1400px; margin: 0 auto; padding: 40px 5%; display: block; }
.status-screen { text-align: center; background: var(--bg-surface); padding: 60px 20px; border-radius: 16px; margin-top: 40px; box-shadow: var(--shadow); border: 1px solid var(--border-color); }
.icon-large { font-size: 4rem; margin-bottom: 20px; }
.badge-pending { background: #fef08a; color: #854d0e; padding: 4px 12px; border-radius: 20px; font-size: 1rem; }
.application-summary { background: var(--bg-body); padding: 15px; border-radius: 8px; border-left: 4px solid var(--primary-blue); }

/* ULTRA-COMPACT DASHBOARD CONTROLS */
.dashboard-top-control {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid var(--border-color);
}
.dashboard-top-control .role-badge {
    padding: 3px 8px; font-size: 0.7rem; border-radius: 6px; letter-spacing: 0.5px;
    border: 1px solid var(--border-color); background: transparent; color: var(--primary-blue);
}
.compact-tabs { margin: 0 !important; padding: 0 !important; gap: 8px; border: none; display: flex; }
.compact-tabs .tab-btn {
    padding: 8px 16px; font-size: 0.85rem; border-radius: 8px; background: transparent;
    border: 1px solid var(--border-color); font-weight: 600; color: var(--text-muted); cursor: pointer; transition: 0.3s;
}
.compact-tabs .tab-btn.active { background: var(--primary-blue); color: white; border-color: var(--primary-blue); }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Dashboard Grid & Cards */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 30px; width: 100%; align-items: start; }
.dash-card { background: var(--bg-surface); padding: 25px; border-radius: 12px; box-shadow: var(--shadow); border: 1px solid var(--border-color); }
.dash-card h3 { margin-bottom: 20px; color: var(--primary-blue); font-size: 1.2rem; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }

.notice { background: var(--bg-body); padding: 15px; border-radius: 8px; margin-bottom: 15px; font-size: 0.95rem; border: 1px solid var(--border-color); }
.resource-list { list-style: none; padding-left: 0; }
.resource-list li { margin-bottom: 12px; }
.resource-list a { color: var(--text-dark); text-decoration: none; font-weight: 500; transition: 0.3s; }
.resource-list a:hover { color: var(--primary-blue); }

.admin-grid { display: grid; grid-template-columns: 1fr; gap: 15px; }
.user-card { display: flex; justify-content: space-between; align-items: center; background: var(--bg-surface); padding: 15px 20px; border-radius: 10px; border-left: 4px solid var(--text-muted); box-shadow: var(--shadow); }
.user-card.pending-card { border-left-color: #f59e0b; }
.user-card.approved-card { border-left-color: #10b981; }
.admin-actions { display: flex; gap: 10px; }

/* =========================================
   7. COMMUNITY WALL
   ========================================= */
.wall-card { display: flex; flex-direction: column; height: 60vh; max-height: 600px; min-height: 400px; }
.wall-messages { flex: 1; overflow-y: auto; padding-right: 10px; display: flex; flex-direction: column; gap: 12px; }
.wall-msg { background: var(--bg-body); padding: 15px; border-radius: 8px; border: 1px solid var(--border-color); position: relative; }
.wall-msg-author { color: var(--primary-blue); font-weight: 700; font-size: 0.85rem; display: block; margin-bottom: 5px; }
.wall-msg-time { font-size: 0.7rem; color: var(--text-muted); position: absolute; top: 15px; right: 15px; }
.wall-input-area { display: flex; gap: 10px; padding-top: 15px; border-top: 1px solid var(--border-color); }
.wall-input-area input { flex: 1; }

/* =========================================
   8. COMING SOON & 404 PAGES
   ========================================= */
.coming-soon-page, .error-page { display: flex; align-items: center; justify-content: center; min-height: 80vh; padding: 20px; }
.coming-soon-card { background: var(--bg-surface); padding: 50px 40px; border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--border-color); text-align: center; max-width: 500px; width: 100%; }
.animated-icon { font-size: 4.5rem; margin-bottom: 20px; animation: float 3s ease-in-out infinite; }
.coming-soon-card h1 { color: var(--text-dark); font-size: 2rem; margin-bottom: 10px; }

.progress-container { background-color: var(--bg-body); height: 10px; border-radius: 20px; width: 100%; margin-bottom: 10px; overflow: hidden; border: 1px solid var(--border-color); }
.progress-bar { height: 100%; background-color: var(--primary-blue); width: 0%; border-radius: 20px; animation: loadProgress 2s ease-out forwards, pulseProgress 2s infinite 2s; }
.progress-text { font-size: 0.85rem !important; font-weight: 600; margin-bottom: 10px !important; }

@keyframes float { 0% { transform: translateY(0px); } 50% { transform: translateY(-15px); } 100% { transform: translateY(0px); } }
@keyframes loadProgress { to { width: 75%; } }
@keyframes pulseProgress { 0% { opacity: 1; } 50% { opacity: 0.7; } 100% { opacity: 1; } }

/* =========================================
   9. CUSTOM LOGO LOADER ANIMATION
   ========================================= */
.loader-logo-wrapper { position: relative; width: 80px; height: 80px; margin: 0 auto 25px auto; display: flex; justify-content: center; align-items: center; }
.loader-logo { width: 100%; height: 100%; object-fit: contain; animation: pulseLogo 2s infinite ease-in-out; position: relative; z-index: 2; }
.loader-ring {
    position: absolute; top: -15px; left: -15px; right: -15px; bottom: -15px;
    border: 3px solid transparent; border-top-color: var(--primary-blue); border-right-color: var(--primary-blue);
    border-radius: 50%; animation: spinRing 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite; z-index: 1; opacity: 0.7;
}
@keyframes pulseLogo { 0% { transform: scale(0.85); opacity: 0.8; } 50% { transform: scale(1.05); opacity: 1; filter: drop-shadow(0 0 10px var(--primary-blue)); } 100% { transform: scale(0.85); opacity: 0.8; } }
@keyframes spinRing { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* =========================================
   10. CONNECT GROUP CHAT STYLES (MODERN)
   ========================================= */

/* Desktop Background Setup */
.connect-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    height: calc(100vh - 70px); 
    background-color: var(--bg-body);
}

/* The Main Chat Card */
.chat-container {
    width: 100%;
    max-width: 900px; /* Perfect desktop width */
    height: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column; /* Stacks header -> window -> footer */
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
}
.chat-header h2 { font-size: 1.3rem; color: var(--text-dark); margin-bottom: 2px; }
.chat-header p { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

.chat-status {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Chat Messages Area */
.chat-window {
    flex: 1; /* This pushes the input form to the absolute bottom! */
    overflow-y: auto;
    background: var(--bg-body);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

#messages-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: min-content; /* Helps with auto-scrolling */
}

/* Bubbles */
.chat-bubble {
    max-width: 70%;
    padding: 12px 18px;
    border-radius: 16px;
    font-size: 0.95rem;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.chat-bubble.other {
    align-self: flex-start;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}
.chat-bubble.other .chat-author {
    color: var(--primary-blue);
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 4px;
    display: block;
}
.chat-bubble.self {
    align-self: flex-end;
    background: var(--primary-blue);
    color: white;
    border-bottom-right-radius: 4px;
}
.chat-bubble.self .chat-author {
    color: #e0f2fe;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 4px;
    display: block;
    text-align: right;
}
.chat-time {
    font-size: 0.65rem;
    opacity: 0.75;
    margin-top: 5px;
    display: block;
    text-align: right;
}

/* Chat Input Footer */
.chat-input-area {
    display: flex;
    gap: 10px;
    background: var(--bg-surface);
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    z-index: 10;
}
.chat-input-area input {
    flex: 1;
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    padding: 12px 20px;
    border-radius: 50px;
    color: var(--text-dark);
    font-size: 1rem;
    transition: 0.3s;
}
.chat-input-area input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
}
.chat-input-area button {
    border-radius: 50px;
    padding: 10px 25px;
}

/* =========================================
   11. MOBILE OVERRIDES FOR CHAT
   ========================================= */
@media (max-width: 768px) {
/* 7. Connect Chat Mobile Tweaks (Fixed Full-Screen Layout) */
    .connect-layout { 
        padding: 0; 
        height: calc(100dvh - 65px); 
        align-items: stretch; /* FIX: Forces it to stretch from top to bottom */
        justify-content: flex-start; /* FIX: Pushes header to the very top */
    }
    
    .chat-container { 
        border-radius: 0; 
        border: none; 
        height: 100%; /* FIX: Fills the entire layout */
        max-height: none; /* Removes desktop height restrictions */
        width: 100%;
        display: flex;
        flex-direction: column;
    }
    
    .chat-header { 
        margin: 0; 
        padding: 15px; 
        border-radius: 0;
        background: var(--bg-surface);
    }
    
    .chat-window { 
        flex: 1; /* FIX: Takes up all empty space, pushing the input box to the floor! */
        padding: 15px 10px; 
        border: none;
        overflow-y: auto;
    }
    
    .chat-bubble { 
        max-width: 85%; 
        font-size: 0.95rem; 
    }
    
    .chat-input-area { 
        padding: 10px 15px; 
        padding-bottom: calc(10px + env(safe-area-inset-bottom)); 
        border-radius: 0; 
        border: none;
        border-top: 1px solid var(--border-color);
    }
    
    .chat-input-area input { 
        padding: 12px 15px; 
    }
    
    .chat-input-area button { 
        padding: 10px 20px; 
    }
}
/* =========================================
   11. MOBILE & TABLET RESPONSIVENESS
   ========================================= */
@media (max-width: 992px) {
    .navbar { padding: 15px 5%; }
    .menu-toggle { display: flex; }
    .nav-links { 
        position: absolute; top: 65px; left: -100%; width: 100%; 
        background-color: var(--bg-surface); flex-direction: column; 
        padding: 20px 0; box-shadow: var(--shadow); transition: 0.3s; 
        border-bottom: 1px solid var(--border-color);
    }
    .nav-links.active { left: 0; }
    .hide-on-mobile { display: none; }
    
    .hero { flex-direction: column; padding: 40px 5%; text-align: center; }
    .hero-graphic { display: none; }
    .hero-content h1 { font-size: 2.2rem; }
    
    .focus-areas { flex-direction: column; padding: 0 5% 40px 5%; }
    .auth-box { padding: 30px 20px; }
    .dashboard-container { padding: 20px 5%; }
    
    /* Dashboard Top Controls (Mobile) */
    .dashboard-top-control { flex-direction: column; align-items: flex-start; gap: 20px; padding-bottom: 15px; }
    .dashboard-top-control h1 { font-size: 1.4rem !important; }
    .compact-tabs { width: 100%; overflow-x: auto; padding-bottom: 5px !important; }
    .compact-tabs .tab-btn { flex-shrink: 0; }
    
    .dash-grid { grid-template-columns: 1fr !important; }
    .wall-card { height: 70vh; }
    
    .user-card { flex-direction: column; align-items: flex-start; gap: 15px; }
    .admin-actions, .admin-actions .btn { width: 100%; }

    /* Connect Chat Mobile Tweaks */
    .connect-main { padding: 10px 0 0 0; height: calc(100dvh - 65px); }
    .connect-header { margin: 0 10px 10px 10px; padding: 15px; }
    .chat-window { border-radius: 20px 20px 0 0; padding: 15px 10px; border-left: none; border-right: none; }
    .chat-bubble { max-width: 85%; font-size: 0.9rem; }
    .chat-input-area { padding: 10px 15px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); border-radius: 0; border-left: none; border-right: none; }
    .chat-input-area input { padding: 12px 15px; }
    .chat-input-area button { padding: 10px 20px; }
}

.wall-input-area { 
    display: flex; gap: 10px; padding-top: 15px; border-top: 1px solid var(--border-color); 
}

/* FIX: Make the wall input adapt to Dark Mode beautifully */
.wall-input-area input { 
    flex: 1; 
    padding: 10px 15px; 
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    background-color: var(--bg-body); 
    color: var(--text-dark); 
    font-size: 0.95rem;
    transition: 0.3s;
}

.wall-input-area input:focus {
    outline: none;
    border-color: var(--primary-blue);
}

/* =========================================
   12. FIX LONG URL OVERFLOWS
   ========================================= */
.wall-msg-text, 
.chat-text, 
.notice p, 
.notice,
.user-reason {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    white-space: pre-wrap; /* Respects when users press 'Enter' for a new line */
}

/* Make auto-generated links look good */
.auto-link {
    color: var(--primary-blue);
    text-decoration: underline;
    font-weight: 500;
}
.auto-link:hover {
    filter: brightness(1.2);
}

/* =========================================
   13. ABOUT PAGE PRESENTATION
   ========================================= */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 25px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--bg-surface);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

.info-item:hover {
    transform: translateY(-3px);
}

.info-item.w-100 {
    grid-column: 1 / -1; /* Spans full width on desktop */
}

.info-icon {
    font-size: 1.8rem;
    background: var(--light-blue);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.info-text strong {
    display: block;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.info-text span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Beautiful Email Pill Buttons */
.email-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.email-pill {
    background: rgba(0, 86, 179, 0.08);
    color: var(--primary-blue);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 86, 179, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.email-pill:hover {
    background: var(--primary-blue);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 86, 179, 0.3);
}

/* Dark Mode Adjustments for Emails */
[data-theme="dark"] .email-pill {
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.2);
}
[data-theme="dark"] .email-pill:hover {
    background: var(--primary-blue);
    color: #0f172a;
}

/* Mobile Fix for Info Grid */
@media (max-width: 768px) {
    .info-grid { grid-template-columns: 1fr; }
}

/* =========================================
   11. ULTIMATE MOBILE & TABLET RESPONSIVENESS
   ========================================= */

/* Prevent horizontal scrolling universally on mobile */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
}

/* Fix for long links breaking mobile layouts */
.wall-msg-text, .chat-text, .notice p, .notice, .user-reason, .user-info p, .user-info h4 {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    white-space: pre-wrap; 
}

/* =========================================
   TABLETS & SMALL LAPTOPS (Under 992px)
   ========================================= */
@media (max-width: 992px) {
    .navbar { padding: 15px 5%; }
    
    .hero { flex-direction: column; padding: 40px 5%; text-align: center; }
    .hero-graphic { display: none; } /* Hides large abstract art */
    .hero-content h1 { font-size: 2.5rem; }
    
    /* Make grids more flexible */
    .info-grid { grid-template-columns: 1fr; }
}

/* =========================================
   SMARTPHONES (Under 768px)
   ========================================= */
@media (max-width: 768px) {
    
    /* 1. Navbar & Hamburger Menu */
    .menu-toggle { display: flex; }
    .nav-links { 
        position: absolute; top: 65px; left: -100%; width: 100%; 
        background-color: var(--bg-surface); flex-direction: column; 
        padding: 20px 0; box-shadow: var(--shadow); transition: left 0.3s ease; 
        border-bottom: 1px solid var(--border-color);
        z-index: 99;
    }
    .nav-links.active { left: 0; }
    .hide-on-mobile { display: none; } /* Hides duplicate links on Dashboard nav */

    /* 2. Typography & Spacing */
    .hero-content h1 { font-size: 2.2rem; line-height: 1.2; }
    .hero-content p { font-size: 1rem; }
    .focus-areas { flex-direction: column; padding: 0 5% 40px 5%; }
    
    /* 3. Forms & Auth Boxes */
    .auth-container { padding: 20px 5%; }
    .auth-box { padding: 30px 20px; }
    .btn { padding: 12px 20px; width: 100%; /* Full width buttons on mobile */ }

    /* 4. Main Dashboard Adjustments */
    .dashboard-container { padding: 20px 5%; }
    
    .dashboard-top-control { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 15px; 
        padding-bottom: 15px; 
    }
    
    .dashboard-top-control h1 { font-size: 1.5rem !important; }
    
    /* Scrollable Tabs */
    .compact-tabs { 
        width: 100%; 
        overflow-x: auto; 
        padding-bottom: 8px !important; 
        -webkit-overflow-scrolling: touch; 
    }
    .compact-tabs .tab-btn { flex-shrink: 0; }

    /* Force all grid cards into a single column */
    .dash-grid { grid-template-columns: 1fr !important; gap: 20px; }
    
    /* 5. User Cards & Admin Panel */
    .user-card { 
        flex-direction: column; 
        align-items: stretch; 
        gap: 15px; 
        padding: 15px;
    }
    .admin-actions { 
        display: flex; 
        flex-wrap: wrap; 
        width: 100%; 
        gap: 10px;
        border-top: 1px solid var(--border-color);
        padding-top: 10px;
    }
    .admin-actions .btn { flex: 1; min-width: 120px; }

    /* 6. Community Wall */
    .wall-card { height: 75vh; padding: 15px; }
    .wall-input-area { flex-direction: column; }
    .wall-input-area input { padding: 12px; }

    /* 7. Connect Chat Mobile View */
    .connect-layout { 
        padding: 0; 
        height: calc(100dvh - 65px); 
    }
    .chat-container { 
        border-radius: 0; 
        border: none; 
        max-height: 100%; 
    }
    .chat-header { 
        padding: 12px 15px; 
    }
    .chat-status {
        padding: 4px 10px;
    }
    .chat-window {
        padding: 15px 10px;
    }
    .chat-bubble { 
        max-width: 85%; 
        font-size: 0.9rem; 
    }
    .chat-input-area { 
        padding: 10px 15px; 
        padding-bottom: calc(10px + env(safe-area-inset-bottom)); 
    }
}

/* =========================================
   TINY PHONES (Under 400px - SE/Mini devices)
   ========================================= */
@media (max-width: 400px) {
    .dash-greeting h1 { font-size: 1.3rem !important; flex-wrap: wrap; }
    .info-icon { width: 40px; height: 40px; font-size: 1.5rem; }
}
