/* 
 * Chore Tracker Styles
 * Mobile-first, kid-friendly design
 */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #22c55e;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 12px;
}

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

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--gray-900);
    line-height: 1.6;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}

.container.admin {
    max-width: 900px;
}

/* Header */
.header {
    text-align: center;
    padding: 24px 16px;
    color: white;
}

.header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 4px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.header .date {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--gray-100);
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-700);
}

/* Time Section Headers */
.time-section {
    margin-bottom: 24px;
}

.time-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

/* Chore Items - MOBILE OPTIMIZED */
.chore-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--gray-50);
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    gap: 12px;
}

.chore-item:hover {
    border-color: var(--primary);
}

.chore-item.completed {
    background: var(--success-light);
    border-color: var(--success);
}

.chore-item.completed .chore-name {
    text-decoration: line-through;
    opacity: 0.7;
}

.chore-checkbox {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid var(--gray-300);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    background: white;
}

.chore-checkbox:hover {
    border-color: var(--primary);
    background: var(--gray-100);
}

.chore-item.completed .chore-checkbox {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.chore-checkbox .check {
    display: none;
    font-size: 1.2rem;
}

.chore-item.completed .chore-checkbox .check {
    display: block;
}

.chore-content {
    flex: 1;
    min-width: 0;
}

.chore-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--gray-900);
    word-wrap: break-word;
}

.chore-description {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.chore-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.chore-assignee {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.chore-assignee-name {
    display: none;
}

.chore-points {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--warning);
}

/* Avatar */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.avatar.small {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
}

/* Kid selector */
.kid-selector {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.kid-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.9);
    border-radius: var(--radius);
    border: 3px solid transparent;
    text-decoration: none;
    color: var(--gray-900);
}

.kid-btn .avatar {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
}

.kid-btn .name {
    font-weight: 700;
    font-size: 0.95rem;
}

.kid-btn .points {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.kid-btn .schedule-time {
    font-size: 0.7rem;
    color: var(--gray-500);
}

.kid-btn.override {
    box-shadow: 0 0 0 3px #f59e0b;
}

.kid-btn .schedule-override {
    font-size: 0.7rem;
    color: #d97706;
    font-weight: 600;
}

/* Leaderboard */
.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 10px;
    background: var(--gray-50);
}

.leaderboard-item.rank-1 {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.leaderboard-item.rank-2 {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

.leaderboard-item.rank-3 {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
}

.leaderboard-rank {
    font-size: 1.5rem;
    font-weight: 800;
    width: 40px;
    text-align: center;
    color: var(--gray-500);
}

.leaderboard-item.rank-1 .leaderboard-rank { color: #d97706; }
.leaderboard-item.rank-2 .leaderboard-rank { color: #6b7280; }
.leaderboard-item.rank-3 .leaderboard-rank { color: #c2410c; }

.leaderboard-info {
    flex: 1;
    margin-left: 12px;
}

.leaderboard-name {
    font-weight: 700;
    font-size: 1.1rem;
}

.leaderboard-streak {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.leaderboard-points {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

.leaderboard-points span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-500);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

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

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

.checkbox-group, .radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.checkbox-item, .radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--gray-100);
    border-radius: 8px;
    cursor: pointer;
}

.checkbox-item input, .radio-item input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Navigation */
.nav {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.nav a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
    background: rgba(255,255,255,0.2);
    font-size: 0.9rem;
}

.nav a:hover, .nav a.active {
    background: rgba(255,255,255,0.3);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

th {
    font-weight: 700;
    color: var(--gray-700);
    background: var(--gray-50);
}

/* Alerts */
.alert {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-weight: 500;
}

.alert-success {
    background: var(--success-light);
    color: #166534;
    border: 1px solid #86efac;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: var(--gray-700);
}

/* Progress */
.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-weight: 600;
}

/* Animation */
@keyframes celebrate {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.chore-item.just-completed {
    animation: celebrate 0.3s ease;
}

/* ========================================
   MOBILE RESPONSIVE - PHONE OPTIMIZATIONS
   ======================================== */

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .header .date {
        font-size: 0.95rem;
    }
    
    .nav a {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    /* Chore item mobile layout */
    .chore-item {
        padding: 10px;
        gap: 10px;
    }
    
    .chore-checkbox {
        width: 32px;
        height: 32px;
    }
    
    .chore-name {
        font-size: 0.95rem;
    }
    
    .chore-assignee {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
    
    .chore-points {
        font-size: 0.75rem;
    }
    
    /* Kid selector mobile */
    .kid-selector {
        gap: 8px;
    }
    
    .kid-btn {
        padding: 10px 12px;
    }
    
    .kid-btn .avatar {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .kid-btn .name {
        font-size: 0.85rem;
    }
    
    .kid-btn .points {
        font-size: 0.75rem;
    }
    
    /* Card padding */
    .card {
        padding: 14px;
    }
    
    /* Leaderboard mobile */
    .leaderboard-item {
        padding: 12px;
    }
    
    .leaderboard-rank {
        font-size: 1.2rem;
        width: 30px;
    }
    
    .avatar {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
    
    .leaderboard-name {
        font-size: 1rem;
    }
    
    .leaderboard-points {
        font-size: 1.2rem;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .chore-item {
        gap: 8px;
    }
    
    .chore-checkbox {
        width: 28px;
        height: 28px;
    }
    
    .chore-name {
        font-size: 0.9rem;
    }
    
    .chore-assignee {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }
    
    .chore-points {
        display: none;
    }
}

/* Tablet and larger - show full names */
@media (min-width: 600px) {
    .chore-assignee {
        width: auto;
        height: auto;
        padding: 6px 12px;
        border-radius: 20px;
    }
    
    .chore-assignee-name {
        display: inline;
        margin-left: 6px;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
    }
    
    .header {
        color: black;
    }
    
    .nav, .btn {
        display: none;
    }
}
