/* Homely — design moderne (gradients oklch, Space Grotesk / Manrope, thème clair/sombre) */

:root {
    --bg: #100e15;
    --card: #1c1826;
    --card-hi: #241f30;
    --border: rgba(255, 255, 255, 0.08);
    --text: #f5f3f8;
    --text-muted: #a79fb2;
    --clean: oklch(0.75 0.16 155);
    --clean-bg: oklch(0.75 0.16 155 / 0.16);
    --due: oklch(0.8 0.15 75);
    --due-bg: oklch(0.8 0.15 75 / 0.18);
    --overdue: oklch(0.7 0.19 22);
    --overdue-bg: oklch(0.7 0.19 22 / 0.18);
    --radius-lg: 26px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --aurora-opacity: 0.55;
    --field-bg: rgba(255, 255, 255, 0.04);
    --shadow-tile: 0 14px 30px -12px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #faf8fc;
    --card: #ffffff;
    --card-hi: #f3eff8;
    --border: rgba(20, 12, 30, 0.09);
    --text: #211c2b;
    --text-muted: #6f6680;
    --aurora-opacity: 0.28;
    --field-bg: rgba(20, 12, 30, 0.03);
    --shadow-tile: 0 14px 26px -14px rgba(60, 30, 80, 0.3);
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: oklch(0.78 0.17 300);
    text-decoration: none;
}
a:hover {
    color: oklch(0.74 0.18 340);
}

.display {
    font-family: 'Space Grotesk', 'Manrope', sans-serif;
}

/* ---------- Structure ---------- */

.app-shell {
    position: relative;
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}

.bg-aurora {
    position: absolute;
    inset: -10% -20% auto -20%;
    height: 440px;
    background:
        radial-gradient(circle at 18% 18%, oklch(0.55 0.17 300 / 0.55), transparent 60%),
        radial-gradient(circle at 82% 8%, oklch(0.6 0.16 20 / 0.4), transparent 55%),
        radial-gradient(circle at 50% 45%, oklch(0.5 0.15 230 / 0.35), transparent 60%);
    filter: blur(50px);
    opacity: var(--aurora-opacity);
    pointer-events: none;
    z-index: 0;
}

.topbar {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 22px 20px 6px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}
.brand:hover {
    color: var(--text);
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, oklch(0.78 0.17 300), oklch(0.62 0.19 330));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex: 0 0 auto;
}

.brand-name {
    font-weight: 700;
    font-size: 19px;
    letter-spacing: -0.01em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.icon-btn:hover {
    color: var(--text);
}
.icon-btn:active {
    transform: scale(0.94);
}

.icon-moon {
    display: none;
}
:root[data-theme="light"] .icon-sun {
    display: none;
}
:root[data-theme="light"] .icon-moon {
    display: inline-flex;
}

.content {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    padding: 10px 20px 40px;
}

/* ---------- Footer (contenu fixe, voir templates/components/footer.html.twig) ---------- */

.app-footer {
    position: relative;
    z-index: 1;
    padding: 24px 20px 110px;
    text-align: center;
    font-size: 12.5px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    max-width: 480px;
    margin: 0 auto;
}
.app-footer-version {
    color: var(--text);
    font-weight: 700;
}
.app-footer-separator {
    margin: 0 6px;
}

/* ---------- Flash ---------- */

.flash {
    border-radius: 999px;
    padding: 11px 18px;
    font-size: 13px;
    font-weight: 600;
    margin: 6px 0 16px;
    background: var(--card-hi);
    border: 1px solid var(--border);
    color: var(--text);
    text-align: center;
    transition: opacity .3s ease, transform .3s ease;
}
.flash-success {
    color: var(--clean);
    border-color: var(--clean-bg);
    background: var(--clean-bg);
}
.flash-error {
    color: var(--overdue);
    border-color: var(--overdue-bg);
    background: var(--overdue-bg);
}
.flash-hide {
    opacity: 0;
    transform: translateY(-6px);
}

/* ---------- Résumé du jour ---------- */

.summary-card {
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    background: linear-gradient(160deg, var(--card-hi), var(--card));
    border: 1px solid var(--border);
    margin: 6px 0 20px;
}
.summary-eyebrow {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.summary-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.summary-sub {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ---------- Grille des pièces ---------- */

.room-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.room-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-radius: var(--radius-lg);
    padding: 18px 16px;
    min-height: 138px;
    color: #fff;
    box-shadow: var(--shadow-tile);
    transition: transform .15s ease;
    background: linear-gradient(150deg, color-mix(in oklch, var(--room-color) 80%, white 16%), color-mix(in oklch, var(--room-color) 62%, black 48%));
}
.room-tile:active {
    transform: scale(0.97);
}

.tile-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.status-pip {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    border: 2px solid rgba(255, 255, 255, 0.55);
}
.status-pip.due_soon {
    background: var(--due);
    border-color: var(--due);
}
.status-pip.overdue {
    background: var(--overdue);
    border-color: var(--overdue);
}

.tile-name {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 16.5px;
    margin-top: 14px;
}
.tile-meta {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.92;
    margin-top: 2px;
}

/* ---------- Détail d'une pièce ---------- */

.room-detail {
    padding-top: 2px;
}

.back-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}
.back-btn:hover {
    color: var(--text);
}
.back-btn:active {
    transform: scale(0.94);
}

.room-hero {
    border-radius: var(--radius-lg);
    padding: 22px;
    color: #fff;
    box-shadow: var(--shadow-tile);
    margin-bottom: 20px;
    background: linear-gradient(150deg, color-mix(in oklch, var(--room-color) 80%, white 16%), color-mix(in oklch, var(--room-color) 62%, black 48%));
}
.room-hero .tile-icon {
    margin-bottom: 12px;
}
.hero-name {
    font-weight: 700;
    font-size: 24px;
    letter-spacing: -0.01em;
}
.hero-meta {
    font-size: 13px;
    opacity: 0.92;
    margin-top: 4px;
    font-weight: 600;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 16px 14px;
}
.task-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.task-name {
    font-weight: 700;
    font-size: 15px;
}
.due-pill {
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
    color: var(--clean);
    background: var(--clean-bg);
}
.due-pill.due_soon {
    color: var(--due);
    background: var(--due-bg);
}
.due-pill.overdue {
    color: var(--overdue);
    background: var(--overdue-bg);
}

.progress-track {
    height: 7px;
    border-radius: 999px;
    background: var(--field-bg);
    overflow: hidden;
    margin-bottom: 12px;
}
.progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width .35s cubic-bezier(.22, .9, .32, 1);
    background: var(--clean);
}
.progress-fill.due_soon {
    background: var(--due);
}
.progress-fill.overdue {
    background: var(--overdue);
}

