/* Styles pour l'interface d'administration */

/* Variables CSS */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --error-color: #e74c3c;
    --warning-color: #f39c12;
    --light-bg: #ecf0f1;
    --dark-bg: #34495e;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --border-color: #bdc3c7;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Page de connexion */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: var(--box-shadow);
    text-align: center;
}

.login-box h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 2em;
}

.login-box p {
    color: var(--text-light);
    margin-bottom: 30px;
}

.login-form .form-group {
    margin-bottom: 20px;
    text-align: left;
}

.login-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-dark);
}

.login-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.login-form input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

/* Interface d'administration */
.admin-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: var(--dark-bg);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-header h2 {
    color: var(--secondary-color);
    margin-bottom: 5px;
}

.sidebar-header p {
    color: #bdc3c7;
    font-size: 14px;
}

.sidebar-nav ul {
    list-style: none;
    padding: 20px 0;
}

.sidebar-nav li {
    margin-bottom: 5px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.3s ease;
}

.sidebar-nav a:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-nav a.active {
    background-color: var(--secondary-color);
    color: white;
}

.sidebar-nav i {
    margin-right: 10px;
    width: 16px;
}

.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 20px;
}

.content-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.content-header h1 {
    color: var(--primary-color);
    font-size: 2.5em;
    margin-bottom: 10px;
}

/* Onglets */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Formulaires */
.admin-form {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--box-shadow);
    max-width: 600px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Boutons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--success-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #229954;
    transform: translateY(-2px);
}

/* Alertes */
.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Grille de sections */
.sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

.section-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--box-shadow);
}

.section-card h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--secondary-color);
    text-transform: capitalize;
}

.section-form .form-group {
    margin-bottom: 15px;
}

.section-form label {
    font-size: 14px;
    font-weight: 600;
}

.section-form input,
.section-form textarea {
    padding: 10px;
    font-size: 14px;
}

.section-form .btn {
    padding: 10px 20px;
    font-size: 14px;
}

/* Messages */
.messages-list {
    background: white;
    border-radius: 10px;
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.message-item {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

.message-item:hover {
    background-color: #f8f9fa;
}

.message-item.unread {
    background-color: #e3f2fd;
    border-left: 4px solid var(--secondary-color);
}

.message-item:last-child {
    border-bottom: none;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.message-header strong {
    color: var(--primary-color);
}

.message-email {
    color: var(--text-light);
    font-size: 14px;
}

.message-date {
    color: var(--text-light);
    font-size: 12px;
}

.message-subject {
    margin-bottom: 10px;
    font-size: 16px;
}

.message-content {
    color: var(--text-dark);
    line-height: 1.6;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    border-left: 3px solid var(--secondary-color);
}

/* Gestion des services et portfolio */
.add-item-form {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--box-shadow);
    margin-bottom: 30px;
}

.add-item-form h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--secondary-color);
}

.items-list {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--box-shadow);
}

.items-list h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--secondary-color);
}

.item-card {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: box-shadow 0.3s ease;
}

.item-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.item-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 15px;
}

.item-icon {
    width: 50px;
    height: 50px;
    background: var(--secondary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
}

.item-preview {
    width: 120px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--light-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.item-preview:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.item-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.item-preview:hover img {
    transform: scale(1.1);
}

.placeholder-image {
    color: var(--text-light);
    font-size: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
}

.placeholder-image i {
    margin-bottom: 8px;
    font-size: 28px;
    color: var(--secondary-color);
}

.placeholder-image small {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: white;
    font-size: 12px;
}

.item-preview:hover .image-overlay {
    opacity: 1;
}

.item-info {
    flex: 1;
}

.item-info h4 {
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 18px;
}

.item-description,
.item-subtitle {
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.5;
}

.item-meta {
    color: var(--text-light);
    font-size: 13px;
    font-weight: 500;
}

.item-form {
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-row .form-group {
    margin-bottom: 0;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-dark);
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.btn-danger {
    background-color: var(--error-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
}

.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 16px;
    font-family: inherit;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.form-group select:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.form-group input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 2px dashed var(--border-color);
    border-radius: 5px;
    font-size: 16px;
    font-family: inherit;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-group input[type="file"]:hover {
    border-color: var(--secondary-color);
    background-color: #e3f2fd;
}

.form-group input[type="file"]:focus {
    outline: none;
    border-color: var(--secondary-color);
    border-style: solid;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-light);
    font-size: 12px;
}

.file-preview {
    margin-top: 12px;
    padding: 12px;
    background-color: #e3f2fd;
    border-radius: 6px;
    border-left: 3px solid var(--secondary-color);
    transition: all 0.3s ease;
}

.file-preview:hover {
    background-color: #bbdefb;
}

.file-preview small {
    color: var(--secondary-color);
    font-weight: 500;
}

.placeholder-image.error {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    border-color: var(--error-color);
    color: var(--error-color);
}

.placeholder-image.error i {
    color: var(--error-color);
}

/* Animation de chargement pour les images */
.item-preview img {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.item-preview img[data-loading="true"] {
    opacity: 0.7;
    filter: blur(1px);
}

/* Effet de survol amélioré */
.item-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.1) 50%, transparent 60%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.item-preview:hover::before {
    transform: translateX(100%);
}

/* Modal pour l'aperçu d'image */
.image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.95);
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(3px);
}

@keyframes fadeIn {
    from { 
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to { 
        opacity: 1;
        backdrop-filter: blur(3px);
    }
}

.modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    width: 95%;
    max-width: 1200px;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: translateY(-50%) scale(0.8);
        opacity: 0;
    }
    to {
        transform: translateY(-50%) scale(1);
        opacity: 1;
    }
}

