/* style.css - Style Professionnel ProFocus V2.0 */

/* --- 1. Variables et Reset de Base (Design SaaS) --- */
:root {
    /* Couleurs Primaires */
    --primary-color: #3f51b5; /* Bleu Profond */
    --primary-light: #5c70c6;
    --primary-bg: #e8eaf6; /* Arrière-plan des éléments primaires */
    
    /* Couleurs d'État */
    --success-color: #4caf50; 
    --warning-color: #ff9800;
    --danger-color: #f44336; 
    
    /* Couleurs de Fond et de Texte */
    --bg-light: #f7f9fc; /* Arrière-plan général très clair */
    --card-bg: #ffffff; 
    --text-dark: #212529; 
    --text-muted: #6c757d; 
    --border-color: #dee2e6;
    
    /* Dimensions et Ombres */
    --sidebar-width: 260px;
    --border-radius: 12px;
    --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-active: 0 8px 16px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-light);
    text-decoration: none;
}

h1, h2, h3, h4 {
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

/* --- 2. Composants de Base (Cartes, Alertes) --- */

.section-card {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-subtle);
    margin-bottom: 30px;
    border: 1px solid var(--border-color); /* Ajout d'une bordure fine */
}

.alert {
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 25px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-danger {
    background-color: #fbe6e4;
    color: var(--danger-color);
}

.alert-success {
    background-color: #e6f6e7;
    color: var(--success-color);
}

/* --- 3. Boutons et Formulaires --- */

label {
    display: block;
    margin-bottom: 5px;
    margin-top: 15px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9em;
}

input:not([type="checkbox"]),
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #fff;
}

input:focus,
textarea:focus {
    border-color: var(--primary-light);
    outline: none;
    box-shadow: 0 0 0 3px rgba(63, 81, 181, 0.1);
}

button {
    cursor: pointer;
    font-size: 1em;
    padding: 12px 20px;
    border-radius: 8px;
    transition: background-color 0.2s, box-shadow 0.2s;
    font-weight: 600;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-light);
    box-shadow: var(--shadow-subtle);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c43228;
}

.btn-lg-full {
    width: 100%;
    padding: 14px 20px;
    font-size: 1.1em;
}

.btn-text-link {
    background: none;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 8px 15px;
    width: auto;
    display: inline-flex;
    margin-top: 5px;
}

.btn-text-link:hover {
    background-color: var(--primary-bg);
}

/* --- 4. Mise en page de l'Application (Connecté) --- */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--card-bg);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 30px 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-header {
    padding: 0 20px 30px 20px;
    text-align: center;
}

.sidebar-header h2 {
    color: var(--primary-color);
    font-weight: 800;
    font-size: 1.8em;
}

