/* ================= VARIABLES & RESET ================= */
:root {
    --sidebar-bg: #243036;
    --sidebar-active: #d4a853;
    --main-bg: #f0f2f5;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    
    --primary: #4a9b8e;
    --primary-dark: #3d8579;
    --secondary: #d4a853;
    --danger: #c53e3e;
    --danger-light: #fef2f2;
    
    --teal: #4a9b8e;
    --teal-light: #e6f4f1;
    --blue: #3b82f6;
    --green: #5aaa7a;
    --green-light: #ecfdf5;
    --yellow: #d4a853;
    --red: #c53e3e;
    --red-light: #fef2f2;
    --purple: #8b5cf6;
    --purple-light: #f5f3ff;
    --orange: #e0923f;
    --orange-light: #fff7ed;
    --dark: #1f2937;
    --pink: #ec4899;
    --pink-light: #fdf2f8;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Cairo', sans-serif; }
html, body { height: 100%; }
body { background: var(--main-bg); color: var(--text-main); }
button { cursor: pointer; border: none; outline: none; background: transparent; font-family: inherit; }
a { text-decoration: none; color: inherit; }

/* ================= UTILITIES ================= */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-white { color: white; }
.text-teal { color: var(--teal); } .text-blue { color: var(--blue); }
.text-green { color: var(--green); } .text-yellow { color: var(--yellow); }
.text-red { color: var(--red); } .text-purple { color: var(--purple); }
.text-orange { color: var(--orange); }

.bg-teal { background: var(--teal); color: white;}
.bg-dark { background: var(--dark); color: white;}
.bg-orange { background: var(--orange); color: white;}
.bg-green { background: var(--green); color: white;}
.bg-purple { background: var(--purple); color: white;}
.bg-red { background: var(--red); color: white;}
.bg-yellow { background: var(--yellow); color: white;}

.mt-10 { margin-top: 10px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-10 { margin-bottom: 10px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.w-100 { width: 100%; }

/* ================= LAYOUT ================= */
.app-container { display: flex; height: 100vh; overflow: hidden; }

/* ================= SIDEBAR ================= */
.sidebar { 
    width: 280px; 
    background: var(--sidebar-bg); 
    color: white; 
    display: flex; 
    flex-direction: column; 
    flex-shrink: 0;
}
.sidebar-header { 
    padding: 24px; 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    border-bottom: 1px solid rgba(255,255,255,0.08); 
}
.logo-icon { 
    width: 44px; 
    height: 44px; 
    background: var(--secondary); 
    color: var(--dark); 
    border-radius: 10px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 22px; 
    flex-shrink: 0;
}
.logo-img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}
.logo-text h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; } 
.logo-text p { font-size: 11px; color: #9ca3af; margin-top: 2px; }

.sidebar-nav { 
    flex: 1; 
    padding: 20px 14px; 
    display: flex; 
    flex-direction: column; 
    gap: 6px; 
}
.nav-item { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    padding: 13px 16px; 
    color: #b0b8c0; 
    border-radius: 10px; 
    font-size: 14px; 
    text-align: right; 
    width: 100%; 
    transition: 0.2s;
    font-weight: 600;
    border: 2px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: white; }
.nav-item.active { 
    background: var(--secondary); 
    color: #1f2937; 
    font-weight: 700; 
    border-color: rgba(255,255,255,0.3);
}
.nav-item i { font-size: 18px; width: 24px; text-align: center; }
.emergency-nav { color: #fca5a5; margin-top: 4px; position: relative; }
.emergency-nav::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: #ef4444;
    border-radius: 50%;
}
.emergency-nav.active { background: var(--secondary); color: #1f2937; }
.emergency-nav.active::before { background: #1f2937; }

.sidebar-footer { 
    padding: 20px; 
    border-top: 1px solid rgba(255,255,255,0.08); 
}
.user-info { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.user-avatar { 
    width: 40px; 
    height: 40px; 
    background: var(--primary); 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: bold; 
    font-size: 16px;
    flex-shrink: 0;
}
.user-details { display: flex; flex-direction: column; }
.user-name { font-size: 14px; font-weight: bold; } 
.user-role { font-size: 12px; color: #9ca3af; }
.logout-btn { 
    color: #9ca3af; 
    font-size: 13px; 
    display: flex; 
    gap: 8px; 
    align-items: center;
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    transition: 0.2s;
}
.logout-btn:hover { color: white; background: rgba(255,255,255,0.05); }

/* ================= MAIN CONTENT ================= */
.main-content { flex: 1; display: flex; flex-direction: column; overflow-y: auto; }
.topbar { 
    height: 64px; 
    background: var(--card-bg); 
    border-bottom: 1px solid var(--border); 
    display: flex; 
    align-items: center; 
    padding: 0 28px; 
    justify-content: space-between;
    position: sticky; 
    top: 0; 
    z-index: 5; 
    flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.icon-btn { 
    width: 40px; 
    height: 40px; 
    border-radius: 50%; 
    background: #f3f4f6; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: var(--text-main); 
    cursor: pointer; 
    transition: 0.2s; 
    border: none;
    position: relative;
}
.icon-btn:hover { background: var(--primary); color: white; }
.icon-btn .badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--red);
    border-radius: 50%;
    border: 2px solid #f3f4f6;
}

.content-wrapper { 
    padding: 28px; 
    max-width: 1200px; 
    margin: 0 auto; 
    width: 100%; 
}

/* --- SPA VIEW LOGIC --- */
.page-view { display: none; animation: fadeIn 0.3s ease; }
.page-view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ================= COMPONENTS ================= */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

.card { 
    background: var(--card-bg); 
    padding: 24px; 
    border-radius: 16px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.06); 
    transition: 0.3s; 
    border: 1px solid var(--border);
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-2px); }
.card.text-white { color: white; }
.card.text-center { text-align: center; }

/* Buttons */
.btn-primary { 
    background: var(--primary); 
    color: white; 
    padding: 12px 24px; 
    border-radius: 10px; 
    font-weight: 700; 
    transition: 0.2s; 
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary:hover { background: var(--primary-dark); transform: scale(1.02); }

.btn-outline { 
    background: transparent; 
    color: var(--primary); 
    border: 2px solid var(--primary); 
    padding: 10px 20px; 
    border-radius: 10px; 
    font-weight: 700; 
    transition: 0.2s; 
    cursor: pointer; 
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-outline:hover { background: var(--primary); color: white; }

.btn-danger { 
    background: var(--danger); 
    color: white; 
    padding: 12px 24px; 
    border-radius: 10px; 
    font-weight: 700; 
    transition: 0.2s; 
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-danger:hover { background: #b03030; transform: scale(1.02); }

.btn-gold { 
    background: var(--secondary); 
    color: #1f2937; 
    padding: 12px 24px; 
    border-radius: 10px; 
    font-weight: 700; 
    transition: 0.2s; 
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-gold:hover { background: #c49a48; transform: scale(1.02); }

.btn-white { 
    background: white; 
    color: var(--text-main); 
    padding: 12px 24px; 
    border-radius: 10px; 
    font-weight: 700; 
    transition: 0.2s; 
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-white:hover { background: #f3f4f6; }

/* Badge */
.badge { 
    padding: 5px 12px; 
    border-radius: 20px; 
    font-size: 12px; 
    display: inline-block; 
    font-weight: 700; 
}
.badge.bg-green { background: var(--green-light); color: var(--green); }
.badge.bg-red { background: var(--red-light); color: var(--red); }
.badge.bg-yellow { background: #fef3c7; color: #b45309; }
.badge.bg-blue { background: #eff6ff; color: var(--blue); }
.badge.bg-purple { background: var(--purple-light); color: var(--purple); }
.badge.bg-teal { background: var(--teal-light); color: var(--teal); }
.badge.bg-orange { background: var(--orange-light); color: var(--orange); }

/* Headers Banners */
.header-banner { 
    padding: 50px 40px; 
    border-radius: 16px; 
    text-align: center; 
    color: white; 
    margin-bottom: 24px; 
    position: relative;
    overflow: hidden;
}
.header-banner.bg-teal { background: linear-gradient(135deg, var(--teal), #3d8579); }
.header-banner.bg-dark { background: linear-gradient(135deg, var(--dark), #374151); }
.header-banner.bg-orange { background: linear-gradient(135deg, #b45309, #92400e); }
.header-banner h1 { font-size: 32px; margin-bottom: 10px; }
.header-banner p { font-size: 16px; opacity: 0.9; }

/* ================= DASHBOARD ================= */
.welcome-banner { 
    background: linear-gradient(135deg, #2d4f52, #1e3a3d); 
    padding: 32px; 
    border-radius: 16px; 
    color: white; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px; 
    position: relative;
    overflow: hidden;
}
.welcome-text { text-align: right; }
.welcome-text h1 { font-size: 26px; margin-bottom: 8px; font-weight: 700; }
.welcome-text p { font-size: 15px; opacity: 0.85; }
.streak-box { 
    background: rgba(255,255,255,0.12); 
    padding: 18px 28px; 
    border-radius: 14px; 
    text-align: center; 
    backdrop-filter: blur(4px);
}
.streak-number { font-size: 32px; font-weight: 800; }
.streak-number i { color: #fbbf24; margin-right: 6px; }
.streak-label { font-size: 13px; opacity: 0.8; margin-top: 4px; }

.quote-bar {
    background: rgba(255,255,255,0.08);
    padding: 14px 24px;
    border-radius: 12px;
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 15px;
    font-style: italic;
    color: rgba(255,255,255,0.9);
}
.quote-bar i { color: #fbbf24; font-size: 16px; }

/* Stats */
.stat-card { 
    background: var(--card-bg); 
    padding: 20px; 
    border-radius: 14px; 
    display: flex; 
    align-items: center; 
    gap: 16px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.06); 
    transition: 0.3s; 
    border: 1px solid var(--border);
    text-align: right;
    flex-direction: row-reverse;
    justify-content: flex-end;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.stat-card .stat-icon { 
    width: 52px; 
    height: 52px; 
    border-radius: 12px; 
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.stat-icon.icon-red { background: var(--red-light); color: var(--red); }
.stat-icon.icon-yellow { background: #fef3c7; color: #b45309; }
.stat-icon.icon-green { background: var(--green-light); color: var(--green); }
.stat-icon.icon-teal { background: var(--teal-light); color: var(--teal); }
.stat-card h3 { font-size: 26px; margin-bottom: 4px; font-weight: 800; }
.stat-card p { font-size: 13px; color: var(--text-muted); }

/* Support Cards */
.support-card {
    background: var(--card-bg);
    padding: 28px;
    border-radius: 16px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.3s;
}
.support-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-2px); }
.support-card-info { text-align: right; }
.support-card-info h3 { font-size: 20px; margin-bottom: 8px; }
.support-card-info p { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }
.support-card-icon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: white;
    flex-shrink: 0;
}

/* Progress Bars */
.progress-card {
    background: var(--card-bg);
    padding: 28px;
    border-radius: 16px;
    border: 1px solid var(--border);
}
.progress-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.progress-card-header h3 { font-size: 18px; }
.progress-card-header i { color: var(--green); font-size: 18px; }
.progress-item { margin-bottom: 20px; }
.progress-item:last-child { margin-bottom: 0; }
.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}
.progress-label span:first-child { font-weight: 700; }
.progress-bar {
    height: 10px;
    background: #e5e7eb;
    border-radius: 5px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 1s ease;
}
.progress-fill.teal { background: var(--teal); }
.progress-fill.green { background: var(--green); }
.progress-fill.yellow { background: var(--yellow); }

/* Emergency Card */
.emergency-card {
    background: linear-gradient(135deg, #c53e3e, #a03030);
    padding: 28px;
    border-radius: 16px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.3s;
}
.emergency-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(197,62,62,0.25); }
.emergency-card-info h3 { font-size: 20px; margin-bottom: 8px; }
.emergency-card-info p { opacity: 0.9; font-size: 14px; }
.emergency-card-icon {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.2);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}

/* List Items */
.list-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
}
.list-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.list-card-header h3 { font-size: 18px; }
.list-card-header i { color: var(--secondary); }

.list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    cursor: pointer;
    transition: 0.2s;
}
.list-item-icon:hover { transform: scale(1.1); }
.list-item-icon.heart-outline { background: #f3f4f6; color: var(--text-muted); }
.list-item-icon.heart-filled { background: var(--red-light); color: var(--red); }
.list-item-img {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}
.list-item-content { flex: 1; text-align: right; }
.list-item-content h4 { font-size: 15px; margin-bottom: 4px; font-weight: 700; }
.list-item-content p { font-size: 13px; color: var(--text-muted); }

/* ================= GROUP SUPPORT ================= */
.hero-banner {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 24px;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 40px;
    color: white;
}
.hero-banner-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(45,79,82,0.9), rgba(30,58,61,0.95)), url('https://images.unsplash.com/photo-1529156069898-49953e39b3ac?w=1200') center/cover;
}
.hero-banner-content {
    position: relative;
    z-index: 1;
    text-align: right;
}
.hero-banner-content h2 { font-size: 24px; margin-bottom: 8px; }
.hero-banner-content p { opacity: 0.9; font-size: 15px; }
.hero-stats {
    display: flex;
    gap: 24px;
    margin-top: 20px;
}
.hero-stat {
    text-align: center;
    background: rgba(255,255,255,0.12);
    padding: 14px 20px;
    border-radius: 12px;
    backdrop-filter: blur(4px);
}
.hero-stat h3 { font-size: 26px; font-weight: 800; }
.hero-stat p { font-size: 12px; opacity: 0.85; margin-top: 4px; }

/* Tabs */
.tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}
.tab-btn {
    padding: 12px 28px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-muted);
    background: var(--card-bg);
    border: 1px solid var(--border);
    transition: 0.2s;
    flex: 1;
    text-align: center;
}
.tab-btn.active {
    background: var(--card-bg);
    color: var(--text-main);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Group Cards */
.group-card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 24px;
    transition: 0.3s;
}
.group-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-2px); }
.group-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}
.group-card h3 { font-size: 18px; margin-bottom: 6px; }
.group-card .author { color: var(--text-muted); font-size: 14px; margin-bottom: 12px; }
.group-card .description { color: var(--text-muted); font-size: 14px; line-height: 1.6; margin-bottom: 16px; }
.group-card-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-muted);
}
.group-card-meta span { display: flex; align-items: center; gap: 6px; }
.group-card-footer {
    display: flex;
    gap: 12px;
    align-items: center;
}
.group-card-footer .chat-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: 0.2s;
}
.group-card-footer .chat-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ================= INDIVIDUAL SUPPORT ================= */
.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.category-card {
    background: var(--card-bg);
    border-radius: 14px;
    border: 1px solid var(--border);
    padding: 24px 16px;
    text-align: center;
    transition: 0.3s;
    cursor: pointer;
}
.category-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-2px); }
.category-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 12px;
    color: white;
}
.category-card h4 { font-size: 15px; font-weight: 700; }

.psych-banner {
    background: var(--purple-light);
    border: 1px solid #e9d5ff;
    border-radius: 14px;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.psych-banner-info h3 { color: var(--purple); margin-bottom: 6px; }
.psych-banner-info p { color: var(--purple); opacity: 0.8; font-size: 14px; }
.psych-banner-icon {
    width: 56px;
    height: 56px;
    background: var(--purple);
    color: white;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.doctor-card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 24px;
    transition: 0.3s;
}
.doctor-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.doctor-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}
.doctor-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 15px;
}
.doctor-rating i { color: var(--secondary); }
.doctor-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}
.doctor-avatar-img {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
}
.doctor-details h4 { font-size: 17px; margin-bottom: 4px; }
.doctor-details p { font-size: 13px; color: var(--text-muted); }
.doctor-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.doctor-actions {
    display: flex;
    gap: 12px;
}
.doctor-actions .btn-outline {
    flex: 0 0 auto;
}

/* ================= RESOURCES ================= */
.page-title {
    text-align: center;
    margin-bottom: 32px;
}
.page-title h1 { font-size: 28px; margin-bottom: 8px; }
.page-title p { color: var(--text-muted); font-size: 15px; }

.search-bar { 
    position: relative; 
    margin-bottom: 24px; 
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}
.search-bar i { 
    position: absolute; 
    right: 16px; 
    top: 50%; 
    transform: translateY(-50%);
    color: #9ca3af; 
    font-size: 18px;
}
.search-bar input { 
    width: 100%; 
    padding: 16px 16px 16px 48px; 
    border-radius: 12px; 
    border: 1px solid var(--border); 
    font-size: 15px; 
    outline: none; 
    transition: 0.2s; 
    background: var(--card-bg);
}
.search-bar input:focus { 
    border-color: var(--primary); 
    box-shadow: 0 0 0 3px rgba(74, 155, 142, 0.1); 
}

.filter-pills {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.filter-pill {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.filter-pill:hover { border-color: var(--primary); color: var(--primary); }
.filter-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.resource-card { 
    background: var(--card-bg); 
    border-radius: 16px; 
    overflow: hidden; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.06); 
    transition: 0.3s; 
    border: 1px solid var(--border);
}
.resource-card:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,0.1); }
.res-img { 
    height: 170px; 
    width: 100%; 
    position: relative;
    overflow: hidden;
}
.res-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.3s;
}
.resource-card:hover .res-img img { transform: scale(1.05); }
.res-tag {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    background: white;
    color: var(--text-main);
}
.res-content { padding: 20px; text-align: right; }
.res-content h4 { margin-bottom: 10px; font-size: 16px; line-height: 1.5; }
.res-content p { margin-bottom: 14px; font-size: 14px; color: var(--text-muted); line-height: 1.6; }
.res-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}
.res-footer a {
    color: var(--primary);
    font-weight: 700;
    font-size: 14px;
    transition: 0.2s;
}
.res-footer a:hover { color: var(--primary-dark); }
.res-stats {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
}
.res-stats span { display: flex; align-items: center; gap: 4px; }

