/* Reset et variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --success: #48bb78;
    --danger: #f56565;
    --warning: #ed8936;
    --dark: #2d3748;
    --light: #f7fafc;
    --gray: #718096;
    --border: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Page de connexion */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary);
    font-size: 2rem;
}

/* Onglets */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray);
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Formulaires */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--gray);
    font-size: 0.875rem;
}

/* Boutons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--gray);
    color: white;
}

.btn-secondary:hover {
    background: #4a5568;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #38a169;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #e53e3e;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

/* Alertes */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-success {
    background: #c6f6d5;
    color: #22543d;
    border-left: 4px solid var(--success);
}

.alert-error {
    background: #fed7d7;
    color: #742a2a;
    border-left: 4px solid var(--danger);
}

.demo-credentials {
    margin-top: 20px;
    padding: 15px;
    background: var(--light);
    border-radius: 8px;
    font-size: 0.875rem;
}

.demo-credentials p {
    margin: 5px 0;
}

/* Navigation */
.navbar {
    background: white;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-link {
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
    padding: 8px 15px;
    border-radius: 5px;
    transition: all 0.3s;
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary);
    color: white;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 20px;
    border-left: 2px solid var(--border);
}

.badge {
    background: var(--warning);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
}

/* Container principal */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    min-height: calc(100vh - 120px);
}

/* Dashboard */
.dashboard-header {
    text-align: center;
    margin-bottom: 40px;
}

.dashboard-header h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
}

.stat-icon {
    font-size: 3rem;
}

.stat-info h3 {
    font-size: 2rem;
    margin-bottom: 5px;
}

.stat-info p {
    opacity: 0.9;
}

/* Actions rapides */
.quick-actions {
    margin-bottom: 40px;
}

.quick-actions h3 {
    margin-bottom: 20px;
    color: var(--dark);
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.action-card {
    background: var(--light);
    padding: 25px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--dark);
    transition: all 0.3s;
    border: 2px solid var(--border);
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.action-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.action-card h4 {
    margin-bottom: 10px;
    color: var(--primary);
}

.action-card p {
    font-size: 0.9rem;
    color: var(--gray);
}

/* Activité récente */
.recent-activity {
    margin-top: 40px;
}

.recent-activity h3 {
    margin-bottom: 20px;
    color: var(--dark);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.activity-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: var(--light);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.activity-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.activity-details {
    flex: 1;
}

.activity-details p {
    margin-bottom: 5px;
}

.activity-details small {
    color: var(--gray);
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.page-header h2 {
    color: var(--primary);
}

/* Dossiers */
.folders-section {
    margin-bottom: 40px;
}

.folders-section h3 {
    margin-bottom: 20px;
}

.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.folder-card {
    background: white;
    border: 2px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.folder-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.folder-header {
    height: 150px;
    background: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.folder-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.folder-preview.empty {
    font-size: 4rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.folder-info {
    padding: 20px;
}

.folder-info h4 {
    margin-bottom: 10px;
    color: var(--primary);
}

.folder-info p {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.folder-info small {
    color: var(--gray);
}

.folder-content {
    margin-top: 20px;
    padding: 20px;
    background: var(--light);
    border-radius: 8px;
}

.folder-content h4 {
    margin-bottom: 15px;
    color: var(--primary);
}

/* Grille de photos */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.photo-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.photo-card:hover img {
    transform: scale(1.1);
}

.photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: 15px;
    opacity: 0;
    transition: opacity 0.3s;
}

.photo-card:hover .photo-overlay {
    opacity: 1;
}

.photo-overlay p {
    color: white;
    font-size: 0.875rem;
    margin-bottom: 5px;
}

.photo-overlay small {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
}

/* Galerie */
.filters {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--light);
    border-radius: 8px;
}

.filter-form {
    flex: 1;
}

.filter-form select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    display: flex;
    align-items: flex-end;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.photo-info {
    color: white;
}

.photo-info h4 {
    margin-bottom: 10px;
    font-size: 1rem;
}

.photo-info p {
    font-size: 0.875rem;
    margin-bottom: 5px;
    opacity: 0.9;
}

.photo-info small {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    overflow: auto;
}

.lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90vh;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.lightbox-content img {
    width: 100%;
    height: auto;
    max-height: 60vh;
    object-fit: contain;
    flex-shrink: 0;
}

.lightbox-info {
    padding: 20px;
    background: white;
    max-height: 30vh;
    overflow-y: auto;
    flex-shrink: 0;
}

.lightbox-info h3 {
    margin-bottom: 10px;
    color: var(--primary);
    font-size: 1.2rem;
}

.lightbox-info p {
    margin: 5px 0;
    color: var(--gray);
    font-size: 1rem;
}

.lightbox-info button {
    margin-top: 15px;
    font-size: 1.1rem;
    padding: 14px 24px;
    width: 100%;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
}

.lightbox-close:hover {
    color: var(--primary);
}

/* Albums */
.albums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.album-card {
    background: white;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 25px;
    transition: all 0.3s;
}

.album-card.unlocked {
    border-color: var(--success);
}

.album-card.locked {
    border-color: var(--warning);
    opacity: 0.8;
}

.album-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.album-header h3 {
    color: var(--primary);
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: bold;
}

.status-badge.unlocked {
    background: var(--success);
    color: white;
}

.status-badge.locked {
    background: var(--warning);
    color: white;
}

.album-card p {
    margin: 10px 0;
    color: var(--gray);
}

.album-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.album-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.album-preview img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
}

.more-photos {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light);
    border-radius: 8px;
    font-weight: bold;
    color: var(--primary);
}

/* Timeline des albums */
.user-albums-view {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid var(--border);
}

.user-albums-view h3 {
    margin-bottom: 30px;
    color: var(--dark);
}

.albums-timeline {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.timeline-album {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: var(--light);
    border-radius: 12px;
    border-left: 4px solid var(--border);
}

.timeline-album.unlocked {
    border-left-color: var(--success);
    background: #c6f6d5;
}

.timeline-album.locked {
    border-left-color: var(--warning);
}

.timeline-icon {
    font-size: 2.5rem;
}

.timeline-content h4 {
    margin-bottom: 10px;
    color: var(--primary);
}

.timeline-content p {
    color: var(--gray);
    margin: 5px 0;
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    z-index: 999;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-large {
    max-width: 900px;
}

.modal h3 {
    margin-bottom: 20px;
    color: var(--primary);
}

.close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: var(--gray);
}

.close:hover {
    color: var(--danger);
}

/* Gestion des photos dans les albums */
.manage-photos-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.photos-section {
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 15px;
}

.photos-section h4 {
    margin-bottom: 15px;
    color: var(--primary);
}

.photos-grid-small {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}

.photo-mini {
    position: relative;
    aspect-ratio: 1;
}

.photo-mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.photo-mini form {
    position: absolute;
    top: 5px;
    right: 5px;
}

.btn-icon {
    background: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    box-shadow: var(--shadow);
    font-size: 1rem;
}

.btn-icon:hover {
    transform: scale(1.1);
}

/* Utilitaires */
.no-data {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray);
    font-style: italic;
}

.stats-footer {
    text-align: center;
    padding: 20px;
    color: var(--gray);
    border-top: 2px solid var(--border);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 15px;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }

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

    .manage-photos-container {
        grid-template-columns: 1fr;
    }

    .albums-grid {
        grid-template-columns: 1fr;
    }
}