/* ── Daily Planner ─────────────────────────────────────────────────────── */

.dp-page {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 0 5rem;
}

/* Back link */
.dp-back-bar { padding: 0.75rem 1rem 0; }

.dp-back-link {
    display: inline-flex;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #1b4861;
    text-decoration: none;
    background: #fff;
    border: 1px solid #cddde8;
    border-radius: 10px;
    padding: 9px 14px;
    min-height: 44px;
}

/* Header navigation */
.dp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0.75rem 0.5rem;
    gap: 0.25rem;
}

.dp-nav-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    font-size: 1.4rem;
    color: var(--color-primary, #6c5ce7);
    text-decoration: none;
    border-radius: 10px;
    background: transparent;
    flex-shrink: 0;
}
.dp-nav-arrow:active { background: rgba(108,92,231,.12); }

.dp-header-center { text-align: center; flex: 1; min-width: 0; }

.dp-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dp-today-badge {
    display: inline-block;
    font-size: 0.72rem;
    background: var(--color-primary, #6c5ce7);
    color: #fff;
    border-radius: 20px;
    padding: 0.1em 0.6em;
    margin-top: 0.2rem;
}

/* Filter bar */
.dp-filter-bar {
    display: flex;
    gap: 0.5rem;
    padding: 0.25rem 1rem 1rem;
}

.dp-filter-btn {
    padding: 0.4rem 1.1rem;
    border-radius: 20px;
    font-size: 0.88rem;
    text-decoration: none;
    color: var(--color-text, #333);
    background: var(--color-surface, #f0f0f0);
    border: 1.5px solid transparent;
    min-height: 40px;
    display: flex;
    align-items: center;
}
.dp-filter-btn.active {
    background: var(--color-primary, #6c5ce7);
    color: #fff;
}

/* ── Récap planning ─────────────────────────────────────────────────────── */

.dp-recap {
    margin: 0 0.75rem 1.25rem;
    background: #fff;
    border-radius: 12px;
    padding: 0.9rem 1rem;
    box-shadow: 0 1px 5px rgba(0,0,0,.08);
}
.dp-recap-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}
.dp-recap-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #888;
}
.dp-recap-total {
    font-size: 0.9rem;
    font-weight: 700;
    color: #333;
}
.dp-recap-bar {
    height: 8px;
    background: #e8e8e8;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.4rem;
}
.dp-recap-done {
    height: 100%;
    background: linear-gradient(90deg,#27ae60,#2ecc71);
    border-radius: 4px;
    transition: width 0.3s;
}
.dp-recap-detail {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #888;
}

/* Section title */
.dp-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    padding: 0 1rem 0.6rem;
    margin: 0;
}
.dp-slot-count {
    background: #f0f0f0;
    border-radius: 12px;
    padding: 0.1em 0.55em;
    font-size: 0.72rem;
    color: #555;
}

/* ── Tâches non planifiées ───────────────────────────────────────────────── */

.dp-unscheduled { margin-bottom: 1.5rem; }

.dp-unscheduled-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    background: #fff;
    margin: 0 0.75rem 0.4rem;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
    flex-wrap: wrap;
}
.dp-unscheduled-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.dp-unscheduled-title {
    font-size: 0.92rem;
    font-weight: 600;
    word-break: break-word;
}
.dp-unscheduled-meta {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.1rem;
}
.dp-assign-form {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}
.dp-time-input {
    font-size: 1rem;
    padding: 0.3rem 0.4rem;
    border-radius: 8px;
    border: 1.5px solid #ddd;
    background: #fff;
    min-height: 40px;
    width: 100px;
}
.dp-assign-btn {
    font-size: 0.88rem;
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    border: none;
    background: var(--color-primary, #6c5ce7);
    color: #fff;
    cursor: pointer;
    min-height: 40px;
    white-space: nowrap;
    font-weight: 600;
}

/* ── Timeline ────────────────────────────────────────────────────────────── */

.dp-timeline-section { margin-bottom: 1rem; }

.dp-timeline {
    padding: 0 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Wrapper d'un slot (card + panneau détail) */
.dp-slot-wrapper {
    display: flex;
    flex-direction: column;
}

/* Carte principale du slot */
.dp-slot {
    display: flex;
    align-items: stretch;
    background: #fff;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    overflow: hidden;
    border-left: 4px solid var(--slot-color, #6c5ce7);
    transition: opacity 0.15s;
}

/* Quand le détail est fermé, arrondi complet en bas */
.dp-slot-wrapper:not(:has(.dp-slot-details[open])) .dp-slot {
    border-radius: 12px;
}

.dp-slot.done { opacity: 0.55; }
.dp-slot.done .dp-slot-title {
    text-decoration: line-through;
    color: #999;
}

/* Colonne heure */
.dp-slot-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.6rem;
    min-width: 62px;
    background: #f7f8fa;
    border-right: 1px solid #eee;
    gap: 0.15rem;
    flex-shrink: 0;
}
.dp-slot-start {
    font-size: 1rem;
    font-weight: 800;
    color: #222;
    line-height: 1;
}
.dp-slot-end {
    font-size: 0.75rem;
    color: #888;
    line-height: 1;
    white-space: nowrap;
}
.dp-slot-duration {
    font-size: 0.68rem;
    color: #aaa;
    background: #eee;
    border-radius: 8px;
    padding: 0.15em 0.4em;
    margin-top: 0.2rem;
    line-height: 1.4;
    white-space: nowrap;
}

/* Corps */
.dp-slot-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex: 1;
    padding: 0.65rem 0.5rem 0.65rem 0.7rem;
    gap: 0.2rem;
}
.dp-slot-title-row {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    min-width: 0;
}
.dp-slot-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.25rem;
}
.dp-slot-title {
    font-size: 0.95rem;
    font-weight: 600;
    /* Wrapping sur mobile, pas d'ellipsis */
    word-break: break-word;
    line-height: 1.35;
}
.dp-slot-who {
    font-size: 0.73rem;
    font-weight: 600;
    padding-left: 1.2rem;
}

/* Bouton valider (toujours visible) */
.dp-slot-quick {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.5rem;
    flex-shrink: 0;
}

.dp-slot-form { margin: 0; }

.dp-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #ddd;
    cursor: pointer;
    font-size: 1.1rem;
    background: #fff;
    color: var(--color-primary, #6c5ce7);
    transition: background 0.15s, border-color 0.15s;
}
.dp-toggle-btn.done {
    background: #d4edda;
    border-color: #27ae60;
    color: #27ae60;
}
.dp-toggle-btn:active { transform: scale(0.93); }

/* ── Panneau détail (expand) ────────────────────────────────────────────── */

.dp-slot-details {
    background: #f0eeff;
    border-radius: 0 0 12px 12px;
    border-left: 4px solid var(--slot-color, #6c5ce7);
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,.07);
}

.dp-slot-details-toggle {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-primary, #6c5ce7);
    min-height: 44px;
    user-select: none;
    border-top: 1px solid rgba(108,92,231,.12);
}
.dp-slot-details-toggle::-webkit-details-marker { display: none; }
.dp-slot-details-toggle::after {
    content: '▾';
    margin-left: auto;
    font-size: 0.85rem;
    transition: transform 0.2s;
}
.dp-slot-details[open] .dp-slot-details-toggle::after { transform: rotate(180deg); }

.dp-slot-details-body {
    padding: 0.6rem 0.9rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.dp-detail-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.dp-detail-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #555;
    min-width: 100px;
}
.dp-time-edit-form {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.dp-detail-time-input {
    font-size: 1rem;
    padding: 0.4rem 0.5rem;
    border: 1.5px solid #c8b8ff;
    border-radius: 8px;
    min-height: 40px;
    width: 110px;
    background: #fff;
}
.dp-detail-ok-btn {
    background: var(--color-primary, #6c5ce7);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    min-height: 40px;
}
.dp-detail-row-delete { margin-top: 0.1rem; }
.dp-detail-delete-btn {
    background: none;
    border: 1.5px solid #ffb3b3;
    border-radius: 8px;
    color: #e74c3c;
    font-size: 0.88rem;
    font-weight: 700;
    padding: 0.45rem 1rem;
    cursor: pointer;
    min-height: 40px;
}
.dp-detail-delete-btn:active { background: #fff0f0; }

/* Connecteur entre slots */
.dp-chain-gap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
}
.dp-chain-gap::before,
.dp-chain-gap::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #eee;
}
.dp-chain-time {
    font-size: 0.72rem;
    color: #aaa;
    white-space: nowrap;
}

.dp-empty {
    padding: 1rem;
    color: #aaa;
    font-size: 0.88rem;
    text-align: center;
}

/* ── Ajouter un créneau ──────────────────────────────────────────────────── */

.dp-add-section { padding: 0.75rem 0.75rem 0; }

.dp-add-details {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 5px rgba(0,0,0,.08);
}

.dp-add-summary {
    padding: 0.9rem 1rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-primary, #6c5ce7);
    cursor: pointer;
    list-style: none;
    min-height: 52px;
    display: flex;
    align-items: center;
}
.dp-add-summary::-webkit-details-marker { display: none; }

.dp-add-form {
    padding: 0 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.dp-add-row { display: flex; gap: 0.5rem; }
.dp-add-row-split { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.dp-add-field { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.dp-add-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #777;
}
.dp-add-input {
    width: 100%;
    font-size: 1rem;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    border: 1.5px solid #ddd;
    background: #fff;
    color: #333;
    min-height: 48px;
    box-sizing: border-box;
}
.dp-add-time,
.dp-add-duration {
    font-size: 1rem;
    padding: 0.5rem 0.5rem;
    border-radius: 10px;
    border: 1.5px solid #ddd;
    background: #fff;
    color: #333;
    min-height: 48px;
    width: 100%;
    box-sizing: border-box;
}
.dp-add-select {
    flex: 1;
    font-size: 1rem;
    padding: 0.5rem 0.5rem;
    border-radius: 10px;
    border: 1.5px solid #ddd;
    background: #fff;
    color: #333;
    min-height: 48px;
}
.dp-add-info { min-height: 1.2rem; }
.dp-add-end-preview {
    font-size: 0.84rem;
    color: var(--color-primary, #6c5ce7);
    font-weight: 700;
}
.dp-add-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.dp-add-btn {
    font-size: 1rem;
    font-weight: 700;
    padding: 0.7rem 1.2rem;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: #fff;
    cursor: pointer;
    min-height: 48px;
    flex: 1;
    box-shadow: 0 2px 8px rgba(108,92,231,.3);
}
.dp-chain-btn {
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.55rem 0.9rem;
    border-radius: 10px;
    border: 1.5px solid var(--color-primary, #6c5ce7);
    background: transparent;
    color: var(--color-primary, #6c5ce7);
    cursor: pointer;
    min-height: 48px;
    flex: 1;
}

/* ── Responsive desktop ─────────────────────────────────────────────────── */

@media (min-width: 561px) {
    .dp-slot-title { font-size: 1rem; }
    .dp-slot-start { font-size: 1.05rem; }
    .dp-add-row-split { grid-template-columns: 1fr 1fr; }
}