/* ================= EVENTS ================= */
.events-banner {
    background: linear-gradient(135deg, #92400e, #b45309);
    padding: 40px;
    border-radius: 16px;
    color: white;
    text-align: center;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}
.events-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('https://images.unsplash.com/photo-1511632765486-a01980e01a18?w=1200') center/cover;
    opacity: 0.2;
}
.events-banner h2 { 
    position: relative; 
    font-size: 24px; 
    margin-bottom: 8px; 
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.events-banner p { position: relative; opacity: 0.9; font-size: 15px; }

.event-row {
    display: flex;
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid var(--border);
    margin-bottom: 20px;
    transition: 0.3s;
}
.event-row:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.event-date-block {
    width: 120px;
    background: var(--teal);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 20px;
}
.event-date-block h2 { font-size: 36px; font-weight: 800; line-height: 1; }
.event-date-block span { font-size: 14px; margin-top: 6px; }
.event-body {
    flex: 1;
    padding: 24px;
    text-align: right;
}
.event-body .badge { margin-bottom: 10px; }
.event-body h3 { font-size: 18px; margin-bottom: 10px; }
.event-body .description { color: var(--text-muted); font-size: 14px; line-height: 1.6; margin-bottom: 14px; }
.event-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-muted);
}
.event-meta span { display: flex; align-items: center; gap: 6px; }
.event-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.event-tag {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    background: #f3f4f6;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}
.event-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}
.event-progress {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 16px;
}
.event-progress-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--teal);
}

