/* ============================================
   HOME CHORES – Global Styles
   ============================================ */

:root {
    --primary-color: #4f46e5;
    --primary-light: #818cf8;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
}

/* ---- App Container ---- */
.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

/* ---- Header ---- */
.app-header {
    text-align: center;
    padding: 1.5rem 0 1rem;
    position: sticky;
    top: 0;
    background: var(--bg-color);
    z-index: 100;
}

.app-header h1 {
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--primary-color);
}

.header-controls {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.history-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

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

/* ---- Global Progress Bar ---- */
.global-progress-bar {
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    margin-top: 0.75rem;
    overflow: hidden;
}

.global-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* ---- People Bar ---- */
.people-bar {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    padding: 1rem 0;
    flex-wrap: wrap;
}

.person-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 6px 14px;
    background: var(--card-bg);
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
    border: 2px solid transparent;
}

.person-chip:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.person-chip img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

/* ---- Room Cards Grid ---- */
.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.room-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease;
    position: relative;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
}

.room-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.room-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.room-progress {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---- Assign Button & Dropdown ---- */
.assign-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: all 0.2s;
}

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

.assign-btn:hover svg {
    stroke: white;
}

.assigned-badge {
    display: none;
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    padding: 3px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.assign-dropdown {
    display: none;
    position: absolute;
    top: 48px;
    right: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    min-width: 140px;
    overflow: hidden;
}

.assign-dropdown.show {
    display: block;
}

.assign-option {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.15s;
}

.assign-option:hover {
    background: var(--primary-color);
    color: white;
}

/* ---- Room Detail View ---- */
.back-button {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.back-button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

h2[data-room-id] {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

/* ---- Task Sections ---- */
.task-section {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.section-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

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

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

.task-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--success-color);
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}

.task-text {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ---- Daily Grid ---- */
.daily-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.daily-header-row .spacer {
    flex: 1;
}

.days-header {
    display: flex;
    gap: 4px;
}

.days-header span {
    width: 32px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

.daily-task-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}

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

.daily-task-name {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
}

.daily-checkbox-group {
    display: flex;
    gap: 4px;
}

.day-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.day-label-mobile {
    display: none;
    font-size: 0.6rem;
    color: var(--text-muted);
    font-weight: 700;
}

.daily-checkbox {
    width: 28px;
    height: 28px;
}

/* ---- Proof Gallery ---- */
.proof-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 1rem;
}

.proof-thumb {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 1;
}

.proof-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.proof-thumb .delete-proof {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.proof-thumb:hover .delete-proof {
    opacity: 1;
}

/* ---- Person View ---- */
.person-header {
    text-align: center;
    padding: 1.5rem 0;
}

.person-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
    margin-bottom: 0.75rem;
    cursor: pointer;
    background: var(--bg-color);
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .app-container {
        padding: 0 0.5rem 1rem;
    }

    .room-grid {
        grid-template-columns: 1fr;
    }

    .days-header span {
        width: 28px;
        font-size: 0.65rem;
    }

    .daily-checkbox {
        width: 24px;
        height: 24px;
    }

    .day-label-mobile {
        display: block;
    }

    .days-header {
        display: none;
    }
}