/* Sidebarhello */
.sidebar { min-height: 100vh; background: #2c3e50; color: white; position: fixed; width: 220px; left: 0; top: 0; z-index: 1000; }
.sidebar .nav-link { color: #adb5bd; padding: 12px 20px; display: flex; align-items: center; gap: 12px; }
.sidebar .nav-link:hover, .sidebar .nav-link.active { color: white; background: #34495e; }
.sidebar .nav-link i { font-size: 18px; width: 24px; text-align: center; }
.sidebar .nav-text { white-space: nowrap; }
.main-content { margin-left: 220px; padding: 20px; min-height: 100vh; background: #f1f5f9; }

/* Sidebar Collapsed Mode */
.sidebar.sidebar-collapsed { width: 70px; }
.sidebar.sidebar-collapsed .sidebar-header { display: none; }
.sidebar.sidebar-collapsed .nav-link { justify-content: center; padding: 15px; }
.sidebar.sidebar-collapsed .nav-text { display: none; opacity: 0; transition: opacity 0.2s; }
.sidebar.sidebar-collapsed:hover { width: 220px; }
.sidebar.sidebar-collapsed:hover .nav-text { display: inline; opacity: 1; }
.sidebar.sidebar-collapsed:hover .nav-link { justify-content: flex-start; }
.main-content.sidebar-collapsed { margin-left: 70px; transition: margin-left 0.2s; }
.sidebar.sidebar-collapsed:hover ~ .main-content { margin-left: 220px; }

/* User Account Menu in Sidebar */
.user-account-item {
    border-top: 1px solid #34495e;
    padding-top: 15px;
    margin-top: auto;
}
.user-account-item .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #adb5bd;
    text-decoration: none;
    transition: all 0.2s;
}
.user-account-item .nav-link:hover {
    background: #34495e;
    color: white;
}
.user-icon-wrapper {
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.user-icon-wrapper i {
    font-size: 20px;
    color: #3498db;
}
.user-account-item .nav-text {
    font-size: 13px;
    font-weight: 500;
}

/* Plan Badge - separate li without icon */
.user-plan-item {
    padding: 8px 15px;
    border-top: 1px solid #34495e;
}
.plan-badge {
    background: #27ae60;
    color: white;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    display: block;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

/* Collapsed state - hide both user items */
.sidebar.sidebar-collapsed .user-account-item,
.sidebar.sidebar-collapsed .user-plan-item {
    display: none !important;
}

.page-header { background: white; padding: 20px; border-radius: 12px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* Hide spans in planning cards */
.day-events .event-card span,
.planning-container .event-card span { display: none !important; }

/* ================================
   PLANNING EDITOR - RESPONSIVE LAYOUT
   ================================ */

/* Main editor container - full width */
.editor-layout {
    display: flex;
    gap: 20px;
    width: 100%;
    height: calc(100vh - 120px);
}

/* Planning container - takes remaining space */
.planning-container {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    align-content: start;
    min-width: 0;
    overflow-x: auto;
}

/* Day column - responsive sizing */
.day-column {
    background: white;
    border-radius: 12px;
    padding: 10px 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    min-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

/* Day header - responsive font size */
.day-header {
    text-align: center;
    font-weight: 600;
    font-size: clamp(10px, 1.2vw, 14px);
    color: #1e293b;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Zone de drop - fills column */
.day-events {
    flex: 1;
    padding: 5px;
    transition: background 0.2s;
    min-height: 200px;
    position: relative;
}

.day-events-hover {
    background: rgba(34, 197, 94, 0.1) !important;
    border-radius: 8px;
}

/* No feedback on column hover */
.day-events.drag-over {
    background: transparent;
    border: none;
}

/* Section jour wrapper for mobile day view */
.sectionjour {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

/* ================================
   EVENT CARD - RESPONSIVE DESIGN
   ================================ */

.event-card {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 8px;
    padding: 6px 8px;
    margin-bottom: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: grab;
    transition: all 0.2s ease;
    border-left: 4px solid #64748b;
    position: relative;
    min-height: 50px;
    /* Responsive sizing */
    font-size: clamp(10px, 1vw, 13px);
}

/* Dynamically inserted event cards */
.event-card[data-event-id],
.event-card:not([data-saved]) {
    display: flex !important;
    visibility: visible !important;
}

.event-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.event-card.sortable-ghost {
    opacity: 0.4;
}

.event-card.sortable-drag {
    opacity: 1;
}

/* Placeholder for drop position */
.sortable-placeholder {
    background: #dcfce7;
    border: 2px dashed #22c55e;
    border-radius: 8px;
    min-height: 50px;
    margin-bottom: 4px;
}

/* Temporary placeholder during AJAX save */
.temp-placeholder {
    background: #fef3c7 !important;
    border-left-color: #f59e0b !important;
    border-style: dashed !important;
    cursor: wait !important;
}

.temp-placeholder:hover {
    transform: none !important;
    box-shadow: none !important;
}

.temp-placeholder .event-actions {
    display: none !important;
}

/* Time input */
.event-time-input {
    border: none;
    background: transparent;
    font-weight: 700;
    font-size: inherit;
    color: #475569;
    text-align: center;
    padding: 0;
    outline: none;
    min-width: 45px;
}

.event-time-input:focus {
    border: none;
}

/* Event content */
.event-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-right: 0;
    min-width: 0;
}

.event-image {
    width: 100%;
    height: clamp(28px, 3vw, 40px);
    border-radius: 6px;
    object-fit: cover;
    background: #f1f5f9;
    flex-shrink: 0;
}

.event-info {
    display: none;
}

.event-name {
    font-weight: 600;
    font-size: inherit;
    color: #1e293b;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-coach {
    font-size: 0.85em;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Event actions */
.event-actions {
    position: absolute;
    right: 2px;
    bottom: 0px;
    /* opacity: 0; */
    transition: opacity 0.2s;
}

.event-card:hover .event-actions {
    opacity: 1;
}

.event-delete {
    color: #ffffff;
    background: red;
    border: none;
    cursor: pointer;
    font-size: 10px;
    border-radius: 20px;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    padding: 0;
}

.event-delete:hover {
    background: #dc2626;
}

/* Event config button */
.event-config {
    color: #ffffff;
    background: #3b82f6;
    border: none;
    cursor: pointer;
    font-size: 10px;
    border-radius: 20px;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    padding: 0;
    margin-right: 4px;
}

.event-config:hover {
    background: #2563eb;
}

/* ================================
   LIBRARY PANEL
   ================================ */

.library-panel {
    width: 240px;
    flex-shrink: 0;
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    height: fit-content;
    position: fixed;
    top: 168px;
    right: 10px;
    overflow-y: auto;
}

.library-title {
    font-weight: 600;
    font-size: clamp(12px, 1vw, 14px);
    color: #1e293b;
    margin-bottom: 12px;
}

.library-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.library-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: clamp(11px, 0.9vw, 13px);
    cursor: grab;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.library-item:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

.library-item img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.library-item.dragging {
    opacity: 0.5;
}

/* ================================
   RESPONSIVE BREAKPOINTS
   ================================ */

/* Large desktop - 7 days visible */
@media (max-width: 1400px) {
    .day-column {
        padding: 8px 4px;
    }
    .event-card {
        padding: 4px 6px;
        min-height: 44px;
    }
    .library-panel {
        width: 200px;
    }
}

/* Desktop */
@media (max-width: 1200px) {
    .planning-container {
        grid-template-columns: repeat(7, 1fr);
        gap: 4px;
    }
    .day-column {
        padding: 6px 3px;
    }
    .event-card {
        font-size: 10px;
        padding: 3px 5px;
        min-height: 40px;
    }
    .event-image {
        width: 24px;
        height: 24px;
    }
    .library-panel {
        width: 180px;
    }
}

/* Tablet landscape */
@media (max-width: 1024px) {
    .planning-container {
        grid-template-columns: repeat(5, 1fr);
    }
    .sidebar-collapsed .main-content {
        margin-left: 70px;
    }
}

/* =============================================
   SIDEBAR MOBILE - Gestion du menu hamburger
   ============================================= */

/* Bouton hamburger mobile */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 6px;
    left: 6px;
    z-index: 1030;
    width: 45px;
    height: 45px;
    background: #fbfbfb;
    color: #343a40;
    border: none;
    border-radius: 8px;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    background: #34495e;
    transform: scale(1.05);
}

/* Overlay pour fermer la sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Bouton fermer dans la sidebar (mobile) */
.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    transition: background 0.2s;
}

.sidebar-close-btn:hover {
    background: rgba(255,255,255,0.1);
}

/* Tablet portrait */
@media (max-width: 768px) {
    /* Afficher le bouton hamburger */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Sidebar cachée par défaut sur mobile */
    .sidebar {
        position: fixed;
        left: -220px;
        width: 220px;
        height: 100vh;
        top: 0;
        z-index: 1050;
        transition: left 0.3s ease;
        overflow-y: auto;
    }

    /* Sidebar ouverte */
    .sidebar.active {
        left: 0;
    }

    /* Afficher le bouton fermer */
    .sidebar-close-btn {
        display: block;
    }

    /* Toujours afficher le texte des liens en mobile */
    .sidebar .nav-text {
        display: inline !important;
    }

    /* Main-content prend toute la largeur */
    .main-content {
        margin-left: 0 !important;
        padding: 70px 15px 15px 15px;
        width: 100%;
        min-height: 100vh;
    }

    /* Ajuster le header du dashboard */
    .dashboard-header {
        margin-top: 10px;
    }

    /* Stats cards en 2 colonnes sur mobile */
    .stats-row .col-6 {
        padding: 0 8px;
    }

    .stats-row .card-body {
        padding: 1rem 0.5rem;
    }

    .stats-row h3 {
        font-size: 1.5rem;
    }

    .stats-row small {
        font-size: 0.75rem;
    }

    /* Tableau des plannings scrollable */
    .table-responsive {
        border: none;
    }

    .table-responsive table {
        min-width: 600px;
    }

    /* Section abonnement en colonne sur mobile */
    .subscription-row .col-md-8,
    .subscription-row .col-md-4 {
        text-align: center !important;
    }

    .subscription-row .btn {
        width: 100%;
    }

    /* Editor layout */
    .editor-layout {
        flex-direction: column;
        height: auto;
    }

    .planning-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .planning-container.day-view-mobile {
        display: block;
    }

    .library-panel {
        width: 100%;
        position: static;
        max-height: 200px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .planning-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .planning-container.day-view-mobile {
        display: block;
    }
    .day-header {
        font-size: 12px;
    }
    .event-card {
        font-size: 11px;
        padding: 4px;
    }
    .library-item {
        padding: 6px 8px;
    }
}

/* Modal */
.time-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.time-modal.active {
    display: flex;
}

.time-modal-content {
    background: white;
    border-radius: 12px;
    padding: 20px;
    min-width: 200px;
}

.time-modal-title {
    font-weight: 600;
    margin-bottom: 15px;
    text-align: center;
}

.time-modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.time-modal-buttons button {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
}

.time-modal-buttons .btn-confirm {
    background: #22c55e;
    color: white;
}

.time-modal-buttons .btn-cancel {
    background: #e2e8f0;
    color: #475569;
}

/* ================================
   SECTION STYLES
   ================================ */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-reorder {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: white;
    border-radius: 5px;
}

.section-reorder .btn {
    padding: 2px 6px;
    line-height: 1;
    color: #6c757d;
}

.section-reorder .btn:hover {
    color: #2563eb;
}

.section-reorder .btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Notification toast */
.planning-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 99999;
    opacity: 0;
    transform: translateY(100%);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    min-width: 280px;
    max-width: 400px;
}

.planning-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.planning-notification-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-left: 4px solid #15803d;
}

.planning-notification-error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-left: 4px solid #b91c1c;
}

.planning-notification-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-left: 4px solid #1d4ed8;
}

.section-title-editable:hover {
    text-decoration: underline;
}

/* Day navigation */
.myplanning-day-nav {
    position: fixed;
    bottom: 30px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 100;
}

.myplanning-day-nav-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #333;
}

.myplanning-day-nav-left {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.myplanning-day-nav-right {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.myplanning-day-nav-current {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 30px;
    background: white;
    padding: 8px 20px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    font-weight: 600;
    font-size: 16px;
}

