/**
 * Styles pour la page de gestion de visibilité frontend
 */

.wbtm-frontend-visibility-wrap {
    margin: 20px 20px 20px 0;
}

.wbtm-frontend-visibility-wrap h1 {
    margin-bottom: 10px;
}

.wbtm-frontend-visibility-wrap .description {
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
}

/* Filtres */
.wbtm-visibility-filters {
    background: #fff;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #ccd0d4;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
    display: flex;
    align-items: flex-end;
    gap: 15px;
    flex-wrap: wrap;
}

.wbtm-visibility-filters .filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1 1 auto;
    min-width: 200px;
}

.wbtm-visibility-filters .filter-group:first-child {
    flex: 2 1 auto;
    min-width: 250px;
}

.wbtm-visibility-filters label {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

.wbtm-visibility-filters input[type="text"],
.wbtm-visibility-filters select {
    height: 36px;
    width: 100%;
}

.wbtm-visibility-filters #bus-search {
    min-width: 100%;
}

.wbtm-visibility-filters button {
    flex-shrink: 0;
}

/* Loading */
.wbtm-loading {
    text-align: center;
    padding: 40px;
    background: #fff;
    border: 1px solid #ccd0d4;
}

.wbtm-loading .spinner {
    float: none;
    margin: 0 auto 10px;
}

/* Table wrapper pour scroll horizontal */
#wbtm-visibility-content {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Table */
.wbtm-visibility-table {
    background: #fff;
    min-width: 900px;
}

.wbtm-visibility-table th {
    font-weight: 600;
    white-space: nowrap;
}

.wbtm-visibility-table .column-bus-name {
    width: 25%;
    min-width: 200px;
}

.wbtm-visibility-table .column-route {
    width: 30%;
    min-width: 250px;
}

.wbtm-visibility-table .column-visibility {
    width: 15%;
    min-width: 150px;
}

.wbtm-visibility-table .column-dates {
    width: 30%;
    min-width: 300px;
}

/* Bus row */
.bus-row {
    position: relative;
}

.bus-row.hidden-bus {
    background-color: #fff8e5;
}

.bus-name-cell {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.bus-title {
    font-weight: 600;
    font-size: 14px;
}

.bus-id {
    font-size: 12px;
    color: #666;
}

.edit-bus-link {
    font-size: 12px;
    text-decoration: none;
}

.route-text {
    font-size: 13px;
    color: #444;
}

/* Toggle switch */
.visibility-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.toggle-switch input:checked+.toggle-slider {
    background-color: #2271b1;
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(26px);
}

.toggle-switch input:disabled+.toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.toggle-label {
    font-size: 13px;
    font-weight: 500;
}

.toggle-label.visible {
    color: #2271b1;
}

.toggle-label.hidden {
    color: #d63638;
}

/* Dates summary */
.dates-summary {
    padding: 8px 12px;
    background-color: #fff3cd;
    border-left: 3px solid #ffc107;
    margin-bottom: 12px;
    font-size: 13px;
    color: #856404;
}

.dates-summary strong {
    color: #d63638;
    font-size: 14px;
}

/* Dates list */
.dates-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.date-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: #f6f7f7;
    border-radius: 4px;
    border-left: 3px solid transparent;
}

.date-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-item.date-visible {
    border-left-color: #2271b1;
}

.date-item.date-hidden {
    border-left-color: #d63638;
    background: #fff8e5;
}

.date-text {
    font-size: 13px;
    font-weight: 500;
    min-width: 80px;
}

.date-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-toggle .toggle-switch {
    width: 40px;
    height: 20px;
}

.date-toggle .toggle-slider:before {
    height: 14px;
    width: 14px;
}

.date-toggle input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

.date-toggle .toggle-label {
    font-size: 12px;
}

.no-dates {
    font-size: 13px;
    color: #666;
    font-style: italic;
}

.show-dates-btn {
    font-size: 12px;
    cursor: pointer;
    color: #2271b1;
    text-decoration: none;
    padding: 4px 8px;
    border: 1px solid #2271b1;
    border-radius: 3px;
    background: #fff;
    transition: all 0.2s;
}

.show-dates-btn:hover {
    background: #2271b1;
    color: #fff;
}

/* Messages */
.wbtm-message {
    padding: 12px;
    margin: 15px 0;
    border-left: 4px solid;
    background: #fff;
}

.wbtm-message.success {
    border-left-color: #00a32a;
    background: #f0f6fc;
}

.wbtm-message.error {
    border-left-color: #d63638;
    background: #fcf0f1;
}

.wbtm-message p {
    margin: 0;
    font-size: 13px;
}

/* No results */
#wbtm-no-results {
    background: #fff;
    padding: 40px;
    text-align: center;
    border: 1px solid #ccd0d4;
}

#wbtm-no-results p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

/* Responsive */
@media screen and (max-width: 1280px) {
    .wbtm-visibility-filters .filter-group {
        min-width: 180px;
    }

    .wbtm-visibility-filters .filter-group:first-child {
        min-width: 220px;
    }
}

