/* FamilyHub Styles */
@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&family=Orbitron:wght@400;500;600;700;900&display=swap');

/* Cute Theme (Default) */
:root,
[data-theme="cute"] {
    --primary: #ff6b9d;
    --primary-light: #ffa6c9;
    --primary-dark: #e85384;
    --bg: #fff5f7;
    --surface: #ffffff;
    --text: #2d1b2e;
    --text-secondary: #8b7a8c;
    --border: #f0d9e0;
    --success: #5fdc91;
    --warning: #ffb347;
    --danger: #ff6b81;
    --star: #ffd93d;
    --radius: 20px;
    --shadow: 0 4px 12px rgba(255, 107, 157, 0.15);
    --font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --bg-gradient: linear-gradient(135deg, #fff5f7 0%, #ffe8f0 100%);
}

/* Cyberpunk Theme */
[data-theme="cyberpunk"] {
    --primary: #00f0ff;
    --primary-light: #7dffff;
    --primary-dark: #00bcd4;
    --bg: #0a0e27;
    --surface: #141b3d;
    --text: #ffffff;
    --text-secondary: #8b95c9;
    --border: #2d3561;
    --success: #39ff14;
    --warning: #ffea00;
    --danger: #ff006e;
    --star: #ffea00;
    --radius: 8px;
    --shadow: 0 0 20px rgba(0, 240, 255, 0.3);
    --font-family: 'Orbitron', monospace;
    --bg-gradient: linear-gradient(135deg, #0a0e27 0%, #1a1f4d 100%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    color: var(--text);
    min-height: 100vh;
    transition: all 0.3s ease;
}

.hidden { display: none !important; }

/* Auth Screen */
.auth-container {
    max-width: 420px;
    margin: 0 auto;
    padding: 2rem;
    text-align: center;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
}

.auth-container h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
}

.auth-container input {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: 50px;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.auth-container input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.2);
    transform: translateY(-2px);
}

/* Buttons */
.btn {
    padding: 0.85rem 1.75rem;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-bottom: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.3);
}

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

.btn-secondary:hover {
    background: #fff0f5;
    transform: translateY(-2px);
}

.btn-link {
    background: none;
    color: var(--text-secondary);
    text-decoration: underline;
    padding: 0.5rem;
}

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

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    width: auto;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: 0 2px 12px rgba(255, 107, 157, 0.2);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

#logout-btn { color: rgba(255,255,255,0.8); }

/* Tab Bar */
.tab-bar {
    display: flex;
    background: white;
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tab {
    flex: 1;
    padding: 1rem;
    border: none;
    background: none;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.tab:hover {
    color: var(--primary);
    background: rgba(255, 107, 157, 0.05);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(255, 107, 157, 0.08);
}

/* Content */
.tab-content { display: none; padding: 1rem; }
.tab-content.active { display: block; }

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 157, 0.2);
}

.user-card {
    background: linear-gradient(145deg, #ffffff 0%, #fffafc 100%);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

/* Stars */
.stars {
    color: var(--star);
    font-size: 1.1rem;
}

/* User avatars */
.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    border: 3px solid white;
}

.user-avatar:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
}

#user-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin: 1rem 0;
}

.user-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.user-option:hover { background: #eef2ff; }
.user-option .user-avatar { width: 64px; height: 64px; font-size: 1.5rem; }

/* Task Items */
.task-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

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

.task-check {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.task-check.completed {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.task-info { flex: 1; }
.task-title { font-weight: 500; }
.task-title.completed { text-decoration: line-through; color: var(--text-secondary); }
.task-assignee { font-size: 0.8rem; color: var(--text-secondary); }

/* Shopping List */
.shop-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}

.shop-item:last-child { border-bottom: none; }
.shop-item.bought { opacity: 0.5; }
.shop-item.bought .shop-name { text-decoration: line-through; }

/* Appointments */
.appointment-item {
    padding: 0.75rem;
    border-left: 4px solid var(--primary);
    margin-bottom: 0.5rem;
    background: #f8faff;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.appointment-time {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
}

.appointment-title { font-weight: 500; margin-top: 0.25rem; }

/* Progress Tracker (GitHub-style) */
.progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 14px);
    gap: 3px;
    margin: 1rem 0;
}

.progress-cell {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    background: #f5e6ee;
    transition: all 0.2s ease;
}

.progress-cell:hover {
    transform: scale(1.2);
}