.btn-done {
    width: 100%;
    border: none;
    border-radius: 999px;
    padding: 11px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    background: var(--field-bg);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: background .15s ease, color .15s ease, transform .1s ease;
}
.btn-done:hover {
    background: color-mix(in oklch, var(--clean) 16%, var(--field-bg));
}
.btn-done:active {
    transform: scale(0.98);
    background: linear-gradient(135deg, oklch(0.75 0.16 155), oklch(0.62 0.17 165));
    color: #08170f;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-size: 13.5px;
    line-height: 1.6;
    margin-top: 50px;
}

/* ---------- Catalogue (pièces / tâches suggérées) ---------- */

.catalog-open-btn {
    margin-top: 18px;
}

.catalog-scroll {
    max-height: 46vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-right: 2px;
}

.catalog-group-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    margin: 0 0 8px;
}

.catalog-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.catalog-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    cursor: pointer;
}
.catalog-item:hover {
    background: var(--field-bg);
}
.catalog-item input {
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    accent-color: oklch(0.7 0.18 320);
}
.catalog-item-name {
    flex: 1 1 auto;
    font-weight: 600;
}
.catalog-item-freq {
    flex: 0 0 auto;
    font-size: 11.5px;
    color: var(--text-muted);
    white-space: nowrap;
}

.sheet-tall {
    max-height: 82vh;
}

/* ---------- FAB ---------- */

.fab {
    position: fixed;
    z-index: 40;
    right: max(20px, calc((100vw - 480px) / 2 + 20px));
    bottom: 26px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, oklch(0.78 0.17 300), oklch(0.62 0.19 330));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 28px -8px oklch(0.6 0.19 320 / 0.7);
    transition: transform .12s ease;
}
.fab:active {
    transform: scale(0.92);
}

/* ---------- Modales (bottom sheet) ---------- */

dialog.sheet-dialog {
    border: none;
    padding: 0;
    background: transparent;
    width: 100%;
    max-width: 480px;
    max-height: none;
    position: fixed;
    left: 50%;
    bottom: 0;
    top: auto;
    margin: 0;
    transform: translateX(-50%);
    overflow: visible;
}
dialog.sheet-dialog::backdrop {
    background: rgba(6, 4, 10, 0.55);
    backdrop-filter: blur(2px);
}

.sheet {
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 24px 24px 0 0;
    background: var(--card);
    padding: 12px 22px 26px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 0;
    overflow-y: auto;
}

.sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--border);
    margin: 4px auto 2px;
    flex: 0 0 auto;
}

.sheet h2 {
    font-family: 'Space Grotesk', sans-serif;
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.sheet label,
.auth-form label,
.sheet-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
}

.sheet input,
.auth-form input {
    font-family: inherit;
    font-size: 15px;
    padding: 11px 13px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--field-bg);
    color: var(--text);
}
.sheet input:focus,
.auth-form input:focus {
    outline: 2px solid oklch(0.78 0.17 300 / 0.6);
    outline-offset: 1px;
}

/* Menu déroulant maison (voir app.js) : remplace le <select> natif dont le
   popup ignore notre thème sombre sur certains Chrome/Windows. */
