* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --danger-color: #ef4444;
    --success-color: #10b981;
    --light-bg: #f8fafc;
    --border-color: #e2e8f0;
    --text-dark: #1e293b;
    --text-light: #64748b;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Navigation */
.navbar {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.admin-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.admin-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Main Page */
.main-page {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.welcome-section {
    text-align: center;
    margin-bottom: 2rem;
}

.welcome-section h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.welcome-section p {
    font-size: 1.1rem;
    color: var(--text-light);
}

/* Boutons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
}

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

.btn-primary:hover {
    background-color: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:disabled {
    background-color: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background-color: #64748b;
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

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

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.2rem;
}

.btn-block {
    width: 100%;
    display: block;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

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

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

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.login-modal {
    max-width: 400px;
}

.close {
    color: var(--text-light);
    float: right;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

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

.modal h2 {
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

/* Formulaire */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Login Error */
.login-error {
    color: var(--danger-color);
    text-align: center;
    margin-top: 1rem;
    font-weight: 600;
    display: none;
}

.login-error.show {
    display: block;
}

/* File Input */
.file-input-wrapper {
    position: relative;
    margin-bottom: 1rem;
}

#photoInput {
    display: none;
}

.file-label {
    display: block;
    padding: 2rem;
    border: 2px dashed var(--primary-color);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    background-color: rgba(99, 102, 241, 0.05);
    transition: all 0.3s ease;
    font-weight: 600;
    color: var(--primary-color);
}

.file-label:hover {
    background-color: rgba(99, 102, 241, 0.1);
    border-color: var(--secondary-color);
}

.file-label.dragover {
    background-color: rgba(99, 102, 241, 0.2);
    border-color: var(--secondary-color);
}

/* Preview */
.preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preview-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
}

.preview-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.preview-item .remove-btn:hover {
    background-color: #dc2626;
    transform: scale(1.1);
}

.preview-item-name {
    padding: 0.5rem;
    font-size: 0.75rem;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Admin Header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.admin-header h2 {
    margin: 0;
}

.admin-header .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Admin Gallery */
.admin-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.admin-controls .btn {
    flex: 1;
    min-width: 150px;
}

.stats {
    background-color: var(--light-bg);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 2rem;
}

.stats p {
    margin: 0;
    color: var(--text-light);
}

.stats strong {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.admin-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.admin-photo-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.admin-photo-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.admin-photo-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.admin-photo-item input[type="checkbox"] {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    z-index: 10;
}

.admin-photo-item.selected {
    box-shadow: 0 0 0 3px var(--primary-color);
}

.admin-photo-item.selected::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(99, 102, 241, 0.2);
}

.photo-info {
    padding: 0.75rem;
    background-color: white;
    font-size: 0.85rem;
    color: var(--text-light);
}

.photo-info p {
    margin: 0.25rem 0;
    word-break: break-word;
}

.photo-filename {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.8rem;
}

.empty-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    background-color: var(--success-color);
    color: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 2000;
    animation: slideInRight 0.3s ease;
}

.toast.show {
    display: block;
}

.toast.error {
    background-color: var(--danger-color);
}

.toast.warning {
    background-color: #f59e0b;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

    .logo {
        font-size: 1.2rem;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }

    .admin-modal {
        max-width: 95%;
    }

    .welcome-section h2 {
        font-size: 1.5rem;
    }

    .btn-large {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    .admin-gallery {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .admin-controls {
        flex-direction: column;
    }

    .admin-controls .btn {
        min-width: auto;
    }

    .stats {
        flex-direction: column;
        gap: 1rem;
    }

    .admin-header {
        flex-direction: column;
        gap: 1rem;
    }

    .admin-header .btn {
        width: 100%;
    }

    .toast {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .preview-container {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }

    .admin-gallery {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .file-label {
        padding: 1.5rem;
        font-size: 0.9rem;
    }
}