/* ================= EMERGENCY ================= */
.emergency-header-section {
    background: linear-gradient(135deg, #1f2937, #374151);
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    color: white;
    margin-bottom: 24px;
}
.emergency-header-section p { opacity: 0.8; font-size: 15px; margin-bottom: 8px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.emergency-header-section h2 { font-size: 32px; font-weight: 800; }

.panic-button-wrapper {
    text-align: center;
    margin-bottom: 32px;
}
.btn-panic-large {
    background: var(--danger);
    color: white;
    padding: 18px 48px;
    border-radius: 14px;
    font-size: 20px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.3s;
    animation: pulse 2s infinite;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    border: none;
    box-shadow: 0 4px 20px rgba(197,62,62,0.3);
}
.btn-panic-large:hover { transform: scale(1.05); }
@keyframes pulse { 
    0%, 100% { box-shadow: 0 0 0 0 rgba(197, 62, 62, 0.5); } 
    50% { box-shadow: 0 0 0 15px rgba(197, 62, 62, 0); } 
}
.panic-subtitle { color: var(--text-muted); font-size: 14px; margin-top: 12px; }

.breathe-card {
    background: linear-gradient(135deg, var(--teal), #3d8579);
    padding: 32px;
    border-radius: 16px;
    color: white;
    text-align: center;
}
.breathe-card h3 { font-size: 18px; margin-bottom: 8px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.breathe-card p { opacity: 0.9; font-size: 22px; font-weight: 700; margin: 16px 0; }
.breathe-card .breathe-sub { opacity: 0.8; font-size: 14px; cursor: pointer; transition: 0.2s; }
.breathe-card .breathe-sub:hover { opacity: 1; }

.contact-list {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 24px;
}
.contact-list h3 { font-size: 18px; margin-bottom: 16px; text-align: center; }
.contact-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    transition: 0.2s;
    text-align: right;
}
.contact-item:hover { border-color: var(--primary); }
.contact-item-info h4 { font-size: 15px; margin-bottom: 4px; }
.contact-item-info p { font-size: 13px; color: var(--text-muted); }
.contact-item-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.mood-card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 24px;
}
.mood-card h3 { font-size: 18px; margin-bottom: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.mood-textarea {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 14px;
    resize: none;
    min-height: 100px;
    font-family: inherit;
    margin-bottom: 12px;
    text-align: right;
}
.mood-textarea:focus { outline: none; border-color: var(--primary); }
.btn-purple {
    background: var(--purple);
    color: white;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 700;
    transition: 0.2s;
    font-size: 14px;
    width: 100%;
}
.btn-purple:hover { background: #7c3aed; }

.timer-card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 24px;
    text-align: center;
}
.timer-card h3 { font-size: 18px; margin-bottom: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.timer-display {
    font-size: 48px;
    font-weight: 800;
    color: var(--teal);
    font-variant-numeric: tabular-nums;
    margin: 16px 0;
    font-family: 'Courier New', monospace;
}
.timer-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }
.timer-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.sounds-card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 24px;
    margin-top: 20px;
}
.sounds-card h3 { font-size: 18px; margin-bottom: 16px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.sounds-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}
.sound-item {
    padding: 16px 8px;
    border-radius: 12px;
    border: 1px solid var(--border);
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
    font-size: 13px;
}
.sound-item:hover { border-color: var(--primary); background: var(--teal-light); }
.sound-item i { font-size: 22px; margin-bottom: 8px; display: block; }

/* ================= LOGIN ================= */
.app-container:has(#login.active) .sidebar,
.app-container:has(#signup.active) .sidebar,
.app-container:has(#login.active) .topbar,
.app-container:has(#signup.active) .topbar {
    display: none;
}
.app-container:has(#login.active) .main-content,
.app-container:has(#signup.active) .main-content {
    margin: 0;
}
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--main-bg);
    padding: 24px;
}
.login-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 48px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    text-align: center;
}
.login-logo {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, var(--teal), #3d8579);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
}
.login-card h1 { font-size: 26px; margin-bottom: 8px; }
.login-card .subtitle { color: var(--text-muted); margin-bottom: 32px; font-size: 15px; }

.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    color: var(--text-muted);
    font-size: 14px;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.form-group {
    margin-bottom: 20px;
    text-align: right;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}
.form-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 15px;
    transition: 0.2s;
    font-family: inherit;
    text-align: right;
}
.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 155, 142, 0.1);
}
.input-with-icon {
    position: relative;
}
.input-with-icon i {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}
.input-with-icon .form-input {
    padding-right: 44px;
}