.modal-content img {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.7);
    object-fit: contain;
    transition: transform 0.3s ease;
}

.modal-content img:hover {
    transform: scale(1.02);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-modal:hover {
    color: var(--error-color);
    background: rgba(231, 76, 60, 0.2);
    transform: scale(1.1);
}

.modal-info {
    color: white;
    margin-top: 20px;
    background: rgba(0,0,0,0.7);
    padding: 20px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.modal-info h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--secondary-color);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.modal-info p {
    font-size: 16px;
    color: #ecf0f1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Instructions d'utilisation */
.modal-instructions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    text-align: center;
}

.modal-instructions i {
    margin: 0 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-container {
        flex-direction: column;
    }
    
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sections-grid {
        grid-template-columns: 1fr;
    }
    
    .message-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .item-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .item-preview {
        width: 150px;
        height: 120px;
        margin-bottom: 15px;
    }
    
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-buttons {
        justify-content: center;
        margin-top: 10px;
    }
    
    .modal-content {
        width: 98%;
        padding: 10px;
    }
    
    .modal-content img {
        max-height: 70vh;
    }
    
    .close-modal {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 10px;
    }
    
    .login-box {
        padding: 30px 20px;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .admin-form,
    .section-card,
    .add-item-form,
    .items-list {
        padding: 20px;
    }
    
    .item-card {
        padding: 15px;
    }
    
    .item-preview {
        width: 120px;
        height: 100px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn {
        width: 100%;
        text-align: center;
    }
    
    .modal-content {
        width: 100%;
        height: 100vh;
        max-width: none;
        top: 0;
        transform: none;
        padding: 60px 10px 20px 10px;
        overflow-y: auto;
    }
    
    .modal-content img {
        max-height: 60vh;
        width: auto;
    }
}

/* === STYLES POUR LES NOUVELLES SECTIONS === */

/* Section des statistiques */
.statistics .content-section {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--box-shadow);
}

.statistics .items-list {
    display: grid;
    gap: 20px;
}

.statistics .item-card {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.statistics .item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

/* Section des médias */
.media .content-section {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--box-shadow);
}

.current-image {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

.current-image img {
    display: block;
    margin: 0 auto 10px auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.no-image {
    color: var(--text-light);
    font-style: italic;
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.upload-form {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.upload-form:hover {
    border-color: var(--secondary-color);
    background: rgba(52, 152, 219, 0.05);
}

.upload-form .form-group {
    margin-bottom: 20px;
}

.upload-form input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: white;
}

.upload-form small {
    color: var(--text-light);
    font-size: 0.9em;
    margin-top: 5px;
    display: block;
}

/* Améliorations des boutons d'upload */
.btn.btn-primary {
    background: linear-gradient(135deg, var(--secondary-color), #2980b9);
    border: none;
    padding: 12px 24px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.btn.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9, var(--secondary-color));
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

/* Configuration SMTP */
.smtp-config-section {
    margin-top: 40px;
    padding: 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    border-left: 4px solid var(--secondary-color);
}

.smtp-config-section h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.4rem;
    font-weight: 600;
}

.smtp-config-section .description {
    color: var(--text-light);
    margin-bottom: 25px;
    font-size: 14px;
    line-height: 1.5;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 0;
}

.form-row .form-group {
    margin-bottom: 20px;
}

.smtp-config-section .form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-light);
    font-size: 12px;
    font-style: italic;
}

.smtp-config-section .btn {
    margin-top: 10px;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    border: none;
}

.smtp-config-section .btn:hover {
    background: linear-gradient(135deg, #229954, #27ae60);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.4);
}

/* Responsive pour la configuration SMTP */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .smtp-config-section {
        padding: 20px;
        margin-top: 20px;
    }
}

/* Styles pour la gestion des contacts */
.content-section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--box-shadow);
    margin-bottom: 30px;
}

.content-section h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--secondary-color);
}

.content-section h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.external-link {
    color: var(--secondary-color);
    margin-left: 10px;
    text-decoration: none;
}

.external-link:hover {
    color: var(--primary-color);
}

.item-preview {
    display: flex;
    align-items: center;
    gap: 10px;
}

.item-preview i {
    width: 30px;
    color: var(--secondary-color);
    font-size: 1.2rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
}