/* ANDROID STATUS BAR FIX – RELIABLE */
.app-root {
  padding-top: 36px;   /* ← this is the key */
  box-sizing: border-box;
}

:root {
    --primary: #4f46e5;
    --primary-gradient: linear-gradient(90deg, #4f46e5 0%, #9333ea 100%);
    --plus-gradient: linear-gradient(90deg, #d97706 0%, #fbbf24 100%); /* Gold for Plus */
    --bg-gradient: linear-gradient(135deg, #e0e7ff 0%, #f3e8ff 50%, #fce7f3 100%);
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --card-bg: #ffffff;
    --bg-secondary: #f9fafb;
    --radius: 16px;
    --border-color: #e5e7eb;
    --btn-bg-red: #fee2e2;
    --badge-bg: #eef2ff;
    --nav-hover: #f3f4f6;
    --input-bg: #fff;
    --input-border: #f3f4f6;
    --chat-own-bg: #e0e7ff;
    --chat-other-bg: #f3f4f6;
}

[data-theme="dark"] {
    --primary: #818cf8;
    --primary-gradient: linear-gradient(90deg, #6366f1 0%, #a855f7 100%);
    --plus-gradient: linear-gradient(90deg, #b45309 0%, #f59e0b 100%);
    --bg-gradient: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --card-bg: #1f2937;
    --bg-secondary: #374151;
    --border-color: #4b5563;
    --btn-bg-red: #7f1d1d;
    --badge-bg: #312e81;
    --nav-hover: #374151;
    --input-bg: #374151;
    --input-border: #4b5563;
    --chat-own-bg: #312e81;
    --chat-other-bg: #374151;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    padding: 20px;
    transition: background 0.3s, color 0.3s;
}
.container { max-width: 1200px; margin: 0 auto; }

/* ANIMATIONS */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.animate-slide-down { animation: slideUp 0.6s ease-out forwards; opacity: 0; }
.animate-pop { animation: fadeIn 0.4s ease-out; }

.staggered-anim {
    opacity: 0;
    animation: slideUp 0.5s ease-out forwards;
}

/* LIVE BADGE */
.live-badge {
    font-size: 0.7rem;
    color: #16a34a; /* Green */
    background: #dcfce7;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid #bbf7d0;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    animation: pulse 2s infinite;
}
.live-badge::before {
    content: '';
    display: block;
    width: 6px; height: 6px;
    background: #16a34a;
    border-radius: 50%;
}
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* TIMELINE STYLES (New for Calendar) */
.timeline {
    position: relative;
    padding-left: 20px;
    margin-top: 10px;
}
.timeline::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 6px;
    width: 2px;
    background: var(--border-color);
}
.timeline-item {
    position: relative;
    margin-bottom: 12px;
}
.timeline-item::before {
    content: '';
    position: absolute;
    top: 15px; left: -19px;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    border: 2px solid var(--card-bg);
    z-index: 1;
}
.timeline-item.focus-session::before { background: #3b82f6; } /* Blue for focus */
.timeline-item.break-session::before { background: #f59e0b; } /* yellow for break */
.timeline-item.event-google::before { background: #8213ea; } /* perpol for GCal */
.timeline-item.vaishnav-item {
    border-left-color: #f97316; 
}

.timeline-card {
    background: var(--bg-secondary);
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}
.timeline-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 4px;
}
.timeline-title { font-weight: 600; font-size: 0.95rem; }
.timeline-time { font-size: 0.8rem; color: var(--text-muted); }
.timeline-duration { font-size: 0.8rem; color: var(--primary); font-weight: 500; }

/* AUTH */
.auth-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    display: flex; justify-content: center; align-items: center;
    z-index: 9999;
    padding: 20px;
}
.auth-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    width: 100%; max-width: 400px;
    text-align: center;
}
.auth-tabs {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 4px;
    display: flex;
    margin-bottom: 24px;
}
.auth-tab {
    flex: 1; padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.3s;
}
.auth-tab.active { background: var(--card-bg); color: var(--primary); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }

.input-group { margin-bottom: 16px; }
.input-group input {
    width: 100%; padding: 14px;
    border: 2px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-main);
    border-radius: 12px;
    font-size: 1rem;
    outline: none; transition: border-color 0.2s;
}
.input-group input:focus { border-color: var(--primary); }
.auth-submit-btn {
    width: 100%; padding: 14px;
    background: var(--primary);
    color: white; border: none;
    border-radius: 12px;
    font-size: 1rem; font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.auth-submit-btn:hover { opacity: 0.9; }

/* GOOGLE LOGIN */
.google-btn {
    width: 100%; padding: 12px;
    background: var(--input-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.95rem; font-weight: 500;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: background 0.2s;
}
.google-btn:hover { background: var(--bg-secondary); }
.google-btn img { width: 18px; height: 18px; }

.link-text { color: var(--primary); text-decoration: none; font-weight: 500; }
.link-text:hover { text-decoration: underline; }

.error-msg { color: #ef4444; margin-top: 10px; font-size: 0.9rem; }

/* HEADER & NAV */
header { margin-bottom: 32px; }
h1 {
    font-size: 2.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    display: inline-block;
}
h1.plus-mode {
    background: var(--plus-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle { color: var(--text-muted); font-size: 1rem; }
nav {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 8px; margin-bottom: 24px;
    display: flex; gap: 8px; overflow-x: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    scrollbar-width: none; 
}
nav::-webkit-scrollbar { display: none; }

.nav-btn {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 24px; border: none; border-radius: 12px;
    background: transparent; cursor: pointer;
    font-size: 1rem; color: var(--text-muted);
    white-space: nowrap;
    transition: all 0.2s;
}
.nav-btn:hover { background: var(--nav-hover); }
.nav-btn.active { background: var(--primary-gradient); color: white; box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2); }

/* CARDS & DASHBOARD LAYOUT */
.tab-content { display: none; }
.tab-content.active { display: block; }

.card { background: var(--card-bg); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }

/* Dashboard Grids */
.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dashboard-grid-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

/* Updated Stat Card Style */
.stat-card { 
    background: var(--card-bg); 
    border-radius: 20px; 
    padding: 24px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.05); 
    border: 1px solid var(--border-color);
    display: flex; 
    flex-direction: column; 
    align-items: flex-start;
}
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: white; font-size: 1.2rem; margin-bottom: 12px; }
.stat-icon-small { 
    width: 36px; height: 36px; 
    border-radius: 10px; 
    display: flex; align-items: center; justify-content: center; 
    color: white; font-size: 1.1rem; 
    margin-bottom: 12px;
}
.stat-icon-small.blue { background: #3b82f6; }
.stat-icon-small.purple { background: #a855f7; }
.stat-icon-small.orange { background: #f97316; }
.stat-icon-small.green { background: #10b981; }

.stat-label { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 6px; font-weight: 500; }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--text-main); }

.chart-card h3 { font-size: 1rem; margin-bottom: 16px; font-weight: 600; color: var(--text-main); }
.chart-container { position: relative; height: 300px; width: 100%; }
.chart-container.pie-container { display: flex; justify-content: center; }
.chart-container.wide { height: 250px; }


/* TIMER */
.timer-container { max-width: 700px; margin: 0 auto; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; } /* Legacy grid for Timer */
.mode-selector { display: flex; gap: 16px; margin-bottom: 16px; }
.mode-btn {
    flex: 1; padding: 12px; border: none; border-radius: 12px;
    cursor: pointer; background: var(--bg-secondary); color: var(--text-muted);
    font-size: 1rem; display: flex; justify-content: center; align-items: center; gap: 8px;
}
.mode-btn.active { color: white; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.mode-btn.pomodoro.active { background: linear-gradient(90deg, #ef4444, #f97316); }
.mode-btn.stopwatch.active { background: linear-gradient(90deg, #3b82f6, #06b6d4); }
.timer-settings { display: flex; gap: 20px; margin-bottom: 24px; justify-content: center; flex-wrap: wrap; }
.setting-group { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.setting-group label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.pomodoro-info { background: var(--bg-secondary); border-radius: 12px; padding: 16px; margin-bottom: 30px; }
.pomodoro-header { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--text-muted); font-weight: 500;}
.progress-bar { height: 8px; background: var(--border-color); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; transition: width 1s linear; background: linear-gradient(90deg, #ef4444, #f97316); }
.progress-fill.break { background: linear-gradient(90deg, #10b981, #059669); }
.timer-display { text-align: center; margin: 40px 0; }
.timer-time { font-size: 5rem; font-family: 'Courier New', monospace; font-weight: 700; background: linear-gradient(90deg, #4f46e5, #9333ea); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.timer-controls { display: flex; justify-content: center; gap: 16px; }
.btn-control { padding: 16px 32px; border: none; border-radius: 12px; font-size: 1.1rem; cursor: pointer; color: white; transition: transform 0.1s; }
.btn-control:active { transform: scale(0.98); }
.btn-start { background: linear-gradient(90deg, #10b981, #059669); }
.btn-pause { background: linear-gradient(90deg, #f97316, #ef4444); }
.btn-reset { background: var(--bg-secondary); color: var(--text-main); border: 1px solid var(--border-color); }

.group-input { flex: 1; padding: 10px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--text-main); border-radius: 8px; outline: none; }
.group-input:focus { border-color: var(--primary); }
.group-input:disabled { background: var(--bg-secondary); color: var(--text-muted); cursor: not-allowed; }


/* --- ANALOG CLOCK STYLES --- */
.timer-display {
    display: flex;
    justify-content: center;
    margin: 30px 0;
    position: relative;
}

.analog-clock-container {
    position: relative;
    width: 320px;
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clock-face {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg-secondary);
    box-shadow: 
        inset 5px 5px 10px rgba(0,0,0,0.05), 
        inset -5px -5px 10px rgba(255,255,255,0.8),
        10px 10px 20px rgba(0,0,0,0.05),
        -10px -10px 20px rgba(255,255,255,0.8);
    position: relative;
    border: 8px solid var(--card-bg);
}

[data-theme="dark"] .clock-face {
    box-shadow: 
        inset 5px 5px 10px rgba(0,0,0,0.3), 
        inset -5px -5px 10px rgba(255,255,255,0.05),
        10px 10px 20px rgba(0,0,0,0.3),
        -10px -10px 20px rgba(255,255,255,0.05);
}

/* Markers */
.marker {
    position: absolute;
    background: var(--text-muted);
    border-radius: 4px;
}
.marker.twelve { top: 15px; left: 50%; width: 6px; height: 15px; transform: translateX(-50%); }
.marker.six { bottom: 15px; left: 50%; width: 6px; height: 15px; transform: translateX(-50%); }
.marker.three { right: 15px; top: 50%; width: 15px; height: 6px; transform: translateY(-50%); }
.marker.nine { left: 15px; top: 50%; width: 15px; height: 6px; transform: translateY(-50%); }

/* Hands */
.hand {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform-origin: bottom center;
    border-radius: 10px;
    z-index: 2;
    transition: transform 0.5s cubic-bezier(0.4, 2.08, 0.55, 0.44); /* Bouncy tick effect */
}

.min-hand {
    width: 6px;
    height: 90px;
    background: var(--text-main);
    transform: translateX(-50%) rotate(0deg);
}

.sec-hand {
    width: 2px;
    height: 110px;
    background: #ef4444; /* Red seconds hand */
    transform: translateX(-50%) rotate(0deg);
    z-index: 3;
}

.center-nut {
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    border: 3px solid var(--card-bg);
}

/* Position Digital Text Inside */
.timer-time {
    position: absolute;
    top: 55%; /* Push slightly down to clear center nut */
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.5rem; /* Slightly smaller to fit */
    z-index: 1;
    text-shadow: 0 2px 10px rgba(0,0,0,0.1);
    background: transparent;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: var(--text-main); /* Fallback to solid color for readability */
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .analog-clock-container { width: 260px; height: 260px; }
    .timer-time { font-size: 2.8rem; }
    .min-hand { height: 70px; }
    .sec-hand { height: 90px; }
}

/* CALENDAR & EVENTS */
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.calendar-cell { aspect-ratio: 1; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 0.9rem; position: relative; cursor: pointer; transition: transform 0.1s; }
.calendar-cell:hover { transform: scale(1.05); background: var(--nav-hover); }
.calendar-cell.header { font-weight: 600; color: var(--text-muted); background: transparent; aspect-ratio: auto; padding-bottom: 8px; cursor: default; }
.calendar-cell.header:hover { transform: none; }
.calendar-cell.today { border: 2px solid var(--primary); }
.calendar-cell.inactive { opacity: 0.3; }
.intensity-0 { background: var(--bg-secondary); }
.intensity-1 { background: #bbf7d0; } 
.intensity-2 { background: #86efac; }
.intensity-3 { background: #4ade80; }
.intensity-4 { background: #22c55e; } 
.intensity-5 { background: #16a34a; }

/* EVENT MARKERS */
.calendar-dots {
    position: absolute; bottom: 4px; left: 0; right: 0;
    display: flex; justify-content: center; gap: 3px;
    padding: 0 2px;
}
.dot { width: 6px; height: 6px; border-radius: 50%; }
.dot.meeting { background: #3b82f6; } 
.dot.holiday { background: #ef4444; }
.dot.vaishnav { background: #f97316; } 

.event-item {
    padding: 12px; background: var(--bg-secondary);
    border-radius: 8px; margin-bottom: 8px; border-left: 4px solid var(--primary);
}
.event-item.holiday-item { border-left-color: #ef4444; }
.event-time { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 2px; }
.event-item.vaishnav-item { border-left-color: #f97316; }

/* DARK MODE OVERRIDES */
[data-theme="dark"] .intensity-0 { background: #374151; }
[data-theme="dark"] .intensity-1 { background: #064e3b; }
[data-theme="dark"] .intensity-2 { background: #065f46; }
[data-theme="dark"] .intensity-3 { background: #047857; }
[data-theme="dark"] .intensity-4 { background: #059669; }
[data-theme="dark"] .intensity-5 { background: #10b981; }


/* ... Previous CSS ... */

/* PROFILE AVATAR */
.profile-avatar-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 16px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid var(--primary);
}

.profile-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.7rem;
    padding: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.profile-avatar-container:hover .avatar-overlay {
    opacity: 1;
}

/* LEADERBOARD AVATAR */
.leaderboard-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
    border: 1px solid var(--border-color);
}

/* ... Rest of CSS ... */



/* GROUPS & TABS */
.groups-layout { display: grid; grid-template-columns: 1fr 2fr; gap: 24px; }
.group-item { padding: 16px; background: var(--bg-secondary); border-radius: 12px; margin-bottom: 12px; cursor: pointer; transition: all 0.2s; border: 1px solid transparent; }
.group-item:hover { border-color: var(--primary); }
.group-item.active { background: var(--primary-gradient); color: white; }

.group-tabs { 
    display: flex; 
    gap: 8px; 
    background: var(--bg-secondary); 
    padding: 4px; 
    border-radius: 12px;
    margin-bottom: 16px; 
}
.group-tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}
.group-tab-btn.active {
    background: var(--card-bg);
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.leaderboard-filters { display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--border-color); padding-bottom: 16px; flex-wrap: wrap; }
.filter-btn { border: none; background: transparent; padding: 6px 12px; border-radius: 20px; cursor: pointer; color: var(--text-muted); font-size: 0.9rem; transition: all 0.2s; }
.filter-btn:hover { background: var(--bg-secondary); }
.filter-btn.active { background: var(--primary); color: white; }
.leaderboard-item { display: flex; align-items: center; padding: 16px; background: var(--bg-secondary); border-radius: 12px; margin-bottom: 12px; gap: 16px; }
.leaderboard-item.me { border: 2px solid var(--primary); background: var(--badge-bg); }

/* CHAT */
.chat-container { display: flex; flex-direction: column; height: 500px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 10px; background: var(--bg-secondary); border-radius: 12px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 12px; }
.chat-message { max-width: 80%; padding: 10px 14px; border-radius: 12px; position: relative; }
.chat-message.own { align-self: flex-end; background: var(--chat-own-bg); border-bottom-right-radius: 2px; }
.chat-message.other { align-self: flex-start; background: var(--chat-other-bg); border-bottom-left-radius: 2px; }
.chat-sender { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 2px; }
.chat-text { font-size: 0.95rem; line-height: 1.4; }
.chat-time { font-size: 0.7rem; color: var(--text-muted); text-align: right; margin-top: 4px; }
.chat-input-area { display: flex; gap: 8px; }
.chat-reactions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; align-items: center; }

/* 🟢 FIX 1: Align reactions to the right for own messages */
.chat-message.own .chat-reactions {
    justify-content: flex-end;
}

/* Reactions */
.reaction-pill { 
    background: rgba(255,255,255,0.6); 
    border: 1px solid var(--border-color); 
    border-radius: 12px; 
    padding: 2px 8px; 
    font-size: 0.75rem; 
    cursor: pointer; 
    display: inline-flex; align-items: center; gap: 3px;
    transition: all 0.2s;
}
.reaction-pill:hover { background: rgba(255,255,255,0.9); border-color: var(--primary); transform: scale(1.05); }

/* Add Reaction Button */
.reaction-add-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}
.reaction-add-btn:hover { background: var(--nav-hover); color: var(--primary); }

/* Reaction Menu (Popover) - HIDDEN BY DEFAULT */
.reaction-menu {
    position: absolute;
    bottom: 30px; left: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 6px;
    display: none; /* Changed from hover display */
    flex-direction: row;
    gap: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 100;
    white-space: nowrap;
}

/* 🟢 FIX 2: Anchor menu to right for own messages (prevents cutoff) */
.chat-message.own .reaction-menu {
    left: auto;
    right: 0;
}

/* Toggle Class */
.reaction-menu.show {
    display: flex;
}

.reaction-option {
    font-size: 1.2rem;
    padding: 4px;
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.2s;
}
.reaction-option:hover { transform: scale(1.2); background: var(--bg-secondary); }
.reaction-option.plus-only { background: var(--plus-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: bold; }

/* SETTINGS GROUP */
.settings-section { margin-bottom: 20px; }
.settings-section label { display: block; font-size: 0.9rem; font-weight: 500; color: var(--text-muted); margin-bottom: 8px; }
.copy-box { display: flex; align-items: center; background: var(--bg-secondary); padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border-color); justify-content: space-between; }
.btn-copy { border: none; background: transparent; color: var(--primary); font-weight: 600; cursor: pointer; }

/* 🟢 NEW: Admin Panel Styles (Better Dark Mode) */
.admin-controls-panel {
    background: #fdf2f8;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #fbcfe8;
    margin-bottom: 20px;
    display: none; /* Hidden by default */
}
.admin-controls-panel h4 {
    margin-bottom: 10px;
    color: #db2777;
}

[data-theme="dark"] .admin-controls-panel {
    background: rgba(219, 39, 119, 0.1); /* Low opacity pink/dark */
    border-color: #831843;
}
[data-theme="dark"] .admin-controls-panel h4 {
    color: #f472b6;
}

/* 🟢 NEW: Button Small fixes (Visibility) */
.btn-sm {
    padding: 6px 12px; 
    font-size: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    margin-left: 4px;
    color: var(--text-main);
    transition: all 0.2s;
}
.btn-sm:hover {
    background: var(--nav-hover);
}
.btn-sm.danger { 
    color: #dc2626; 
    border-color: #fca5a5; 
    background: #fef2f2; 
}
[data-theme="dark"] .btn-sm.danger {
    background: #7f1d1d;
    color: #fecaca;
    border-color: #991b1b;
}

/* 🟢 DARK MODE BUTTON OVERRIDE */
[data-theme="dark"] .btn-sm:not(.danger) {
    background: #374151; /* Dark grey-blue */
    color: white;
    border-color: #4b5563;
}
[data-theme="dark"] .btn-sm:not(.danger):hover {
    background: #4b5563;
}

.member-list { display: flex; flex-direction: column; gap: 8px; }
.member-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; background: var(--bg-secondary); border-radius: 8px; }
.member-info { display: flex; flex-direction: column; }
.member-role { font-size: 0.75rem; color: var(--text-muted); }
.admin-badge { background: #fef3c7; color: #d97706; padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; margin-left: 6px; }


/* SHOP */
.shop-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.inventory-display { background: var(--bg-secondary); padding: 8px 16px; border-radius: 20px; border: 1px solid var(--border-color); font-size: 0.9rem; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.shop-card { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 16px; padding: 24px; position: relative; transition: transform 0.2s; display: flex; flex-direction: column; }
.shop-card:hover { transform: translateY(-4px); border-color: var(--primary); }
.shop-card.premium { border: 2px solid #d97706; background: linear-gradient(145deg, #fffbeb, #fef3c7); }
[data-theme="dark"] .shop-card.premium { background: linear-gradient(145deg, #451a03, #78350f); border-color: #d97706; }

.badge-tag { position: absolute; top: -10px; right: 20px; background: #d97706; color: white; padding: 4px 12px; border-radius: 12px; font-size: 0.75rem; font-weight: bold; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.shop-card h4 { margin-bottom: 8px; font-size: 1.1rem; }
.price { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin-bottom: 16px; }
.price .period { font-size: 0.9rem; color: var(--text-muted); font-weight: 400; }
.benefits-list { list-style: none; margin-bottom: 20px; flex: 1; }
.benefits-list li { margin-bottom: 8px; font-size: 0.9rem; color: var(--text-muted); display: flex; align-items: flex-start; gap: 8px; }
.btn-buy { width: 100%; padding: 12px; background: var(--primary); color: white; border: none; border-radius: 10px; font-weight: 600; cursor: pointer; transition: opacity 0.2s; }
.btn-buy:hover { opacity: 0.9; }
.btn-buy.outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-buy.outline:hover { background: var(--nav-hover); }

.item-icon { font-size: 2rem; margin-bottom: 10px; }
.premium-badge { background: linear-gradient(90deg, #d97706, #fbbf24); color: white; padding: 4px 10px; border-radius: 6px; font-size: 0.8rem; font-weight: bold; }

/* ACHIEVEMENTS */
.achievements-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.achievement-card { background: var(--card-bg); border-radius: 16px; padding: 24px; text-align: center; border: 1px solid var(--border-color); transition: transform 0.2s; }
.achievement-card:hover { transform: translateY(-5px); }
.achievement-card.unlocked { border-color: var(--primary); background: linear-gradient(to bottom right, var(--card-bg), var(--badge-bg)); }
.achievement-icon { font-size: 3rem; margin-bottom: 12px; filter: grayscale(1); opacity: 0.5; }
.achievement-card.unlocked .achievement-icon { filter: grayscale(0); opacity: 1; }

/* SETTINGS */
.settings-list { display: flex; flex-direction: column; gap: 12px; }
.setting-item { 
    background: var(--bg-secondary); 
    padding: 16px; 
    border-radius: 12px; 
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}
.setting-item h4 { margin-bottom: 5px; font-size: 1rem; }
.setting-item p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.4; }
.setting-item.clickable:hover { border-color: var(--primary); background: var(--nav-hover); cursor: pointer; }
.setting-link { text-decoration: none; color: inherit; display: block; }
.setting-item .arrow { color: var(--text-muted); font-size: 1.2rem; }

/* ==========================================================================
   MOBILE & TABLET RESPONSIVENESS
   ========================================================================== */

@media (max-width: 900px) { 
    .dashboard-grid-row { grid-template-columns: 1fr; } 
    .groups-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    body { padding: 10px; }
    h1 { font-size: 1.8rem; }
    .subtitle { font-size: 0.9rem; }
    
    /* Header & Nav */
    header { flex-direction: row; align-items: center; margin-bottom: 20px; }
    .nav-btn { padding: 10px 16px; font-size: 0.9rem; }
    .icon-only-mobile .desktop-text { display: none; }
    
    /* Timer */
    .timer-time { font-size: 3.5rem; margin: 20px 0; }
    .timer-settings { gap: 10px; }
    .btn-control { padding: 12px 24px; font-size: 1rem; width: 100%; }
    .timer-controls { flex-direction: column; gap: 10px; width: 100%; }
    
    /* Dashboard Mobile Fix: 2x2 Grid */
    .dashboard-stats-grid { 
        grid-template-columns: 1fr 1fr; 
        gap: 10px; 
    }
    .stat-card { padding: 12px; }
    .stat-icon-small { width: 32px; height: 32px; font-size: 1rem; margin-bottom: 8px; }
    .stat-value { font-size: 1.2rem; }
    .stat-label { font-size: 0.8rem; }
    
    .card { padding: 16px; margin-bottom: 12px; }
    .dashboard-grid-row { gap: 12px; }

    /* Charts */
    .chart-container, .chart-container.wide { height: 160px; }
    .chart-container.pie-container { height: 160px; } 
    
    /* Calendar */
    .calendar-cell { font-size: 0.8rem; }
    .calendar-cell span:last-child { display: none; }
    
    /* Groups */
    .groups-layout { grid-template-columns: 1fr; gap: 16px; }
    .group-item { padding: 12px; }
    .leaderboard-filters { gap: 4px; overflow-x: auto; padding-bottom: 8px; }
    .filter-btn { font-size: 0.8rem; padding: 6px 10px; white-space: nowrap; }
    
    /* Auth */
    .auth-card { padding: 24px; }
}

@media (max-width: 480px) {
    .timer-time { font-size: 3rem; }
    .mode-selector { flex-direction: column; gap: 8px; }
}

/* TOAST NOTIFICATIONS */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px; /* Or left: 50%; transform: translateX(-50%); for center */
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10000;
}

.toast {
    background: var(--card-bg);
    color: var(--text-main);
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s ease-out;
    min-width: 250px;
    font-size: 0.95rem;
}
.toast.error { border-left-color: #ef4444; }
.toast.success { border-left-color: #10b981; }

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

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(10px); }
}

/* CUSTOM MODAL OVERLAY */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 10001;
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-box {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    text-align: center;
    animation: popIn 0.2s ease-out;
}

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

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    flex: 1;
}

/* Helper to stop animations during resets/mode switches */
.no-transition {
    transition: none !important;
}


.modal-btn.cancel { background: var(--bg-secondary); color: var(--text-muted); }
.modal-btn.confirm { background: var(--primary); color: white; }
.modal-btn.danger { background: #fee2e2; color: #dc2626; }



/* --- 1. TOGGLE MODE SELECTOR --- */
.mode-toggle-container {
    background: var(--bg-secondary);
    padding: 6px;
    border-radius: 16px;
    display: flex;
    position: relative;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.mode-toggle-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mode-toggle-btn.active {
    background: var(--card-bg);
    color: var(--text-main);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mode-toggle-btn.stopwatch.active { color: #3b82f6; } /* Blue text for active stopwatch */
.mode-toggle-btn.pomodoro.active { color: #f97316; } /* Orange text for active pomodoro */

/* --- 2. RESPONSIVE SUBJECT BAR --- */
.subject-section {
    margin-bottom: 25px;
}
.subject-row {
    display: flex;
    gap: 12px;
    align-items: center;
}
.select-wrapper {
    flex: 1; /* Takes all available space */
    position: relative;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}
.subject-select {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 1rem;
    appearance: none; /* Hide default arrow */
    outline: none;
    cursor: pointer;
}
.select-arrow {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
    pointer-events: none;
}
.btn-add-subject {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0; /* Prevents shrinking on mobile */
}
.btn-add-subject:hover { background: var(--nav-hover); border-color: var(--primary); color: var(--primary); }

/* --- 3. NEW CONTROLS LAYOUT --- */
.timer-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    gap: 15px;
    padding: 0 10px;
}

/* Round Buttons (Stop & Settings) */
.btn-round {
    width: 50px;
    height: 50px;
    border-radius: 16px; /* Squircle */
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: transform 0.1s, background 0.2s;
}
.btn-round:active { transform: scale(0.95); }

.btn-stop {
    background: var(--bg-secondary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}
.btn-stop:hover { background: #fee2e2; color: #ef4444; border-color: #fca5a5; }

.btn-settings {
    background: var(--bg-secondary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}
.btn-settings:hover { background: var(--nav-hover); color: var(--text-main); }

.btn-round-spacer { width: 50px; height: 50px; visibility: hidden; }

/* Pill Action Button (Start) */
.btn-pill-action {
    flex: 1; /* Grows to fill center */
    max-width: 200px; /* But not too wide */
    padding: 14px;
    border-radius: 16px;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 0.1s;
}
.btn-pill-action:active { transform: scale(0.98); }

.btn-start { background: linear-gradient(90deg, #10b981, #059669); }
.btn-pause { background: linear-gradient(90deg, #f97316, #ef4444); }
.btn-resume { background: linear-gradient(90deg, #10b981, #059669); }

/* --- 4. POMODORO SETTINGS OVERLAY --- */
.settings-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 10;
    display: flex;
    align-items: flex-end; /* Bottom sheet on mobile, center on desktop */
    justify-content: center;
    border-radius: var(--radius);
}

.settings-panel {
    background: var(--card-bg);
    width: 100%;
    padding: 20px;
    border-radius: 20px 20px 0 0; /* Rounded top */
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
}

@media (min-width: 600px) {
    .settings-overlay { align-items: center; }
    .settings-panel { width: 300px; border-radius: 20px; }
}

.settings-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.settings-header h4 { margin: 0; }
.btn-close-settings { background: transparent; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-muted); }

.input-wrapper { margin-bottom: 15px; }
.input-wrapper label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 6px; }
.input-wrapper input { 
    width: 100%; padding: 12px; 
    background: var(--bg-secondary); border: 1px solid var(--border-color); 
    border-radius: 10px; color: var(--text-main); font-size: 1rem;
}
.btn-save-settings { width: 100%; padding: 12px; background: var(--primary); color: white; border: none; border-radius: 12px; font-weight: 600; cursor: pointer; }


/* --- CUSTOM CHART LEGEND (Toggles) --- */
.chart-legend-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s, opacity 0.2s;
    user-select: none;
}

.legend-item:hover {
    background: var(--nav-hover);
}

.legend-item.hidden {
    opacity: 0.5;
    text-decoration: line-through;
}

.legend-color-box {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

/* Specific Colors matching the charts */
.legend-focus .legend-color-box { background-color: #8b5cf6; } /* Purple */
.legend-break .legend-color-box { background-color: #f43f5e; } /* Pink/Red */
.legend-trend-focus .legend-color-box { background-color: #6366f1; } /* Blue/Indigo */
.legend-trend-break .legend-color-box { background-color: #10b981; } /* Green */


/* --- SKELETON LOADING --- */
.skeleton {
    background-color: var(--bg-secondary);
    /* Shimmer effect gradient */
    background-image: linear-gradient(90deg, var(--bg-secondary), var(--border-color), var(--bg-secondary));
    background-size: 200px 100%;
    background-repeat: no-repeat;
    display: inline-block;
    border-radius: 4px;
    animation: skeleton-shimmer 1.5s infinite linear;
}

@keyframes skeleton-shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

/* Helper classes for skeleton shapes */
.skeleton-text { height: 1em; width: 100%; border-radius: 4px; }
.skeleton-avatar { width: 32px; height: 32px; border-radius: 50%; }

/* Ensure skeleton items don't have pointer events */
.skeleton-item { pointer-events: none; opacity: 0.7; }