.progress-cell.level-1 { background: #b8f0d6; }
.progress-cell.level-2 { background: #7ee3b8; }
.progress-cell.level-3 { background: #5fdc91; }
.progress-cell.level-4 { background: #3ac776; }

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 1.75rem;
    border: none;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    z-index: 50;
}

.fab:hover { transform: scale(1.1); }

/* Modal */
.modal {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 90%;
    width: 420px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(255, 107, 157, 0.3);
    border: 2px solid var(--border);
}

#modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#modal-overlay.hidden { display: none; }

.modal h3 { margin-bottom: 1rem; }

.modal input, .modal select, .modal textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border);
    border-radius: 15px;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
    background: white;
}

.modal input:focus, .modal select:focus, .modal textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 3px 10px rgba(255, 107, 157, 0.15);
    transform: translateY(-1px);
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.modal-actions .btn { flex: 1; }

/* Add input row */
.add-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.add-row input { flex: 1; margin: 0; }

/* Section titles */
.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--primary);
    letter-spacing: -0.5px;
}

/* Touch targets - minimum 44px for all interactive elements */
.task-check { min-width: 44px; min-height: 44px; width: 44px; height: 44px; }
.appointment-item { cursor: pointer; min-height: 44px; }

/* ========== TABLET / DESKTOP (768px+) ========== */
@media (min-width: 768px) {
    .tab-content { max-width: 900px; margin: 0 auto; padding: 1.5rem; }
    .auth-container { padding-top: 10vh; }
    .tab { font-size: 1rem; padding: 0.85rem 1.5rem; }
    header h1 { font-size: 1.5rem; }
    .card { padding: 1.25rem; }
    .task-item { padding: 0.85rem 1rem; }
    .user-option .user-avatar { width: 72px; height: 72px; font-size: 1.75rem; }
}

/* ========== LANDSCAPE iPad / Tablet (landscape + min 768 wide) ========== */
@media (orientation: landscape) and (min-width: 768px) {
    /* Full viewport layout - no scrolling on large screens */
    #main-screen {
        display: flex;
        flex-direction: column;
        height: 100vh;
        overflow: hidden;
    }

    header { flex-shrink: 0; padding: 0.5rem 1.5rem; }
    .tab-bar { flex-shrink: 0; }

    #content {
        flex: 1;
        overflow: hidden;
        display: flex;
    }

    .tab-content {
        max-width: 100%;
        width: 100%;
        overflow-y: auto;
        padding: 1rem 2rem;
    }

    .tab-content.active {
        display: flex;
        flex-direction: column;
    }

    /* Dashboard: side by side layout */
    #tab-dashboard.active {
        flex-direction: row;
        gap: 1.5rem;
        flex-wrap: nowrap;
        align-items: flex-start;
    }

    #tab-dashboard .card {
        flex: 1;
        min-width: 0;
        margin-bottom: 0;
    }

    /* Tasks: compact for no-scroll */
    .task-item { padding: 0.5rem 0.75rem; }
    .task-assignee { font-size: 0.75rem; }

    /* Shopping: compact */
    .shop-item { padding: 0.4rem 0; }

    /* Appointments: compact */
    .appointment-item { padding: 0.5rem 0.75rem; margin-bottom: 0.35rem; }
}

/* ========== LANDSCAPE small screens (phones) ========== */
@media (orientation: landscape) and (max-height: 500px) {
    .auth-container { padding: 0.75rem; min-height: auto; gap: 0.5rem; }
    .auth-container h1 { font-size: 1.5rem; }
    .subtitle { margin-bottom: 0.25rem; font-size: 0.85rem; }
    .auth-container input { padding: 0.5rem 0.75rem; margin-bottom: 0.25rem; font-size: 0.9rem; }
    .btn { padding: 0.5rem 1rem; font-size: 0.9rem; margin-bottom: 0.25rem; }

    header { padding: 0.35rem 1rem; }
    header h1 { font-size: 1rem; }
    .tab { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
    .tab-content { padding: 0.5rem 0.75rem; }
    .card { padding: 0.75rem; margin-bottom: 0.5rem; }
    .section-title { font-size: 0.95rem; margin-bottom: 0.5rem; }
    .task-item { padding: 0.4rem 0.5rem; gap: 0.5rem; }
    .task-check { min-width: 36px; min-height: 36px; width: 36px; height: 36px; }
}

/* ========== TV / very large landscape (1200px+ wide, landscape) ========== */
@media (orientation: landscape) and (min-width: 1200px) {
    .tab-content { padding: 1.5rem 3rem; }
    .tab { font-size: 1.05rem; padding: 0.75rem 2rem; }
    header { padding: 0.6rem 2rem; }
    header h1 { font-size: 1.5rem; }
    .card { padding: 1.5rem; }
    .progress-cell { width: 14px; height: 14px; }

    /* Larger touch targets for TV remote navigation */
    .task-check { width: 48px; height: 48px; min-width: 48px; min-height: 48px; font-size: 1.25rem; }
    .task-item { padding: 0.75rem 1rem; }
    .user-avatar { width: 56px; height: 56px; font-size: 1.5rem; }
    .user-option .user-avatar { width: 80px; height: 80px; font-size: 2rem; }
}

/* Task Buttons */
.task-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    padding: 0.7rem 1.2rem;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(255, 107, 157, 0.25);
}

