/**
 * Main.css - Design futuriste iOS 17 / macOS
 * SAS Prouteau Space
 */

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #007AFF;
    --primary-hover: #0051D5;
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f7;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --border-color: #e5e5e7;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
}

/* ===== CONTAINER PRINCIPAL ===== */
.sap-space-container {
    position: relative;
    min-height: 100vh;
    width: 100%;
    display: flex;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ===== POPUP DE BIENVENUE ===== */
.sap-welcome-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.5s ease;
}

.sap-welcome-popup.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

.sap-fireworks-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.sap-firework {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    animation: explode 2s ease-out infinite;
    box-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #fff;
}

@keyframes explode {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(20);
        opacity: 0;
    }
}

.sap-welcome-content {
    text-align: center;
    color: white;
    z-index: 1;
    animation: bounce 1s ease infinite;
}

.sap-welcome-popup-title {
    font-size: 48px;
    margin-bottom: 20px;
}

.sap-user-id-display {
    font-size: 32px;
    font-weight: bold;
    color: #FFD700;
    margin: 20px 0;
}

.sap-date-display {
    font-size: 20px;
    margin: 10px 0;
}

.sap-saint-display {
    font-size: 18px;
    color: #FFB6C1;
}

/* ===== EFFETS DE FOND DYNAMIQUES ===== */
.sap-background-effects {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

/* Bulles */
.sap-bubble {
    position: absolute;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.05));
    border-radius: 50%;
    animation: float 10s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-100vh) scale(1.2);
    }
}

/* Feux d'artifice */
.sap-firework-burst {
    position: absolute;
    width: 5px;
    height: 5px;
    background: #fff;
    border-radius: 50%;
    animation: burst 3s ease-out infinite;
}

@keyframes burst {
    0% {
        transform: scale(0);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 1);
    }
    50% {
        box-shadow: 0 0 50px 20px rgba(255, 200, 0, 0.8);
    }
    100% {
        transform: scale(30);
        box-shadow: 0 0 100px 50px rgba(255, 100, 100, 0);
    }
}

/* Particules */
.sap-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: white;
    border-radius: 50%;
    animation: particleFloat 20s linear infinite;
}

@keyframes particleFloat {
    from {
        transform: translateY(100vh) rotate(0deg);
    }
    to {
        transform: translateY(-100vh) rotate(360deg);
    }
}

/* ===== SIDEBAR DESKTOP ===== */
.sap-sidebar-desktop {
    position: fixed;
    left: 0;
    top: 0;
    width: 70px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sap-sidebar-desktop:hover {
    width: 260px;
}

.sap-sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    min-height: 80px;
}

.sap-company-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
}

.sap-company-name {
    font-weight: 600;
    line-height: 1.3;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s;
}

.sap-sidebar-desktop:hover .sap-company-name {
    opacity: 1;
}

.sap-company-subtitle {
    font-size: 12px;
    color: #666;
}

/* Recherche */
.sap-search-container {
    padding: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.sap-search-wrapper {
    position: relative;
}

.sap-search-input {
    width: 100%;
    height: 36px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 10px;
    padding: 0 10px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
}

.sap-search-wrapper i {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #86868b;
    opacity: 0;
    transition: opacity 0.3s;
}

.sap-sidebar-desktop:hover .sap-search-wrapper i {
    opacity: 1;
}

/* Menu */
.sap-sidebar-menu {
    flex: 1;
    padding: 10px 0;
    overflow-y: auto;
}

.sap-sidebar-menu::-webkit-scrollbar {
    width: 4px;
}

.sap-sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
}

.sap-menu-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin: 4px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.sap-menu-item:hover {
    background: rgba(0, 122, 255, 0.08);
    transform: translateX(4px) scale(1.05);
}

.sap-menu-item.active {
    background: linear-gradient(135deg, #007AFF 0%, #0066CC 100%);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.sap-menu-item.active .sap-menu-icon,
.sap-menu-item.active .sap-menu-label {
    color: white !important;
}

.sap-menu-icon {
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: transform 0.2s;
}

.sap-menu-item:hover .sap-menu-icon {
    transform: scale(1.2);
}

.sap-menu-label {
    margin-left: 12px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
}

.sap-sidebar-desktop:hover .sap-menu-label {
    opacity: 1;
}

/* Footer sidebar */
.sap-sidebar-footer {
    padding: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.sap-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.sap-user-info:hover {
    background: rgba(0, 0, 0, 0.05);
}

.sap-user-info img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(0, 122, 255, 0.2);
}

.sap-user-details {
    opacity: 0;
    transition: opacity 0.3s;
}

.sap-sidebar-desktop:hover .sap-user-details {
    opacity: 1;
}

.sap-user-name {
    font-size: 13px;
    font-weight: 600;
}

.sap-user-role {
    font-size: 11px;
    color: #666;
}

/* ===== CONTENU PRINCIPAL ===== */
.sap-main-content {
    flex: 1;
    margin-left: 70px;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Pages swipeable */
.sap-pages-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.sap-pages-container {
    display: flex;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sap-widget-page {
    min-width: 100%;
    height: 100%;
    padding: 20px;
    overflow-y: auto;
}

/* Header dashboard */
.sap-dashboard-header {
    margin-bottom: 30px;
}

.sap-dashboard-title {
    font-size: 32px;
    font-weight: 700;
    color: white;
    margin-bottom: 10px;
}

.sap-dashboard-subtitle {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
}

/* Zone de widgets */
.sap-widgets-drop-zone {
    min-height: 400px;
    padding: 20px;
}

.sap-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: white;
}

.sap-empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Indicateurs de pages */
.sap-page-indicators {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 99;
}

.sap-page-dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

.sap-page-dot.active {
    background: white;
    width: 24px;
    border-radius: 4px;
}

/* Bouton d'ajout */
.sap-add-widget-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
}

.sap-add-widget-btn:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.6);
}

/* Zone poubelle */
.sap-trash-zone {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 80px;
    background: #ff3b30;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    animation: pulse 1s ease infinite;
    z-index: 1000;
}

@keyframes pulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.1); }
}

/* ===== ROUE MOBILE (masquée sur desktop) ===== */
.sap-mobile-wheel {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    overflow: hidden;
    z-index: 200;
}

.sap-wheel-container {
    position: absolute;
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    transition: transform 0.3s ease;
}

.sap-wheel-item {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    left: 50%;
    top: 50%;
    margin-left: -25px;
    margin-top: -25px;
}

.sap-wheel-item-content {
    font-size: 20px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    /* Masquer sidebar desktop */
    .sap-sidebar-desktop {
        display: none;
    }
    
    /* Afficher roue mobile */
    .sap-mobile-wheel {
        display: block;
    }
    
    .sap-main-content {
        margin-left: 0;
    }
    
    .sap-dashboard-title {
        font-size: 24px;
    }
    
    .sap-add-widget-btn {
        bottom: 140px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .sap-page-indicators {
        bottom: 140px;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* ===== WIDGETS (drag & drop) ===== */
.sap-widget {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    cursor: move;
    transition: transform 0.2s;
}

.sap-widget:hover {
    transform: scale(1.05);
}

.sap-widget.dragging {
    opacity: 0.5;
    cursor: grabbing;
}