@media screen and (max-width: 960px) {
    .wbtm-visibility-filters {
        gap: 10px;
    }

    .wbtm-visibility-filters .filter-group {
        min-width: 150px;
        flex: 1 1 calc(50% - 10px);
    }

    .wbtm-visibility-filters .filter-group:first-child {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .wbtm-visibility-filters button {
        width: 100%;
    }
}

@media screen and (max-width: 782px) {
    .wbtm-frontend-visibility-wrap {
        margin: 10px 10px 10px 0;
    }

    .wbtm-visibility-filters {
        padding: 15px;
        flex-direction: column;
        align-items: stretch;
    }

    .wbtm-visibility-filters .filter-group {
        width: 100%;
        min-width: 100%;
        flex: 1 1 100%;
    }

    .wbtm-visibility-filters .filter-group:first-child {
        min-width: 100%;
    }

    .wbtm-visibility-filters #bus-search {
        min-width: 100%;
    }

    .wbtm-visibility-filters button {
        width: 100%;
        margin-top: 5px;
    }

    /* Indicateur de scroll pour le tableau */
    #wbtm-visibility-content::after {
        content: '← Faites défiler →';
        display: block;
        text-align: center;
        padding: 10px;
        background: #f0f0f1;
        color: #666;
        font-size: 12px;
        border-top: 1px solid #ccd0d4;
    }

    .wbtm-visibility-table {
        font-size: 13px;
    }

    .bus-name-cell {
        flex-direction: column;
        gap: 3px;
    }

    .date-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

@media screen and (max-width: 600px) {
    .wbtm-visibility-table {
        min-width: 800px;
        font-size: 12px;
    }

    .dates-list {
        gap: 6px;
    }

    .toggle-switch {
        transform: scale(0.9);
    }
}

/* Paramètres de pré-réservation */
.pre-reservation-settings {
    background: #fff;
    padding: 10px;
    border: 1px solid #ccd0d4;
    border-radius: 3px;
    margin-top: 5px;
}

.pre-res-header {
    margin-bottom: 8px;
    font-size: 12px;
}

.pre-res-header label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.pre-res-text {
    width: 100%;
    height: 60px;
    font-size: 12px;
    margin-bottom: 8px !important;
    display: block;
}

.save-pre-reservation {
    display: block;
    width: 100%;
}

/* Frontend Banner - Updated Design */
.wbtm-pre-reservation-banner {
    background: #fffdf2 !important;
    border: 1px solid #ffca28 !important;
    border-left: 10px solid #e65100 !important;
    color: #4e342e !important;
    padding: 15px !important;
    margin: 0px 0px -10px 0px !important;
    border-radius: 8px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    align-content: flex-start !important;
    font-family: inherit !important;
    position: relative !important;
    box-shadow: none !important;
}

.wbtm-pre-reservation-banner::before {
    display: none !important;
}

.wbtm-pre-reservation-banner::after {
    display: none !important;
}

.wbtm-pre-res-header {
    display: flex !important;
    align-items: center !important;
    margin-bottom: 10px !important;
    gap: 15px !important;
}

/* Badge style for title */
.wbtm-pre-res-header strong {
    background: #e65100 !important;
    color: #fff !important;
    padding: 6px 12px !important;
    border-radius: 4px !important;
    text-transform: uppercase !important;
    font-size: 11px !important;
    letter-spacing: 0.5px !important;
    display: inline-block !important;
    margin: 0 !important;
    font-weight: bold !important;
}

.wbtm-pre-res-content {
    font-size: 14px !important;
    line-height: 1.5 !important;
    white-space: pre-wrap !important;
}

@media (min-width: 768px) {
    .wbtm-pre-res-header::before {
        content: "\f05a" !important;
        font-family: "Font Awesome 5 Free" !important;
        font-weight: 900 !important;
        color: #e65100 !important;
        font-size: 28px !important;
    }
}

@media screen and (max-width: 767px) {
    .wbtm-pre-res-header::before {
        display: none !important;
    }
}

/* Bouton pré-réserver uniquement */
.wbtm-btn-pre-res,
.wbtm-btn-pre-res span {
    font-size: 12px !important;
}

/* Compact version for cart and checkout */
.wbtm-pre-reservation-banner.wbtm-pre-res-compact {
    padding: 10px 12px !important;
    margin: 10px 0 !important;
    font-size: 13px !important;
}

.wbtm-pre-reservation-banner.wbtm-pre-res-compact .wbtm-pre-res-header {
    margin-bottom: 5px !important;
    gap: 10px !important;
}

.wbtm-pre-reservation-banner.wbtm-pre-res-compact .wbtm-pre-res-header strong {
    font-size: 10px !important;
    padding: 4px 8px !important;
}

.wbtm-pre-reservation-banner.wbtm-pre-res-compact .wbtm-pre-res-content {
    font-size: 12px !important;
}

@media (min-width: 768px) {
    .wbtm-pre-reservation-banner.wbtm-pre-res-compact .wbtm-pre-res-header::before {
        font-size: 20px !important;
    }
}