.btn-dark {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    background: var(--dark);
    color: white;
    font-size: 15px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: 0.2s;
    margin-top: 8px;
}
.btn-dark:hover { background: #374151; }

.login-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    font-size: 13px;
}
.login-footer a { color: var(--text-muted); transition: 0.2s; }
.login-footer a:hover { color: var(--primary); }
.login-footer a.signup-link { color: var(--dark); font-weight: 700; }

/* ================= TOAST NOTIFICATIONS ================= */
.toast-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: var(--dark);
    color: white;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: toastSlide 0.3s ease;
    min-width: 260px;
    max-width: 360px;
}
.toast.toast-success { background: var(--green); }
.toast.toast-error { background: var(--red); }
.toast.toast-info { background: var(--blue); }
.toast.toast-warning { background: var(--orange); }
@keyframes toastSlide {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ================= NOTIFICATION DROPDOWN ================= */
.notif-wrapper { position: relative; }
.notif-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    border: 1px solid var(--border);
    width: 320px;
    z-index: 50;
    overflow: hidden;
    animation: fadeIn 0.2s ease;
}
.notif-dropdown.active { display: block; }
.notif-header {
    padding: 14px 18px;
    font-weight: 700;
    font-size: 15px;
    border-bottom: 1px solid var(--border);
    text-align: right;
}
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: 0.2s;
    text-align: right;
}
.notif-item:hover { background: #f9fafb; }
.notif-item.unread { background: #f0f9ff; }
.notif-item.unread:hover { background: #e0f2fe; }
.notif-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}
.notif-body { flex: 1; }
.notif-body p { font-size: 13px; margin-bottom: 4px; line-height: 1.4; }
.notif-time { font-size: 12px; color: var(--text-muted); }

/* ================= GROUP TABS & REVIEWS ================= */
.group-tab-content { display: none; animation: fadeIn 0.3s ease; }
.group-tab-content.active { display: block; }
.review-card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 24px;
    transition: 0.3s;
}
.review-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.review-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}
.review-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--teal);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}
.review-stars { color: var(--secondary); font-size: 13px; margin-top: 4px; }
.review-text { font-size: 14px; line-height: 1.7; color: var(--text-main); margin-bottom: 12px; }
.review-date { font-size: 12px; color: var(--text-muted); }

