/**
 * Wedding Manager - Frontend CSS
 * Interface identique au BO - Style Donezo
 */

:root {
    --wm-primary: #4770FF;
    --wm-primary-dark: #3558D9;
    --wm-primary-light: #6B8AFF;
    --wm-primary-lighter: #E8EEFF;
    --wm-success: #10B981;
    --wm-success-light: #D1FAE5;
    --wm-warning: #F59E0B;
    --wm-warning-light: #FEF3C7;
    --wm-danger: #EF4444;
    --wm-danger-light: #FEE2E2;
    --wm-gray-50: #F9FAFB;
    --wm-gray-100: #F3F4F6;
    --wm-gray-200: #E5E7EB;
    --wm-gray-300: #D1D5DB;
    --wm-gray-400: #9CA3AF;
    --wm-gray-500: #6B7280;
    --wm-gray-600: #4B5563;
    --wm-gray-700: #374151;
    --wm-gray-800: #1F2937;
    --wm-gray-900: #111827;
    --wm-sidebar-width: 260px;
}

/* Container Principal */
.wm-frontend-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--wm-gray-50);
    min-height: 100vh;
    display: flex;
    position: relative;
}

/* Sidebar */
.wm-frontend-sidebar {
    width: var(--wm-sidebar-width);
    background: white;
    border-right: 1px solid var(--wm-gray-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
}

.wm-frontend-sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--wm-gray-200);
}

.wm-frontend-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--wm-gray-900);
    text-decoration: none;
}

.wm-frontend-logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--wm-primary) 0%, var(--wm-primary-light) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.wm-frontend-menu {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.wm-frontend-section {
    margin-bottom: 32px;
}

.wm-frontend-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--wm-gray-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 20px;
    margin-bottom: 8px;
}

.wm-frontend-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--wm-gray-600);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
    position: relative;
    cursor: pointer;
}

.wm-frontend-nav-item:hover {
    background: var(--wm-gray-50);
    color: var(--wm-gray-900);
}

.wm-frontend-nav-item.active {
    background: var(--wm-primary-lighter);
    color: var(--wm-primary);
}

.wm-frontend-nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--wm-primary);
    border-radius: 0 3px 3px 0;
}

.wm-frontend-nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.wm-frontend-badge {
    margin-left: auto;
    background: var(--wm-primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.wm-frontend-sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--wm-gray-200);
}

.wm-frontend-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--wm-gray-50);
    border-radius: 10px;
}

.wm-frontend-avatar {
    width: 40px;
    height: 40px;
    background: var(--wm-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
}

.wm-frontend-user-details {
    flex: 1;
    min-width: 0;
}

.wm-frontend-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--wm-gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wm-frontend-user-email {
    font-size: 12px;
    color: var(--wm-gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Content Area */
.wm-frontend-content {
    flex: 1;
    margin-left: var(--wm-sidebar-width);
    padding: 32px 40px;
    max-width: 100%;
}

.wm-frontend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.wm-frontend-header-title h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--wm-gray-900);
    margin: 0 0 4px 0;
    letter-spacing: -0.02em;
}

.wm-frontend-header-subtitle {
    font-size: 14px;
    color: var(--wm-gray-500);
}

.wm-frontend-header-actions {
    display: flex;
    gap: 12px;
}

/* Components (identiques au BO) */
.wm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    background: var(--wm-primary);
    color: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.wm-btn:hover {
    background: var(--wm-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(71, 112, 255, 0.3);
}

.wm-btn-secondary {
    background: white;
    color: var(--wm-gray-700);
    border: 1px solid var(--wm-gray-300);
}

.wm-btn-secondary:hover {
    background: var(--wm-gray-50);
    border-color: var(--wm-gray-400);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.wm-btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.wm-grid {
    display: grid;
    gap: 24px;
    margin-bottom: 32px;
}

.wm-grid-2 { grid-template-columns: repeat(2, 1fr); }
.wm-grid-3 { grid-template-columns: repeat(3, 1fr); }
.wm-grid-4 { grid-template-columns: repeat(4, 1fr); }

.wm-stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--wm-gray-200);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.wm-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

.wm-stat-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--wm-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.wm-stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--wm-gray-900);
    line-height: 1;
    margin-bottom: 8px;
}

