/* ═══════════════════════════════════════════════════════════════
   RDV Calendar — Agenda intégré v7
   ═══════════════════════════════════════════════════════════════ */

#rdv-calendar-admin,
#rdv-calendar-gestion {
    font-family: -apple-system, 'Segoe UI', sans-serif;
    color: #1e293b;
}

/* ── Navigation semaine ─────────────────────────────────────── */
.rdvc-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.rdvc-nav-btn {
    padding: 7px 16px;
    border: 1.5px solid #dde3ef;
    border-radius: 7px;
    background: #f8faff;
    color: #1a56db;
    font-weight: 700;
    font-size: .84rem;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
}
.rdvc-nav-btn:hover { background: #1a56db; color: #fff; border-color: #1a56db; }
.rdvc-week-label {
    font-size: .9rem;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
    flex: 1;
}

/* ── Légende ────────────────────────────────────────────────── */
.rdvc-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-size: .74rem;
}
.rdvc-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: #475569;
}
.rdvc-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}
.rdvc-dot-gc       { background: #3b82f6; }
.rdvc-dot-proposed { background: #dc2626; }
.rdvc-dot-avail    { background: #bbf7d0; border: 1px solid #16a34a; }

/* ── Grille calendrier ──────────────────────────────────────── */
.rdvc-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
}
.rdvc-grid {
    min-width: 600px;
    position: relative;
}

/* En-tête jours */
.rdvc-head {
    display: grid;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
}
.rdvc-head-time {
    width: 50px;
    flex-shrink: 0;
    border-right: 1px solid #e2e8f0;
}
.rdvc-head-day {
    padding: 8px 4px;
    text-align: center;
    font-size: .75rem;
    font-weight: 700;
    color: #475569;
    border-right: 1px solid #e2e8f0;
}
.rdvc-head-day.rdvc-today {
    background: #eff6ff;
    color: #1a56db;
}
.rdvc-head-day .rdvc-day-num {
    display: block;
    font-size: 1rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.2;
}
.rdvc-head-day.rdvc-today .rdvc-day-num {
    background: #1a56db;
    color: #fff;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2px;
}

/* Corps de la grille */
.rdvc-body {
    display: grid;
    position: relative;
}
.rdvc-row {
    display: grid;
    border-bottom: 1px solid #f1f5f9;
    min-height: 28px;
}
.rdvc-row.rdvc-row-hour {
    border-bottom-color: #e2e8f0;
}
.rdvc-time-cell {
    width: 50px;
    flex-shrink: 0;
    font-size: .65rem;
    color: #94a3b8;
    font-family: monospace;
    padding: 0 4px;
    text-align: right;
    line-height: 28px;
    border-right: 1px solid #e2e8f0;
    user-select: none;
}
.rdvc-day-cell {
    position: relative;
    border-right: 1px solid #f1f5f9;
    min-height: 28px;
    cursor: default;
}
.rdvc-day-cell.rdvc-avail {
    background: #f0fdf4;
    cursor: pointer;
}
.rdvc-day-cell.rdvc-avail:hover {
    background: #dcfce7;
}

/* ── Événements (positionnés en absolute) ───────────────────── */
.rdvc-event {
    position: absolute;
    left: 2px;
    right: 2px;
    border-radius: 4px;
    padding: 2px 5px;
    font-size: .68rem;
    font-weight: 600;
    overflow: hidden;
    cursor: pointer;
    z-index: 5;
    transition: filter .15s;
    box-sizing: border-box;
    line-height: 1.3;
}
.rdvc-event:hover { filter: brightness(0.9); z-index: 6; }

/* Google Calendar event colors */
.rdvc-event-gc {
    background: #dbeafe;
    border-left: 3px solid #3b82f6;
    color: #1d4ed8;
}
.rdvc-event-gc.rdvc-color-1  { background: #fce7f3; border-color: #ec4899; color: #be185d; } /* Lavender */
.rdvc-event-gc.rdvc-color-2  { background: #ede9fe; border-color: #8b5cf6; color: #6d28d9; } /* Sage */
.rdvc-event-gc.rdvc-color-3  { background: #fef9c3; border-color: #eab308; color: #854d0e; } /* Grape */
.rdvc-event-gc.rdvc-color-4  { background: #ffedd5; border-color: #f97316; color: #9a3412; } /* Flamingo */
.rdvc-event-gc.rdvc-color-5  { background: #fef9c3; border-color: #eab308; color: #854d0e; } /* Banana */
.rdvc-event-gc.rdvc-color-6  { background: #dcfce7; border-color: #22c55e; color: #15803d; } /* Sage */
.rdvc-event-gc.rdvc-color-7  { background: #d1fae5; border-color: #10b981; color: #047857; } /* Basil */
.rdvc-event-gc.rdvc-color-8  { background: #e0e7ff; border-color: #6366f1; color: #4338ca; } /* Peacock */
.rdvc-event-gc.rdvc-color-9  { background: #dbeafe; border-color: #3b82f6; color: #1d4ed8; } /* Blueberry */
.rdvc-event-gc.rdvc-color-10 { background: #e0f2fe; border-color: #0ea5e9; color: #0369a1; } /* Lavender */
.rdvc-event-gc.rdvc-color-11 { background: #fee2e2; border-color: #ef4444; color: #b91c1c; } /* Tomato */

/* Créneau proposé par client */
.rdvc-event-proposed {
    background: #fee2e2;
    border-left: 3px solid #dc2626;
    color: #991b1b;
    cursor: pointer;
    animation: rdvc-pulse 2s infinite;
}
@keyframes rdvc-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.3); }
    50%       { box-shadow: 0 0 0 4px rgba(220,38,38,.1); }
}

/* ── Popup actions ──────────────────────────────────────────── */
#rdvc-popup {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.55);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
}
.rdvc-popup-box {
    background: #fff;
    border-radius: 12px;
    padding: 22px;
    max-width: 420px;
    width: 92%;
    box-shadow: 0 12px 40px rgba(0,0,0,.25);
    position: relative;
}
.rdvc-popup-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #94a3b8;
    line-height: 1;
}
.rdvc-popup-box h3 {
    margin: 0 0 12px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 7px;
}
.rdvc-popup-info {
    background: #f8faff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 11px 13px;
    margin-bottom: 14px;
    font-size: .82rem;
}
.rdvc-popup-info p {
    margin: 2px 0;
    display: flex;
    gap: 6px;
}
.rdvc-popup-info p strong {
    color: #475569;
    min-width: 70px;
    flex-shrink: 0;
}
.rdvc-popup-slot-label {
    font-size: .8rem;
    font-weight: 700;
    color: #dc2626;
    margin-bottom: 8px;
}
.rdvc-popup-actions {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.rdvc-popup-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #f8faff;
    cursor: pointer;
    font-size: .84rem;
    font-weight: 600;
    font-family: inherit;
    text-align: left;
    transition: all .15s;
    color: #1e293b;
}
.rdvc-popup-btn:hover { transform: translateX(3px); }
.rdvc-btn-validate { border-color: #16a34a; background: #f0fdf4; color: #166534; }
.rdvc-btn-validate:hover { background: #16a34a; color: #fff; }
.rdvc-btn-modify  { border-color: #1a56db; background: #eff6ff; color: #1d4ed8; }
.rdvc-btn-modify:hover  { background: #1a56db; color: #fff; }
.rdvc-btn-delete  { border-color: #dc2626; background: #fff5f5; color: #991b1b; }
.rdvc-btn-delete:hover  { background: #dc2626; color: #fff; }

/* ── Mode sélection autre créneau ───────────────────────────── */
.rdvc-selecting-mode .rdvc-day-cell.rdvc-avail {
    background: #fef9c3;
    cursor: crosshair;
    animation: rdvc-selecting 1.2s infinite;
}
@keyframes rdvc-selecting {
    0%, 100% { background: #fef9c3; }
    50%       { background: #fde68a; }
}
.rdvc-select-banner {
    background: #1a56db;
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: .84rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 10px;
    display: none;
}

/* ── Tooltip événement Google ───────────────────────────────── */
.rdvc-tooltip {
    position: fixed;
    background: #1e293b;
    color: #fff;
    border-radius: 8px;
    padding: 10px 13px;
    font-size: .77rem;
    max-width: 260px;
    z-index: 99999;
    box-shadow: 0 4px 16px rgba(0,0,0,.3);
    pointer-events: none;
    line-height: 1.5;
}
.rdvc-tooltip-title {
    font-weight: 700;
    margin-bottom: 4px;
    font-size: .82rem;
}

/* ── Loading ────────────────────────────────────────────────── */
.rdvc-loading {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
    font-size: .88rem;
}
.rdvc-loading::before {
    content: '';
    display: block;
    width: 28px;
    height: 28px;
    border: 3px solid #e2e8f0;
    border-top-color: #1a56db;
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: rdvc-spin .7s linear infinite;
}
@keyframes rdvc-spin { to { transform: rotate(360deg); } }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
    .rdvc-time-cell { width: 36px; font-size: .58rem; }
    .rdvc-head-time { width: 36px; }
    .rdvc-event { font-size: .6rem; padding: 1px 3px; }
    .rdvc-nav-btn { padding: 6px 10px; font-size: .78rem; }
}
