/**
 * Frontend Admin Role Switcher - Styles front-end
 * Compatible avec WoodMart et WooCommerce
 */

/* ===================================
   Bannière d'indication de rôle
   =================================== */

.fars-role-indicator-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    z-index: 99999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

.fars-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.fars-banner-icon {
    flex-shrink: 0;
}

.fars-banner-icon svg {
    width: 20px;
    height: 20px;
}

.fars-banner-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
}

.fars-banner-text strong {
    font-weight: 600;
}

.fars-role-name,
.fars-user-name {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.fars-banner-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.fars-banner-btn,
.fars-banner-restore-btn {
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.fars-banner-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
}

.fars-banner-btn:hover {
    background: #fff;
    color: #667eea;
}

.fars-banner-restore-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.fars-banner-restore-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.fars-banner-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.fars-banner-close:hover {
    opacity: 1;
}

.fars-banner-close svg {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .fars-banner-content {
        flex-wrap: wrap;
        padding: 10px 15px;
    }

    .fars-banner-actions {
        width: 100%;
        margin-top: 5px;
    }

    .fars-banner-btn,
    .fars-banner-restore-btn {
        flex: 1;
        text-align: center;
    }
}

/* ===================================
   Badge dans le menu My Account
   =================================== */

.fars-menu-badge {
    display: inline-block;
    background: #f44336;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
    vertical-align: middle;
}

/* ===================================
   Admin Bar
   =================================== */

.fars-admin-bar-indicator {
    background: #667eea !important;
    color: #fff !important;
    padding: 0 12px;
    border-radius: 3px;
}

#wp-admin-bar-fars-role-indicator .ab-item {
    background: #667eea !important;
}

#wp-admin-bar-fars-role-indicator:hover .ab-item {
    background: #764ba2 !important;
}

/* ===================================
   Wrapper principal
   =================================== */

.fars-role-switcher-wrapper {
    max-width: 100%;
}

/* ===================================
   Statut actuel
   =================================== */

.fars-current-status {
    background: #f8f9fa;
    border: 2px solid #667eea;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.fars-status-header h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.fars-status-content {
    margin-bottom: 15px;
}

.fars-status-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.fars-status-item:last-child {
    border-bottom: none;
}

.fars-status-label {
    font-weight: 500;
    color: #666;
}

.fars-status-value {
    color: #333;
    font-weight: 500;
}

.fars-status-value strong {
    color: #667eea;
}

.fars-status-actions {
    margin-top: 15px;
    text-align: center;
}

.fars-restore-button {
    background: #f44336 !important;
    color: #fff !important;
    border: none !important;
    padding: 12px 30px !important;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 4px;
}

.fars-restore-button:hover {
    background: #d32f2f !important;
}

/* ===================================
   Formulaire de changement
   =================================== */

.fars-switch-form {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
}

.fars-switch-form h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.fars-search-filters {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 15px;
    margin-bottom: 20px;
}

.fars-filter-group {
    display: flex;
    flex-direction: column;
}

.fars-filter-group label {
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.fars-filter-group .input-text,
.fars-filter-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.fars-user-list-wrapper {
    margin-bottom: 20px;
}

.fars-user-list-wrapper label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

#fars-user-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.fars-loading {
    text-align: center;
    padding: 15px;
    color: #666;
    font-style: italic;
}

/* ===================================
   Informations utilisateur
   =================================== */

.fars-user-info {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
}

.fars-user-info h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.fars-info-table {
    width: 100%;
    border-collapse: collapse;
}

.fars-info-table th,
.fars-info-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.fars-info-table th {
    font-weight: 600;
    color: #666;
    width: 30%;
}

.fars-info-table td {
    color: #333;
}

.fars-info-table tr:last-child th,
.fars-info-table tr:last-child td {
    border-bottom: none;
}

/* ===================================
   Durée d'expiration
   =================================== */

.fars-duration-wrapper {
    margin-bottom: 20px;
}

.fars-duration-wrapper label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.fars-duration-wrapper select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.fars-duration-wrapper .description {
    margin-top: 8px;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

/* ===================================
   Bouton de soumission
   =================================== */

.fars-submit-wrapper {
    text-align: center;
    margin-bottom: 20px;
}

#fars-switch-button {
    background: #667eea !important;
    color: #fff !important;
    border: none !important;
    padding: 14px 40px !important;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 4px;
}

#fars-switch-button:hover:not(:disabled) {
    background: #764ba2 !important;
}

#fars-switch-button:disabled {
    background: #ccc !important;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ===================================
   Messages
   =================================== */

.fars-messages {
    margin-top: 20px;
}

.fars-message {
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.fars-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.fars-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.fars-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ===================================
   Historique
   =================================== */

.fars-history-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
}

.fars-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.fars-history-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.fars-history-table {
    width: 100%;
    border-collapse: collapse;
}

.fars-history-table thead th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
}

.fars-history-table tbody td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.fars-history-table tbody tr:last-child td {
    border-bottom: none;
}

.fars-history-table tbody tr:hover {
    background: #f8f9fa;
}

.fars-action-switch {
    display: inline-block;
    background: #667eea;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.fars-action-restore {
    display: inline-block;
    background: #4caf50;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

/* ===================================
   Responsive
   =================================== */

@media (max-width: 768px) {
    .fars-search-filters {
        grid-template-columns: 1fr;
    }

    .fars-status-item {
        flex-direction: column;
        gap: 5px;
    }

    .fars-history-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .fars-history-table {
        font-size: 14px;
    }

    .fars-history-table thead {
        display: none;
    }

    .fars-history-table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #e0e0e0;
        border-radius: 6px;
    }

    .fars-history-table tbody td {
        display: block;
        text-align: right;
        padding: 10px;
        position: relative;
        padding-left: 50%;
    }

    .fars-history-table tbody td:before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        font-weight: 600;
        text-align: left;
    }
}

/* ===================================
   Animations et transitions
   =================================== */

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===================================
   Classes utilitaires
   =================================== */

.fars-text-center {
    text-align: center;
}

.fars-mt-20 {
    margin-top: 20px;
}

.fars-mb-20 {
    margin-bottom: 20px;
}

/* ===================================
   Compatibilité WoodMart
   =================================== */

.woodmart-theme .fars-role-switcher-wrapper {
    font-family: inherit;
}

.woodmart-theme .fars-switch-form .button,
.woodmart-theme .fars-status-actions .button {
    font-family: inherit;
}

/* Ajustements pour la classe body */
body.fars-role-switching-active {
    padding-top: 60px;
}

/* Ajustement pour l'admin bar */
body.admin-bar.fars-role-switching-active {
    padding-top: 92px;
}

@media (max-width: 782px) {
    body.admin-bar.fars-role-switching-active {
        padding-top: 106px;
    }
}