.wm-stat-description {
    font-size: 13px;
    color: var(--wm-gray-500);
}

.wm-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--wm-gray-200);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 32px;
}

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

.wm-card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--wm-gray-900);
    margin: 0;
}

.wm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.wm-table thead th {
    background: var(--wm-gray-50);
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--wm-gray-600);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--wm-gray-200);
}

.wm-table tbody td {
    padding: 16px;
    border-bottom: 1px solid var(--wm-gray-100);
    color: var(--wm-gray-700);
}

.wm-table tbody tr:hover {
    background: var(--wm-gray-50);
}

.wm-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
}

.wm-badge-success {
    background: var(--wm-success-light);
    color: var(--wm-success);
}

.wm-badge-warning {
    background: var(--wm-warning-light);
    color: #92400E;
}

.wm-badge-danger {
    background: var(--wm-danger-light);
    color: var(--wm-danger);
}

.wm-badge-gray {
    background: var(--wm-gray-100);
    color: var(--wm-gray-600);
}

/* Login Page */
.wm-login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--wm-primary) 0%, var(--wm-primary-light) 100%);
    padding: 20px;
}

.wm-login-box {
    background: white;
    border-radius: 20px;
    padding: 48px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.wm-login-header {
    text-align: center;
    margin-bottom: 32px;
}

.wm-login-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--wm-primary) 0%, var(--wm-primary-light) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 32px;
}

.wm-login-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--wm-gray-900);
    margin: 0 0 8px 0;
}

.wm-login-subtitle {
    font-size: 14px;
    color: var(--wm-gray-500);
}

.wm-form-group {
    margin-bottom: 20px;
}

.wm-form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--wm-gray-700);
    margin-bottom: 8px;
}

.wm-form-input {
    width: 100%;
    padding: 11px 14px;
    font-size: 14px;
    color: var(--wm-gray-900);
    background: white;
    border: 1px solid var(--wm-gray-300);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.wm-form-input:focus {
    outline: none;
    border-color: var(--wm-primary);
    box-shadow: 0 0 0 4px var(--wm-primary-lighter);
}

/* === Mobile Header === */
.wm-mobile-header {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    /* Header mobile */
    .wm-mobile-header {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        background: white;
        border-bottom: 1px solid var(--wm-gray-200);
        position: sticky;
        top: 0;
        z-index: 100;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }
    
    .wm-mobile-menu-btn {
        width: 40px;
        height: 40px;
        background: var(--wm-primary);
        color: white;
        border: none;
        border-radius: 10px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        transition: all 0.2s ease;
    }
    
    .wm-mobile-menu-btn:active {
        transform: scale(0.95);
    }
    
    .wm-mobile-menu-btn svg {
        width: 22px;
        height: 22px;
    }
    
    .wm-mobile-header-title {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 17px;
        font-weight: 700;
        color: var(--wm-gray-900);
    }
    
    .wm-mobile-header-title svg {
        width: 20px;
        height: 20px;
        stroke: var(--wm-primary);
    }
    
    /* Sidebar mobile */
    .wm-frontend-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }
    
    .wm-frontend-sidebar.mobile-open {
        transform: translateX(0);
    }
    
    /* Overlay */
    .wm-mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 999;
    }
    
    .wm-mobile-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }
    
    /* Contenu */
    
    .wm-frontend-content {
        margin-left: 0;
        padding: 20px;
    }
    
    .wm-grid-2,
    .wm-grid-3,
    .wm-grid-4 {
        grid-template-columns: 1fr;
    }
    
    .wm-frontend-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}

/* Modal (identique au BO) */
.wm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(8px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.wm-modal.active {
    display: flex;
}

.wm-modal-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.wm-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid var(--wm-gray-200);
}

.wm-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--wm-gray-900);
    margin: 0;
}

.wm-modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--wm-gray-100);
    color: var(--wm-gray-600);
    font-size: 20px;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.wm-modal-close:hover {
    background: var(--wm-gray-200);
}

.wm-modal-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
}

.wm-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 28px;
    border-top: 1px solid var(--wm-gray-200);
    background: var(--wm-gray-50);
}

/* ========================================
   RESPONSIVE - MEDIA QUERIES
   ======================================== */

