/* Dashboard CSS - LinkOW */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: #f5f5f5;
    color: #333;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Sidebar (Desktop) */
.sidebar {
    width: 260px;
    background: #1a1a1a;
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
}

.sidebar-header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    width: 140px;
    height: auto;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 25px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left: 3px solid #1a73e8;
}

.nav-item i {
    font-size: 18px;
    width: 20px;
}

.nav-item.logout {
    margin-top: 20px;
    color: #ff6b6b;
}

.nav-item.logout:hover {
    background: rgba(255, 107, 107, 0.1);
}

/* Main Content (Desktop) */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 40px;
    max-width: 1200px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.content-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a1a;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Cards */
.card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    /* Assure que la carte ne déborde pas */
    overflow: hidden; 
}

.card h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Profile URL Card */
.profile-url-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.profile-url-card h3 {
    color: white;
    margin-bottom: 15px;
}

.url-container {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.url-input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-family: 'Courier New', monospace;
    /* Correction: Évite le débordement sur très petits écrans */
    min-width: 0;
}

.url-input::selection {
    background: rgba(255, 255, 255, 0.3);
}

.help-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

/* Forms */
.profile-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.form-input,
.form-select,
.form-textarea {
    padding: 14px 16px;
    border: 2px solid #e8eaed;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s;
    background: #f8f9fa;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #1a73e8;
    background: white;
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    /* Correction: Empêche le bouton de déborder sur mobile */
    white-space: nowrap; 
}

.btn-primary {
    background: #1a1a1a;
    color: white;
}

.btn-primary:hover {
    background: #333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background: #f1f3f4;
    color: #333;
}

.btn-secondary:hover {
    background: #e8eaed;
}

.btn:active {
    transform: translateY(0);
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: #e6f7e6;
    color: #2d7a2d;
    border: 1px solid #b8e6b8;
}

.alert-error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

/* Social Links */
.social-list {
    margin-bottom: 30px;
}

.social-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 10px;
}

.social-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    /* Correction: Permet à l'URL de se couper si elle est trop longue */
    min-width: 0; 
}

.social-info i {
    font-size: 24px;
    width: 30px;
    text-align: center;
    flex-shrink: 0;
}

.social-platform {
    font-weight: 600;
    min-width: 100px;
}

.social-url {
    color: #666;
    text-decoration: none;
    font-size: 14px;
    /* Correction: Permet à l'URL de s'afficher sans déborder */
    overflow: hidden;
    text-overflow: ellipsis; 
    white-space: nowrap;
    display: block;
}

.social-url:hover {
    color: #1a73e8;
}

.btn-delete {
    padding: 8px 12px;
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}

.btn-delete:hover {
    background: #fcc;
}

/* Add Social Form */
.add-social-form {
    padding-top: 20px;
    border-top: 2px dashed #e8eaed;
}

.inline-form {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.inline-form .form-select {
    min-width: 150px;
}

.inline-form .form-input {
    flex: 1;
    min-width: 200px;
}

/* Photo Upload Section */
.photo-upload-section {
    display: flex;
    gap: 30px;
    align-items: center;
    flex-wrap: wrap;
}

.current-photo {
    flex-shrink: 0;
}

.preview-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #e8eaed;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.preview-photo:hover {
    transform: scale(1.05);
    border-color: #1a73e8;
}

.upload-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.file-label {
    cursor: pointer;
    margin: 0;
}

.file-label:hover {
    background: #e8eaed;
}

.upload-form .help-text {
    width: 100%;
    margin-top: 15px;
}