/* ================= ACTIVE STATES ================= */
.sound-item.active {
    border-color: var(--primary);
    background: var(--teal-light);
    color: var(--primary);
    font-weight: 700;
}
.heart-stat { cursor: pointer; transition: 0.2s; }
.heart-stat:hover { color: var(--red); }
.heart-stat.liked { color: var(--red); }
.heart-stat.liked i { font-weight: 900; }

/* ================= MOBILE MENU ================= */
.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #f3f4f6;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    font-size: 18px;
    border: none;
    cursor: pointer;
}
.mobile-menu-btn:hover { background: var(--primary); color: white; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9;
    opacity: 0;
    transition: opacity 0.3s;
}
.sidebar-overlay.active { display: block; opacity: 1; }

.sidebar-close {
    display: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    border: none;
    cursor: pointer;
    margin-right: auto;
}
.sidebar-close:hover { background: rgba(255,255,255,0.2); }

/* ================= CHECK-IN ================= */
.checkin-streak {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: center;
}
.checkin-streak i {
    font-size: 40px;
    color: var(--orange);
}
.checkin-streak h3 {
    font-size: 36px;
    font-weight: 800;
}
.checkin-streak p {
    color: var(--text-muted);
    font-size: 14px;
}
.mood-selector {
    display: flex;
    justify-content: center;
    gap: 12px;
}
.mood-btn {
    font-size: 32px;
    background: #f3f4f6;
    border: 2px solid transparent;
    border-radius: 12px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}