.custom-select {
    position: relative;
}
.custom-select-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-family: inherit;
    font-size: 15px;
    text-align: left;
    padding: 11px 13px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--field-bg);
    color: var(--text);
    cursor: pointer;
}
.custom-select-trigger svg {
    flex: 0 0 auto;
    color: var(--text-muted);
    transition: transform .15s ease;
}
.custom-select-trigger[aria-expanded="true"] svg {
    transform: rotate(180deg);
}
.custom-select-trigger:focus-visible {
    outline: 2px solid oklch(0.78 0.17 300 / 0.6);
    outline-offset: 1px;
}
.custom-select-list {
    list-style: none;
    margin: 6px 0 0;
    padding: 6px;
    position: absolute;
    z-index: 20;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--card-hi);
    box-shadow: var(--shadow-tile);
}
.custom-select-list li {
    padding: 10px 12px;
    border-radius: 9px;
    font-size: 14.5px;
    color: var(--text);
    cursor: pointer;
}
.custom-select-list li:hover,
.custom-select-list li:focus-visible {
    background: var(--field-bg);
}
.custom-select-list li[aria-selected="true"] {
    background: color-mix(in oklch, oklch(0.78 0.17 300) 22%, var(--field-bg));
    color: var(--text);
    font-weight: 600;
}

.invite-input {
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sheet-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
    flex: 0 0 auto;
}

/* ---------- Boutons ---------- */

.btn {
    border: none;
    border-radius: 999px;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-primary {
    background: linear-gradient(135deg, oklch(0.78 0.17 300), oklch(0.62 0.19 330));
    color: #fff;
}
.btn-block {
    width: 100%;
}

/* ---------- Auth (login / register) ---------- */

.auth-wrap {
    display: flex;
    justify-content: center;
    padding: 30px 20px 10px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: linear-gradient(160deg, var(--card-hi), var(--card));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px 24px;
}
.auth-card-wide {
    max-width: 420px;
}

.auth-card h1 {
    font-size: 22px;
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}
.auth-sub {
    color: var(--text-muted);
    font-size: 13.5px;
    margin: 0 0 20px;
}

.auth-error {
    background: var(--overdue-bg);
    color: var(--overdue);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
}
.auth-error ul {
    margin: 0;
    padding-left: 18px;
}

.auth-success {
    background: var(--clean-bg);
    color: var(--clean);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-switch {
    margin: 20px 0 0;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* ---------- Onglets créer / rejoindre (CSS only) ---------- */

.tab-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tab-labels {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: var(--field-bg);
    border-radius: 999px;
    padding: 4px;
}
.tab-label {
    flex: 1;
    text-align: center;
    padding: 9px;
    border-radius: 999px;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 12.5px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.tab-panel {
    display: none;
}

#tab-creer:checked ~ .tab-panel-creer,
#tab-rejoindre:checked ~ .tab-panel-rejoindre {
    display: block;
}
#tab-creer:checked ~ .tab-labels label[for="tab-creer"],
#tab-rejoindre:checked ~ .tab-labels label[for="tab-rejoindre"] {
    background: linear-gradient(135deg, oklch(0.78 0.17 300), oklch(0.62 0.19 330));
    color: #fff;
}

/* ---------- Responsive ---------- */

@media (max-width: 380px) {
    .room-tile {
        min-height: 122px;
        padding: 14px;
    }
    .summary-label {
        font-size: 19px;
    }
}

/* ---------- Paramètres ---------- */

.settings-title {
    font-size: 21px;
    margin: 4px 0 18px;
}

.settings-section {
    margin-bottom: 28px;
}

.settings-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.settings-section-head .settings-section-title {
    margin-bottom: 0;
}

.settings-section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 10px;
}

.code-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
}
.code-card-name {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 10px;
}
.code-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.code-card-value {
    font-family: 'Space Grotesk', monospace;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.14em;
}
.settings-hint {
    color: var(--text-muted);
    font-size: 12.5px;
    margin: 10px 0 0;
    line-height: 1.5;
}

.member-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.member-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
}
.member-avatar {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    background: linear-gradient(135deg, oklch(0.78 0.17 300), oklch(0.62 0.19 330));
}
.member-info {
    line-height: 1.5;
}
.member-name {
    font-weight: 700;
    font-size: 14px;
}
.member-you {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
}
.member-email {
    color: var(--text-muted);
    font-size: 12.5px;
}

.settings-room-group {
    margin-bottom: 16px;
}
.settings-room-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    margin: 0 0 8px;
}
.settings-room-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--room-color, var(--text-muted));
    flex: 0 0 auto;
}
.settings-task-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.settings-task-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 12px 12px 14px;
}
.settings-task-info {
    line-height: 1.55;
    min-width: 0;
}
.settings-task-name {
    font-weight: 700;
    font-size: 14px;
}
.settings-task-meta {
    color: var(--text-muted);
    font-size: 12px;
}
.settings-task-edit {
    flex: 0 0 auto;
}

.sheet-actions-split {
    justify-content: flex-end;
    flex-wrap: wrap;
}
.sheet-actions-spacer {
    flex: 1 1 auto;
}
#taskEditDelete {
    color: var(--overdue);
    border-color: var(--overdue-bg);
}
