/* Container général */
.um-ec-wrap {
    max-width: 100%;
    overflow-x: auto;
}

/* Contrôles (navigation + bouton) */
.um-ec-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    flex-direction: column;
}

.um-ec-controls>div {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: right;
}

.um-ec-controls button {
    padding: 8px 16px;
    border: 2px solid #AF3838;
    background: #000;
    color: #fff;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.um-ec-controls button:hover {
    background: #AF3838;
}

.um-ec-prev,
.um-ec-next {
    font-size: 20px;
    min-width: 40px;
}

.um-ec-current-week {
    flex: 1;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    min-width: 200px;
    margin: auto;
}

/* Calendrier */
.um-ec-calendar {
    padding: 20px;
    min-width: 100%;
}

/* Ligne en flex */
.um-ec-row {
    display: flex;
    margin-bottom: 12px;
    gap: 10px;
}

/* Cellule */
.um-ec-cell {
    flex: 1;
    border: 2px solid #AF3838;
    border-radius: 5px;
    padding: 8px;
    min-height: 50px;
    position: relative;
    box-sizing: border-box;
    background: #fff;
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.um-ec-cell:hover {
    box-shadow: 0 2px 8px rgba(175, 56, 56, 0.3);
}

/* En-têtes du calendrier */
.um-ec-header-cell {
    background: #000;
    color: #fff;
    font-weight: 700;
    padding: 8px;
    text-align: center;
    cursor: default;
    font-size: 14px;
}

/* Contenu interne d'une journée */
.um-ec-day-inner {
    min-height: 120px;
}

/* Événements */
.um-ec-event {
    background: #2d6cdf;
    color: #fff;
    padding: 6px 8px;
    margin-bottom: 6px;
    border-radius: 4px;
    cursor: pointer;
    outline: none;
    font-size: 13px;
    transition: transform 0.2s, box-shadow 0.2s;
    word-wrap: break-word;
}

.um-ec-event:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(45, 108, 223, 0.3);
}

.um-ec-event:focus {
    box-shadow: 0 0 0 3px rgba(45, 108, 223, 0.25);
}

/* Modal */
.um-ec-modal {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.um-ec-modal-content {
    background: #000;
    color: #fff;
    padding: 24px;
    border-radius: 6px;
    max-width: 500px;
    width: 100%;
    position: relative;
    border: 2px solid #AF3838;
    max-height: 90vh;
    overflow-y: auto;
}

.um-ec-modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #fff;
    text-align: center;
}

/* Bouton fermeture modal */
.um-ec-modal-close {
    position: absolute;
    right: 15px;
    top: 15px;
    border: none !important;
    background: #AF3838;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.um-ec-modal-close:hover {
    background: #d44444;
}

/* Formulaire dans modal */
#um-ec-form label {
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
    color: #fff;
    font-size: 14px;
}

#um-ec-form input[type="text"],
#um-ec-form input[type="time"],
#um-ec-form input[type="date"],
#um-ec-form select {
    width: 100%;
    padding: 10px;
    margin-top: 4px;
    margin-bottom: 8px;
    box-sizing: border-box;
    border: 2px solid #AF3838;
    border-radius: 4px;
    background: #222;
    color: #fff;
    font-size: 14px;
}

#um-ec-form input:focus,
#um-ec-form select:focus {
    outline: none;
    border-color: #2d6cdf;
}

/* Bouton submit */
.um-ec-btn {
    background: #2d6cdf;
    color: #fff;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    font-size: 16px;
    font-weight: 600;
    transition: background 0.3s;
    margin-top: 10px;
}

.um-ec-btn:hover:not(:disabled) {
    background: #1f5acc;
}

.um-ec-btn:disabled {
    background: #666;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Boutons d'action du tooltip */
.um-ec-edit-btn,
.um-ec-delete-btn,
.um-ec-copy-btn {
    width: 100% !important;
    border: 1px solid #AF3838 !important;
    margin-bottom: 8px;
    padding: 8px 10px !important;
    background: #222 !important;
    color: #fff !important;
    border-radius: 4px !important;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    display: flex !important;
    align-items: center;
    gap: 8px;
}

.um-ec-edit-btn:hover,
.um-ec-delete-btn:hover,
.um-ec-copy-btn:hover {
    background: #333 !important;
}

/* Tooltip info événement */
.um-ec-tooltip {
    position: absolute;
    background: #222;
    border: 2px solid #AF3838;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 16px;
    width: 280px;
    max-width: calc(100vw - 40px);
    font-family: Arial, sans-serif;
    font-size: 14px;
    color: #ffffff;
    z-index: 10000;
}

.um-ec-tooltip-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 12px;
    border-bottom: 2px solid #AF3838;
    padding-bottom: 8px;
    text-align: center;
    color: #fff;
}

.um-ec-tooltip-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 10px;
}

.um-ec-tooltip-row .label {
    font-weight: 600;
    color: #9d9d9d;
    flex-basis: 45%;
    flex-shrink: 0;
}

.um-ec-tooltip-row .value {
    flex-basis: 55%;
    text-align: right;
    color: #fff;
    word-wrap: break-word;
}

.um-ec-tooltip hr {
    border: none;
    border-top: 1px solid #444;
    margin: 12px 0;
}

.um-ec-tooltip-actions {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 2px solid #AF3838;
}