.mood-btn:hover {
    transform: scale(1.1);
    background: #e5e7eb;
}
.mood-btn.active {
    border-color: var(--primary);
    background: var(--teal-light);
    transform: scale(1.1);
}
.urge-slider-wrapper {
    padding: 10px 0;
}
.urge-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 8px;
    border-radius: 4px;
    background: #e5e7eb;
    outline: none;
}
.urge-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--orange);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.urge-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ================= ACHIEVEMENTS ================= */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.achievement-card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 28px;
    text-align: center;
    transition: 0.3s;
}
.achievement-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}
.achievement-card.locked {
    opacity: 0.5;
    filter: grayscale(1);
}
.achievement-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 16px;
}
.achievement-card h4 {
    font-size: 16px;
    margin-bottom: 6px;
}
.achievement-card p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.achievement-progress {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}
.achievement-progress-fill {
    height: 100%;
    background: var(--secondary);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* ================= CHAT ================= */
.chat-layout {
    display: flex;
    gap: 20px;
    height: calc(100vh - 140px);
    min-height: 500px;
}
.chat-sidebar {
    width: 240px;
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 20px;
    flex-shrink: 0;
}
.chat-sidebar h3 {
    font-size: 16px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.chat-channel {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.chat-channel:hover {
    background: #f9fafb;
}
.chat-channel.active {
    background: var(--teal-light);
    color: var(--teal);
    font-weight: 700;
}
.chat-main {
    flex: 1;
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.chat-message {
    display: flex;
    gap: 12px;
    max-width: 80%;
}
.chat-message.own {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.chat-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--teal);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.chat-message-body {
    background: #f3f4f6;
    padding: 12px 16px;
    border-radius: 14px;
    border-bottom-right-radius: 4px;
}
.chat-message.own .chat-message-body {
    background: var(--teal);
    color: white;
    border-bottom-right-radius: 14px;
    border-bottom-left-radius: 4px;
}
.chat-message-author {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-main);
}
.chat-message.own .chat-message-author {
    color: rgba(255,255,255,0.9);
}
.chat-message-text {
    font-size: 14px;
    line-height: 1.5;
}
.chat-message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}
.chat-message.own .chat-message-time {
    color: rgba(255,255,255,0.7);
}
.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
}
.chat-input-area input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 14px;
    outline: none;
    font-family: inherit;
}
.chat-input-area input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 155, 142, 0.1);
}

/* ================= PROFILE ================= */
.profile-header {
    position: relative;
    margin-bottom: 24px;
}
.profile-cover {
    height: 160px;
    background: linear-gradient(135deg, var(--teal), #3d8579);
    border-radius: 16px;
}
.profile-info {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    padding: 0 24px;
    margin-top: -50px;
    position: relative;
}
.user-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    border: 4px solid var(--card-bg);
    flex-shrink: 0;
}
.profile-details {
    flex: 1;
    padding-bottom: 10px;
}
.profile-details h2 {
    font-size: 24px;
    margin-bottom: 4px;
}

/* ================= SETTINGS ================= */
.settings-section {
    padding: 24px;
    margin-bottom: 20px;
}
.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.settings-row:last-child {
    border-bottom: none;
}
.settings-info h4 {
    font-size: 15px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    display: inline-block;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #e5e7eb;
    border-radius: 26px;
    transition: 0.3s;
}
.toggle-slider:before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}
.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* Checkin history */
.checkin-history-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.checkin-history-item:last-child {
    border-bottom: none;
}
.checkin-history-date {
    font-size: 13px;
    color: var(--text-muted);
    width: 80px;
    flex-shrink: 0;
}
.checkin-history-mood {
    font-size: 24px;
}
.checkin-history-note {
    flex: 1;
    font-size: 14px;
    color: var(--text-main);
    text-align: right;
}