.task-btn:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 5px 15px rgba(255, 107, 157, 0.35);
}

.task-btn.completed {
    background: linear-gradient(135deg, #e8d5e0 0%, #f0e0ea 100%);
    color: var(--text-secondary);
    text-decoration: line-through;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.task-btn.completed:hover {
    background: linear-gradient(135deg, #d8c5d0 0%, #e0d0da 100%);
    transform: translateY(-1px);
}

/* Leaderboard Ticker */
.leaderboard-ticker-container {
    background: linear-gradient(90deg, #fff5f7 0%, #ffe8f0 50%, #fff5f7 100%);
    border-bottom: 2px solid var(--border);
    overflow: hidden;
    height: 40px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.leaderboard-ticker {
    display: inline-block;
    white-space: nowrap;
    animation: scroll 30s linear infinite;
    padding-left: 100%;
    font-size: 0.95rem;
    color: var(--text);
    font-weight: 600;
}

@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* User Cards Container */
.user-cards-container {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 0;
}

@media (min-width: 768px) {
    .user-cards-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========== CYBERPUNK THEME ENHANCEMENTS ========== */
[data-theme="cyberpunk"] .card {
    background: linear-gradient(145deg, #141b3d 0%, #1a2050 100%);
    border: 2px solid var(--primary);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.2), inset 0 0 20px rgba(0, 240, 255, 0.05);
}

[data-theme="cyberpunk"] .card:hover {
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.4), inset 0 0 30px rgba(0, 240, 255, 0.1);
    border-color: var(--primary-light);
}

[data-theme="cyberpunk"] header {
    background: linear-gradient(135deg, #141b3d 0%, #1a2050 100%);
    border-bottom: 2px solid var(--primary);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
}

[data-theme="cyberpunk"] header h1 {
    text-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary);
    animation: cyberpunk-glow 2s ease-in-out infinite alternate;
}

@keyframes cyberpunk-glow {
    from { text-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary); }
    to { text-shadow: 0 0 15px var(--primary-light), 0 0 30px var(--primary-light); }
}

[data-theme="cyberpunk"] .btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
    border: 1px solid var(--primary-light);
}

[data-theme="cyberpunk"] .btn-primary:hover {
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.7);
    border-color: var(--primary-light);
}

[data-theme="cyberpunk"] .task-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
    border: 1px solid var(--primary-light);
    text-shadow: 0 0 5px rgba(0, 240, 255, 0.8);
}

[data-theme="cyberpunk"] .task-btn:hover {
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.6);
}

[data-theme="cyberpunk"] .task-btn.completed {
    background: linear-gradient(135deg, #2d3561 0%, #3a4575 100%);
    border-color: #5a6590;
    box-shadow: none;
    text-shadow: none;
}

[data-theme="cyberpunk"] .user-avatar {
    border: 2px solid var(--primary);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
}

[data-theme="cyberpunk"] .progress-cell {
    background: #1a2050;
    border: 1px solid #2d3561;
}

[data-theme="cyberpunk"] .progress-cell.level-1 {
    background: #1a5f45;
    box-shadow: 0 0 5px rgba(57, 255, 20, 0.3);
}

[data-theme="cyberpunk"] .progress-cell.level-2 {
    background: #2a8f5f;
    box-shadow: 0 0 8px rgba(57, 255, 20, 0.4);
}

[data-theme="cyberpunk"] .progress-cell.level-3 {
    background: #39ff14;
    box-shadow: 0 0 12px rgba(57, 255, 20, 0.6);
}

[data-theme="cyberpunk"] .progress-cell.level-4 {
    background: #39ff14;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.8);
}

[data-theme="cyberpunk"] .leaderboard-ticker-container {
    background: linear-gradient(90deg, #0a0e27 0%, #1a1f4d 50%, #0a0e27 100%);
    border-bottom: 2px solid var(--primary);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

[data-theme="cyberpunk"] .leaderboard-ticker {
    text-shadow: 0 0 5px var(--primary);
}

[data-theme="cyberpunk"] .auth-container h1 {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(0, 240, 255, 0.5));
    animation: cyberpunk-glow 2s ease-in-out infinite alternate;
}

[data-theme="cyberpunk"] input,
[data-theme="cyberpunk"] select,
[data-theme="cyberpunk"] textarea {
    background: #1a2050;
    border-color: var(--primary);
    color: var(--text);
}

[data-theme="cyberpunk"] input:focus,
[data-theme="cyberpunk"] select:focus,
[data-theme="cyberpunk"] textarea:focus {
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
    border-color: var(--primary-light);
}

[data-theme="cyberpunk"] .tab.active {
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

[data-theme="cyberpunk"] .modal {
    background: #141b3d;
    border: 2px solid var(--primary);
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.4);
}