/* Colonnes et layout formulaire */
.um-ec-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Checkbox avec label */
.um-ec-checkbox {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.um-ec-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

/* Bouton toggle équipe */
.um-ec-team-toggle {
    width: 100%;
    padding: 10px;
    margin-top: 4px;
    background: #222 !important;
    border: 2px solid #AF3838 !important;
    border-radius: 4px !important;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.um-ec-team-toggle:hover {
    background: #333;
    border-color: #2d6cdf;
}

.um-ec-team-toggle .um-ec-team-icon {
    font-size: 18px;
}

.um-ec-team-toggle .um-ec-team-text {
    flex: 1;
}

/* Message de formulaire */
.um-ec-form-msg {
    margin-top: 10px;
    font-weight: 600;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
}

/* ========================================
   RESPONSIVE DESIGN - TABLETTES
   ======================================== */

@media (max-width: 1024px) {
    .um-ec-calendar {
        padding: 15px;
    }

    .um-ec-cell {
        padding: 6px;
    }

    .um-ec-day-inner {
        min-height: 100px;
    }

    .um-ec-event {
        font-size: 12px;
        padding: 5px 6px;
    }

    .um-ec-header-cell {
        font-size: 12px;
        padding: 6px;
    }

    .um-ec-tooltip {
        width: 260px;
    }
}

/* ========================================
   RESPONSIVE DESIGN - MOBILES
   ======================================== */

@media (max-width: 768px) {
    .um-ec-controls {
        justify-content: center;
    }

    .um-ec-open-modal {
        width: 100%;
        order: 1;
    }

    .um-ec-current-week {
        flex-basis: 50%;
        order: 5;
        margin-bottom: 8px;
        font-size: 14px;
    }

    .um-ec-prev {
        order: 4;
    }

    .um-ec-next {
        order: 6;
    }

    .um-ec-calendar {
        padding: 10px;
    }

    /* Mode liste pour mobile */
    .um-ec-row:not(.um-ec-header) {
        flex-direction: column;
    }

    .um-ec-header {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .um-ec-header .um-ec-cell {
        min-width: 80px;
        flex-shrink: 0;
    }

    .um-ec-cell {
        width: 100%;
        margin-bottom: 10px;
    }

    .um-ec-day-inner {
        min-height: 60px;
    }

    .um-ec-event {
        font-size: 13px;
    }

    /* Formulaire modal responsive */
    .um-ec-modal {
        padding: 10px;
    }

    .um-ec-modal-content {
        padding: 20px 16px;
        max-height: 95vh;
    }

    .um-ec-row {
        flex-direction: column;
        gap: 0;
    }

    .um-ec-col {
        width: 100%;
    }

    .um-ec-tooltip {
        width: 260px;
        left: 50% !important;
        transform: translateX(-50%);
    }

    .um-ec-today {
        width: 100%;
    }

    .um-ec-bulk-delete {
        width: 100%;
    }

    .um-ec-row-1 {
        flex-direction: column;
    }
}

/* ========================================
   RESPONSIVE DESIGN - PETITS MOBILES
   ======================================== */

@media (max-width: 480px) {
    .um-ec-controls button {
        padding: 6px 12px;
        font-size: 14px;
    }

    .um-ec-current-week {
        font-size: 13px;
    }

    .um-ec-calendar {
        padding: 5px;
    }

    .um-ec-modal-content {
        padding: 16px 12px;
    }

    .um-ec-modal-content h3 {
        font-size: 18px;
    }

    #um-ec-form input,
    #um-ec-form select {
        padding: 8px;
        font-size: 14px;
    }

    .um-ec-tooltip {
        width: calc(100vw - 30px);
        font-size: 13px;
    }

    .um-ec-tooltip-title {
        font-size: 15px;
    }

    .um-ec-edit-btn,
    .um-ec-delete-btn,
    .um-ec-copy-btn {
        font-size: 13px !important;
        padding: 6px 8px !important;
    }
}

/* ========================================
   MODE PAYSAGE MOBILE
   ======================================== */

@media (max-width: 768px) and (orientation: landscape) {
    .um-ec-row:not(.um-ec-header) {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .um-ec-cell {
        flex-basis: calc(50% - 5px);
    }

    .um-ec-day-inner {
        min-height: 80px;
    }
}

/* ========================================
   ACCESSIBILITÉ
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* Focus visible pour navigation clavier */
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid #2d6cdf;
    outline-offset: 2px;
}

/* Amélioration du contraste */
@media (prefers-contrast: high) {
    .um-ec-cell {
        border-width: 3px;
    }

    .um-ec-event {
        border: 2px solid #fff;
    }
}

/* Bouton semaine actuelle */
.um-ec-today {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    order: 2;
}

.um-ec-today:hover {
    background: #45a049;
}

.um-ec-bulk-delete {
    order: 3;
}

/* Modal suppression en masse */
.um-ec-bulk-filters {
    margin-bottom: 20px;
}

.um-ec-bulk-list {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 4px;
    padding: 10px;
    margin: 20px 0;
}

.um-ec-bulk-header {
    padding: 10px;
    border: 2px solid;
    margin: -10px -10px 10px -10px;
    border-radius: 4px 4px 0 0;
}

.um-ec-bulk-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border: 1px solid #eee;
    cursor: pointer;
}

.um-ec-bulk-item:hover {
    background: #282525;
}

.um-ec-bulk-item input[type="checkbox"] {
    margin-right: 10px;
}

.um-ec-bulk-info {
    display: flex;
    flex-direction: column;
}

.um-ec-bulk-info small {
    color: #666;
    font-size: 12px;
    margin-top: 4px;
}

.um-ec-bulk-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
    flex-direction: column;
}

.um-ec-btn-danger {
    background: #f44336 !important;
}

.um-ec-btn-danger:hover {
    background: #da190b !important;
}

.um-ec-bulk-modal-close {
    float: right;
}