/* Loading state */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* --- Styles de la Modale de Recadrage (Cropper) --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 10000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.8); 
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border-radius: 15px;
    width: 90%; 
    max-width: 600px;
    animation: zoomIn 0.3s ease-out;
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-title {
    font-size: 20px;
    margin-bottom: 15px;
    color: #1a1a1a;
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close-btn:hover,
.close-btn:focus {
    color: #333;
    text-decoration: none;
    cursor: pointer;
}

.cropper-container-wrapper {
    max-height: 400px; 
    margin-bottom: 20px;
}

.modal-buttons {
    text-align: center;
}


/* ================================================= */
/* LOGIQUE MOBILE : Sidebar Drawer & Burger Button */
/* ================================================= */

/* Burger Menu Button (Hidden on Desktop) */
.burger-menu-btn {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1001;
    display: none;
    width: 44px;
    height: 44px;
    background: #1a1a1a;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.3s;
}

.burger-menu-btn:hover {
    background: #333;
}

/* Overlay for mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

/* State when menu is open */
/* MODIFIÉ: Le menu glisse depuis la droite */
.sidebar.active {
    transform: translateX(0);
}


/* Media Query pour Mobile (Tablette et Smartphones) */
@media (max-width: 768px) {
    
    .burger-menu-btn {
        display: block;
    }
    
    .main-content {
        margin-left: 0; 
        padding: 20px 10px; 
        padding-top: 80px; /* Add space for the fixed top bar */
        max-width: 100%; 
    }
    
    /* Sidebar: Becomes a hidden drawer on the right */
    .sidebar {
        position: fixed; 
        top: 0;
        right: 0; /* Position à droite */
        left: initial; /* Désactiver la position gauche */
        width: 280px; /* Drawer width - augmenté pour plus d'espace */
        max-width: 85%; /* Ne pas dépasser 85% de l'écran */
        height: 100%;
        transform: translateX(100%); /* Cacher en le déplaçant à droite */
        box-shadow: -4px 0 10px rgba(0, 0, 0, 0.3); /* Ombre sur le bord gauche */
        z-index: 1000;
    }
    
    /* Show overlay when menu is active */
    .sidebar-overlay.active {
        display: block;
    }

    /* Fix the sidebar header on mobile */
    .sidebar-header {
        text-align: center;
        padding: 20px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        position: sticky;
        top: 0;
        background: #1a1a1a;
        z-index: 10;
    }
    
    .sidebar-logo {
        width: 120px;
    }
    
    /* Navigation links on mobile */
    .sidebar-nav {
        display: flex;
        flex-direction: column;
        padding: 10px 0;
        gap: 0;
    }
    
    .nav-item {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 15px;
        padding: 18px 25px;
        font-size: 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    .nav-item.active {
        background: rgba(255, 255, 255, 0.1);
        border-left: 4px solid #1a73e8;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    .nav-item:hover {
        background: rgba(255, 255, 255, 0.08);
    }
    
    .nav-item span {
        display: inline;
        flex: 1;
    }

    .nav-item i {
        font-size: 20px;
        width: 24px;
        margin-right: 0;
        margin-bottom: 0;
    }
    
    /* S'assurer que le bouton déconnexion est bien visible */
    .nav-item.logout {
        margin-top: auto; /* Pousse le bouton vers le bas si possible */
        border-top: 2px solid rgba(255, 107, 107, 0.2);
        background: rgba(255, 107, 107, 0.05);
    }
    
    .nav-item.logout:hover {
        background: rgba(255, 107, 107, 0.15);
    }
    
    /* Fixed header for mobile content */
    .content-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 50;
        background: #ffffff;
        padding: 15px 20px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        margin-bottom: 0;
        flex-direction: row;
        align-items: center;
        justify-content: center; 
    }
    
    .content-header h1 {
        display: none;
    }
    
    .header-actions {
        flex-grow: 1;
        justify-content: center;
        display: flex;
        gap: 10px;
    }
    
    /* Responsive details */
    /* FIX: Empiler les colonnes du formulaire sur mobile pour éviter le découpage */
    .form-row {
        grid-template-columns: 1fr; /* Force une seule colonne */
        gap: 20px; /* Conserver l'espace standard du formulaire */
    }

    .form-group, .form-label, .form-input, .form-select, .form-textarea, .url-container {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .url-input {
        min-width: 0;
    }
    
    .inline-form {
        gap: 5px;
    }

    .inline-form .form-input, .inline-form .form-select {
        min-width: 100%;
        flex: 1 1 100%;
    }
}

/* Media Query pour très petits écrans (smartphones) */
@media (max-width: 480px) {
    .main-content {
        padding: 15px; 
        padding-top: 80px; /* Maintain space */
    }
    
    .card {
        padding: 20px;
    }
    
    /* NOUVEAU: Le bouton Voir mon profil est déjà centré par les règles ci-dessus */
    .header-actions {
        /* Ne rien cacher, le bouton est important */
    }

    /* Full width on very small screens for better readability */
    .nav-item {
        flex: 1 1 100%; 
    }
}