.logo-icon {
    font-size: 2em;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.nav-links {
    list-style: none;
    flex-grow: 1;
    padding-top: 10px;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    color: var(--text-dark);
    transition: background-color 0.2s, color 0.2s;
    font-weight: 500;
    border-radius: 0;
}

.nav-links li a i {
    font-size: 1.1em;
    width: 20px;
    text-align: center;
}

.nav-links li a:hover {
    background-color: var(--primary-bg);
    color: var(--primary-color);
}

.nav-links li a.active {
    background-color: var(--primary-bg);
    color: var(--primary-color);
    border-right: 5px solid var(--primary-color);
    font-weight: 700;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.btn-logout {
    background: #fff;
    color: var(--text-muted);
    font-weight: 500;
    padding: 10px;
    text-align: left;
    width: 100%;
    border: 1px solid var(--border-color);
}

.btn-logout:hover {
    color: var(--danger-color);
    background-color: #fcebeb;
    border-color: var(--danger-color);
}

/* CONTENU PRINCIPAL */
.main-content {
    flex-grow: 1;
    padding: 40px;
}

.app-container {
    max-width: 1300px;
    margin: 0 auto;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.content-header h1 {
    font-size: 2.2em;
    font-weight: 300;
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* --- 5. Écran d'Authentification (Déconnecté) --- */

#auth-screen {
    background-color: var(--primary-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.logo-icon-auth {
    font-size: 3em;
    color: var(--card-bg);
    margin-bottom: 10px;
}

.auth-header h1 {
    color: var(--primary-color);
    font-weight: 800;
    font-size: 2.8em;
    text-align: center;
    margin-bottom: 20px;
}

.auth-container {
    display: flex;
    max-width: 1000px;
    width: 100%;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.auth-message {
    flex: 1.2;
    padding: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--primary-color);
    color: var(--card-bg);
}

.auth-message h2 {
    color: var(--card-bg);
    font-size: 2em;
    margin-bottom: 15px;
    font-weight: 600;
}

.auth-message p {
    margin-bottom: 30px;
    opacity: 0.9;
}

.feature-list div {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.feature-list i {
    color: var(--success-color);
}

.auth-form-wrapper {
    flex: 1;
    background-color: var(--card-bg);
    padding: 50px;
}

.auth-form h2 {
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
    font-size: 1.5em;
    font-weight: 500;
}

.auth-form label i {
    margin-right: 5px;
    color: var(--primary-light);
}

.auth-switch {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* --- 6. Composants Spécifiques à l'Application --- */

/* Dashboard Stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    display: flex;
    align-items: center;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-subtle);
    border: 1px solid var(--border-color);
}

.stat-card .icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    margin-right: 20px;
    color: white;
}

.stat-card.color-primary .icon-wrapper { background-color: var(--primary-color); }
.stat-card.color-success .icon-wrapper { background-color: var(--success-color); }
.stat-card.color-warning .icon-wrapper { background-color: var(--warning-color); }

.stat-label {
    color: var(--text-muted);
    font-size: 0.9em;
    text-transform: uppercase;
    font-weight: 500;
    margin-bottom: 5px;
}

.stat-number {
    font-size: 2em;
    font-weight: 800;
    line-height: 1;
}

/* Dashboard Recent Coins */
.recent-activity header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.recent-activity h2 {
    font-size: 1.5em;
    font-weight: 500;
}

.recent-coins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.coin-item-preview {
    display: block;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-subtle);
    background-color: var(--card-bg);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--primary-bg);
}

.coin-item-preview:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-card);
}

.coin-image-container {
    height: 150px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f1f3f5;
}

.coin-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.coin-details {
    padding: 15px;
}

.coin-details h4 {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--primary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.coin-details .year-label {
    font-size: 0.9em;
    color: var(--text-muted);
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
}

/* Liste de pièces (Tableau) */
.table-card {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: var(--primary-bg);
    color: var(--text-dark);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85em;
}

.data-table tbody tr:hover {
    background-color: #fafafa;
}

.coin-thumb {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 50%;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

.coin-name-cell a {
    font-weight: 600;
    color: var(--primary-color);
}

.action-cell {
    white-space: nowrap;
}

.btn-action {
    background: none;
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: 5px;
    font-size: 1em;
    margin-left: 5px;
    transition: all 0.2s;
}

.edit-action { color: var(--primary-light); }
.edit-action:hover { background-color: var(--primary-bg); border-color: var(--primary-light); }

.delete-action { color: var(--danger-color); }
.delete-action:hover { background-color: #fbe6e4; border-color: var(--danger-color); }

/* Formulaires Ajout/Édition */

.form-card-large {
    padding: 40px;
}

.form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

.form-col-title {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.image-upload-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.image-upload-box {
    text-align: center;
    padding: 15px;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    transition: border-color 0.2s;
    cursor: pointer;
    background-color: #fcfcfc;
}

.image-upload-box:hover {
    border-color: var(--primary-light);
}

.image-upload-box label {
    margin-top: 0;
    margin-bottom: 15px;
    cursor: pointer;
}

.image-preview {
    height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f1f3f5;
    border-radius: 8px;
    overflow: hidden;
}

.image-preview i {
    font-size: 2em;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.image-preview span {
    color: var(--text-muted);
    font-size: 0.9em;
}

.image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

input[type="file"] {
    display: none; /* Cacher l'input natif */
}

.form-footer-actions {
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
    padding-top: 25px;
    text-align: right;
}

/* Écran Détail */
.detail-layout {
    display: grid;
    grid-template-columns: 2fr 3fr; /* Plus de place pour les infos */
    gap: 30px;
}

.detail-images-col {
    padding: 30px;
}

.detail-images-col h2, .detail-info-col h2 {
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 20px;
}

.image-pair-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.image-box-detail {
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
    background-color: #f9f9f9;
}

.image-title {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.detail-img-full {
    width: 100%;
    max-height: 250px;
    object-fit: contain;
    border-radius: 5px;
}

.no-image-placeholder {
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-style: italic;
    background-color: #eee;
    border-radius: 5px;
}

.no-image-placeholder i {
    font-size: 2em;
    margin-bottom: 10px;
}

/* Metadata */
.detail-metadata {
    margin-bottom: 20px;
}
.metadata-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 10px;
}
.metadata-item {
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--primary-bg);
}
.metadata-item i {
    font-size: 1.2em;
    margin-right: 5px;
    color: var(--primary-color);
}
.metadata-item strong {
    display: block;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 5px;
}
.metadata-item span {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--text-dark);
}

.detail-description {
    margin-bottom: 20px;
}

.description-text {
    white-space: pre-wrap;
    padding: 10px;
    background-color: #fcfcfc;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.detail-actions-bottom {
    padding: 20px;
    text-align: center;
}

/* Modal */

.modal-backdrop {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(33, 37, 41, 0.7); /* Darker overlay */
    padding-top: 100px;
    justify-content: center;
    align-items: flex-start;
}

.modal-content {
    background-color: var(--card-bg); 
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-deep);
}

.modal-subtitle {
    color: var(--text-muted);
    margin: 10px 0 20px;
    font-size: 0.9em;
}

.checkbox-group {
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 8px;
}

.checkbox-group label {
    margin-top: 5px;
    font-weight: 400;
    display: flex;
    align-items: center;
    color: var(--text-dark);
}

.checkbox-group input[type="checkbox"] {
    margin-right: 10px;
    width: auto;
}


/* --- 7. Responsive Design (Amélioré) --- */

@media (max-width: 992px) {
    /* Menu Navigation Mobile */
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0;
        box-shadow: var(--shadow-subtle);
    }

    .sidebar-header {
        padding: 15px 20px;
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-links {
        display: flex;
        width: 100%;
        justify-content: space-around;
        padding: 0;
    }
    
    .nav-links li {
        flex-grow: 1;
        text-align: center;
    }

    .nav-links li a {
        padding: 15px 5px;
        justify-content: center;
        flex-direction: column;
        gap: 5px;
        font-size: 0.8em;
    }
    
    .nav-links li a.active {
        border-right: none;
        border-bottom: 3px solid var(--primary-color);
        padding-bottom: 12px;
    }
    
    .nav-links li a i {
        width: auto;
        font-size: 1.2em;
    }

    .sidebar-footer {
        display: none; 
    }

    .main-content {
        padding: 20px 15px;
    }
    
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .header-actions button, .header-actions a {
        flex-grow: 1;
        text-align: center;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .detail-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .metadata-grid {
        grid-template-columns: 1fr;
    }

    /* Auth Mobile */
    .auth-container {
        flex-direction: column;
        max-width: 450px;
    }
    
    .auth-message {
        padding: 30px;
    }
    
    .auth-form-wrapper {
        padding: 30px;
    }
}