/* Dark mode */
body.dark-mode {
    --main-bg: #111827;
    --card-bg: #1f2937;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --border: #374151;
    --sidebar-bg: #1a1f2e;
}
body.dark-mode .topbar,
body.dark-mode .login-card,
body.dark-mode .chat-sidebar,
body.dark-mode .chat-main,
body.dark-mode .notif-dropdown {
    background: #1f2937;
}
body.dark-mode .form-input,
body.dark-mode .chat-input-area input,
body.dark-mode .mood-textarea,
body.dark-mode .search-bar input {
    background: #111827;
    border-color: #374151;
    color: #f3f4f6;
}
body.dark-mode .login-page {
    background: #111827;
}
body.dark-mode .icon-btn,
body.dark-mode .mobile-menu-btn {
    background: #374151;
    color: #f3f4f6;
}
body.dark-mode .chat-message-body {
    background: #374151;
}
body.dark-mode .chat-message.own .chat-message-body {
    background: var(--teal);
}
body.dark-mode .nav-item {
    color: #9ca3af;
}
body.dark-mode .nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: #f3f4f6;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .category-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
    .sidebar { width: 260px; }
    .welcome-banner { flex-direction: column; gap: 20px; text-align: center; }
    .sounds-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    /* Layout */
    .app-container { height: auto; min-height: 100vh; overflow: visible; }
    .main-content { overflow-y: visible; }
    
    /* Sidebar Mobile Drawer */
    .mobile-menu-btn { display: flex; }
    .sidebar-close { display: flex; }
    .sidebar { 
        position: fixed; 
        top: 0;
        right: 0;
        bottom: 0;
        transform: translateX(100%); 
        z-index: 100; 
        width: 85%;
        max-width: 300px; 
        box-shadow: -4px 0 20px rgba(0,0,0,0.2);
        transition: transform 0.3s ease;
    }
    .sidebar.active { transform: translateX(0); }
    .sidebar-header { padding: 16px; }
    
    /* Topbar */
    .topbar { padding: 0 16px; height: 56px; }
    .topbar-right { gap: 10px; }
    .icon-btn { width: 36px; height: 36px; font-size: 14px; }
    .lang-switch { padding: 6px 10px; font-size: 12px; }
    
    /* Content */
    .content-wrapper { padding: 16px; max-width: 100%; }
    
    /* Grids */
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; gap: 14px; }
    
    /* Typography */
    h1 { font-size: 20px; }
    h2 { font-size: 18px; }
    h3 { font-size: 16px; }
    .welcome-text h1 { font-size: 22px; }
    .header-banner h1 { font-size: 24px; }
    .header-banner { padding: 28px 20px; }
    .header-banner p { font-size: 14px; }
    
    /* Welcome Banner */
    .welcome-banner { padding: 24px 20px; }
    .streak-box { padding: 14px 20px; }
    .streak-number { font-size: 26px; }
    .quote-bar { font-size: 13px; padding: 12px 16px; }
    
    /* Stats */
    .stat-card { 
        padding: 16px; 
        flex-direction: row !important; 
        justify-content: flex-start !important;
        gap: 14px;
    }
    .stat-card .stat-icon { width: 48px; height: 48px; font-size: 20px; }
    .stat-card h3 { font-size: 22px; }
    
    /* Support Cards */
    .support-card { padding: 22px; gap: 14px; }
    .support-card-info h3 { font-size: 18px; }
    .support-card-info p { font-size: 13px; }
    .support-card-icon { width: 52px; height: 52px; font-size: 22px; }
    
    /* Progress Card */
    .progress-card { padding: 22px; }
    .progress-label { font-size: 13px; }
    
    /* Emergency Card */
    .emergency-card { padding: 22px; }
    .emergency-card-info h3 { font-size: 18px; }
    .emergency-card-icon { width: 52px; height: 52px; font-size: 22px; }
    
    /* List Cards */
    .list-card { padding: 18px; }
    .list-item { padding: 12px 0; gap: 12px; }
    .list-item-img { width: 48px; height: 48px; }
    .list-item-content h4 { font-size: 14px; }
    
    /* Group Support */
    .hero-banner { padding: 28px 20px; min-height: auto; }
    .hero-banner-content h2 { font-size: 20px; }
    .hero-stats { gap: 12px; }
    .hero-stat { padding: 12px 16px; }
    .hero-stat h3 { font-size: 22px; }
    .tabs { gap: 8px; }
    .tab-btn { padding: 10px 18px; font-size: 13px; }
    .group-card { padding: 20px; }
    .group-card h3 { font-size: 16px; }
    .group-card-meta { flex-wrap: wrap; gap: 10px; font-size: 12px; }
    .group-card-footer { flex-wrap: wrap; }
    .group-card-footer .chat-btn { width: 40px; height: 40px; }
    
    /* Individual Support */
    .category-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .category-card { padding: 18px 12px; }
    .category-card-icon { width: 48px; height: 48px; font-size: 20px; }
    .category-card h4 { font-size: 13px; }
    .psych-banner { padding: 20px; flex-direction: column; text-align: center; gap: 14px; }
    .doctor-card { padding: 20px; }
    .doctor-avatar-img { width: 52px; height: 52px; }
    .doctor-details h4 { font-size: 15px; }
    .doctor-meta { flex-wrap: wrap; gap: 10px; }
    .doctor-actions { flex-direction: row; }
    .doctor-actions .btn-outline,
    .doctor-actions .btn-primary { padding: 10px 16px; font-size: 13px; }
    
    /* Resources */
    .page-title { margin-bottom: 24px; }
    .page-title h1 { font-size: 22px; }
    .search-bar input { padding: 14px 14px 14px 44px; font-size: 14px; }
    .filter-pills { gap: 8px; margin-bottom: 20px; }
    .filter-pill { padding: 8px 14px; font-size: 13px; }
    .resource-card .res-img { height: 140px; }
    .res-content { padding: 16px; }
    .res-content h4 { font-size: 15px; }
    .res-content p { font-size: 13px; }
    
    /* Events */
    .events-banner { padding: 28px 20px; }
    .events-banner h2 { font-size: 20px; }
    .event-row { flex-direction: column; }
    .event-date-block { 
        width: 100%; 
        flex-direction: row; 
        gap: 8px; 
        padding: 14px; 
        justify-content: center;
    }
    .event-date-block h2 { font-size: 28px; }
    .event-body { padding: 18px; }
    .event-body h3 { font-size: 16px; }
    .event-meta { flex-wrap: wrap; gap: 10px; font-size: 12px; }
    .event-tags { gap: 6px; }
    .event-tag { font-size: 11px; padding: 4px 10px; }
    .event-actions { flex-wrap: wrap; }
    .event-actions button { flex: 1; min-width: 120px; }
    
    /* Emergency */
    .emergency-header-section { padding: 28px 20px; }
    .emergency-header-section h2 { font-size: 24px; }
    .btn-panic-large { padding: 16px 32px; font-size: 16px; }
    .breathe-card { padding: 24px 20px; }
    .contact-list { padding: 20px; }
    .contact-item { padding: 14px; flex-direction: column; text-align: center; gap: 10px; }
    .contact-item-icon { width: 44px; height: 44px; font-size: 18px; }
    .timer-display { font-size: 36px; }
    .mood-card { padding: 20px; }
    .mood-textarea { min-height: 80px; }
    .sounds-card { padding: 20px; }
    .sounds-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .sound-item { padding: 14px 6px; font-size: 12px; }
    .sound-item i { font-size: 18px; }
    
    /* Login */
    .login-page { padding: 16px; }
    .login-card { padding: 32px 20px; border-radius: 16px; }
    .login-logo { width: 72px; height: 72px; font-size: 28px; }
    .login-card h1 { font-size: 22px; }
    .form-input { padding: 12px 14px; font-size: 14px; }
    .btn-google { padding: 12px; font-size: 14px; }
    .btn-dark { padding: 12px; font-size: 14px; }
    .login-footer { flex-direction: column; gap: 10px; text-align: center; }
    
    /* Check-in */
    .mood-selector { gap: 8px; }
    .mood-btn { width: 50px; height: 50px; font-size: 26px; }
    
    /* Achievements */
    .achievements-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .achievement-card { padding: 20px; }
    .achievement-icon { width: 52px; height: 52px; font-size: 22px; }
    
    /* Chat */
    .chat-layout { flex-direction: column; height: auto; min-height: 400px; }
    .chat-sidebar { width: 100%; display: flex; gap: 8px; overflow-x: auto; padding: 12px; }
    .chat-sidebar h3 { display: none; }
    .chat-channel { white-space: nowrap; margin-bottom: 0; font-size: 13px; padding: 10px 14px; }
    .chat-main { min-height: 400px; }
    
    /* Profile */
    .profile-info { flex-direction: column; align-items: center; text-align: center; gap: 12px; }
    .profile-details h2 { font-size: 20px; }
    .user-avatar-large { width: 80px; height: 80px; font-size: 28px; }
    
    /* Settings */
    .settings-row { flex-direction: column; align-items: flex-start; gap: 10px; }
}