/* Tablettes et petits écrans (< 1024px) */
@media (max-width: 1024px) {
    .wm-frontend-content {
        padding: 24px 20px;
    }
    
    .wm-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .wm-frontend-header {
        flex-direction: column;
        gap: 16px;
    }
    
    .wm-frontend-header-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

/* Mobiles et petits tablettes (< 768px) */
@media (max-width: 768px) {
    /* Sidebar frontend */
    .wm-frontend-sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 1000;
        transition: transform 0.3s ease;
        width: 280px;
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
    }
    
    .wm-frontend-sidebar.mobile-open {
        transform: translateX(0);
    }
    
    /* Overlay sombre */
    .wm-mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .wm-mobile-overlay.active {
        display: block;
        opacity: 1;
    }
    
    .wm-frontend-content {
        margin-left: 0 !important;
        padding: 16px 12px;
    }
    
    /* Header responsive */
    .wm-frontend-header {
        gap: 12px;
    }
    
    .wm-frontend-header-title h1 {
        font-size: 24px;
    }
    
    .wm-frontend-header-subtitle {
        font-size: 13px;
    }
    
    .wm-frontend-header-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .wm-frontend-header-actions > * {
        width: 100%;
    }
    
    /* Grilles responsive */
    .wm-grid-2,
    .wm-grid-3,
    .wm-grid-4 {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    /* Stat cards */
    .wm-stat-card {
        padding: 16px;
    }
    
    .wm-stat-value {
        font-size: 28px;
    }
    
    /* Cards */
    .wm-card {
        padding: 16px;
        border-radius: 12px;
    }
    
    .wm-card-header {
        padding: 0 0 12px 0;
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    /* Tables responsive */
    .wm-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .wm-table thead {
        display: none;
    }
    
    .wm-table tbody {
        display: block;
    }
    
    .wm-table tr {
        display: block;
        margin-bottom: 16px;
        border: 1px solid var(--wm-gray-200);
        border-radius: 8px;
        padding: 12px;
        background: white;
    }
    
    .wm-table td {
        display: block;
        text-align: left !important;
        padding: 8px 0;
        border: none;
    }
    
    .wm-table td:before {
        content: attr(data-label);
        font-weight: 600;
        display: block;
        margin-bottom: 4px;
        color: var(--wm-gray-600);
        font-size: 12px;
        text-transform: uppercase;
    }
    
    /* Boutons */
    .wm-btn,
    .wm-btn-secondary,
    .wm-btn-danger {
        width: 100%;
        justify-content: center;
    }
    
    /* Modals */
    .wm-modal-content {
        width: 95%;
        max-width: 95%;
        margin: 20px auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .wm-modal-header,
    .wm-modal-body,
    .wm-modal-footer {
        padding: 16px;
    }
    
    .wm-modal-footer {
        flex-direction: column;
        gap: 8px;
    }
    
    .wm-modal-footer .wm-btn {
        width: 100%;
    }
    
    /* Badges */
    .wm-badge {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    /* Plan de table */
    #seating-plan {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .wm-table-item {
        width: 120px !important;
        height: 120px !important;
        font-size: 12px;
    }
    
    /* Invités non assignés */
    .wm-guest-draggable {
        font-size: 12px;
        padding: 6px 10px;
    }
}

/* Très petits mobiles (< 480px) */
@media (max-width: 480px) {
    .wm-frontend-content {
        padding: 12px 8px;
    }
    
    .wm-frontend-header-title h1 {
        font-size: 20px;
    }
    
    .wm-stat-value {
        font-size: 24px;
    }
    
    .wm-stat-label {
        font-size: 11px;
    }
    
    .wm-card {
        padding: 12px;
    }
    
    .wm-btn {
        font-size: 13px;
        padding: 10px 16px;
    }
}

/* Mode paysage mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .wm-modal-content {
        max-height: 95vh;
    }
    
    .wm-modal-body {
        max-height: 60vh;
        overflow-y: auto;
    }
}

/* Print */
@media print {
    .wm-frontend-sidebar,
    .wm-mobile-header,
    .wm-mobile-overlay,
    .wm-frontend-header-actions,
    .wm-btn,
    .wm-modal {
        display: none !important;
    }
    
    .wm-frontend-content {
        margin-left: 0 !important;
        padding: 0;
    }
    
    .wm-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