@media (max-width: 480px) {
    .content-wrapper { padding: 12px; }
    
    .welcome-banner { padding: 20px 16px; border-radius: 12px; }
    .welcome-text h1 { font-size: 18px; }
    .streak-number { font-size: 22px; }
    .streak-box { padding: 12px 16px; }
    .quote-bar { font-size: 12px; padding: 10px 12px; }
    
    .stat-card { padding: 14px; }
    .stat-card .stat-icon { width: 44px; height: 44px; font-size: 18px; }
    .stat-card h3 { font-size: 20px; }
    
    .grid-4, .grid-3, .grid-2 { gap: 12px; }
    
    .support-card { padding: 18px; border-radius: 12px; }
    .support-card-info h3 { font-size: 16px; }
    .support-card-icon { width: 48px; height: 48px; font-size: 20px; border-radius: 12px; }
    
    .card { padding: 18px; border-radius: 12px; }
    .progress-card { padding: 18px; }
    .emergency-card { padding: 18px; border-radius: 12px; }
    
    .list-card { padding: 16px; border-radius: 12px; }
    .list-item { gap: 10px; }
    .list-item-img { width: 44px; height: 44px; border-radius: 8px; }
    
    .category-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .category-card { padding: 16px 10px; border-radius: 12px; }
    .category-card-icon { width: 44px; height: 44px; font-size: 18px; border-radius: 12px; }
    
    .hero-banner { border-radius: 12px; padding: 24px 16px; }
    .hero-stats { gap: 10px; }
    .hero-stat { padding: 10px 14px; border-radius: 10px; }
    .hero-stat h3 { font-size: 20px; }
    .hero-stat p { font-size: 11px; }
    
    .group-card { padding: 18px; border-radius: 12px; }
    .group-card-footer .btn-primary { font-size: 13px; padding: 10px 16px; }
    
    .doctor-card { padding: 18px; border-radius: 12px; }
    .doctor-actions { flex-direction: column; }
    .doctor-actions .btn-outline,
    .doctor-actions .btn-primary { width: 100%; }
    
    .resource-card { border-radius: 12px; }
    .resource-card .res-img { height: 120px; }
    .res-tag { font-size: 11px; padding: 4px 10px; }
    .res-content { padding: 14px; }
    .res-content h4 { font-size: 14px; }
    
    .event-date-block { padding: 12px; }
    .event-date-block h2 { font-size: 24px; }
    .event-body { padding: 16px; }
    .event-body h3 { font-size: 15px; }
    .event-actions { flex-direction: column; }
    .event-actions button { width: 100%; }
    
    .btn-panic-large { padding: 14px 24px; font-size: 15px; border-radius: 12px; }
    .breathe-card { border-radius: 12px; padding: 20px 16px; }
    .timer-card { border-radius: 12px; padding: 18px; }
    .timer-display { font-size: 32px; }
    .contact-list { border-radius: 12px; padding: 18px; }
    .mood-card { border-radius: 12px; padding: 18px; }
    .sounds-card { border-radius: 12px; padding: 18px; }
    .sounds-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .sound-item { padding: 12px 4px; font-size: 11px; border-radius: 10px; }
    
    .filter-pill { padding: 8px 12px; font-size: 12px; border-radius: 8px; }
    .tab-btn { padding: 10px 14px; font-size: 12px; border-radius: 8px; }
    
    .btn-primary, .btn-outline, .btn-danger, .btn-gold { 
        padding: 10px 18px; 
        font-size: 13px; 
        border-radius: 8px; 
    }
    
    .login-card { padding: 24px 16px; }
    .login-logo { width: 64px; height: 64px; font-size: 24px; }
    .login-card h1 { font-size: 20px; }
    .form-group { margin-bottom: 16px; }
    .form-input { padding: 12px; }
    
    /* Achievements mobile */
    .achievements-grid { grid-template-columns: 1fr; }
    
    /* Profile mobile */
    .profile-cover { height: 100px; }
    .user-avatar-large { width: 64px; height: 64px; font-size: 24px; }
}
