/**
 * GED - Styles principaux
 * Design moderne en cartes inspiré du script original
 */

/* ========================================
   VARIABLES ET RESET
   ======================================== */

:root {
    --primary-color: #289dcc;
    --primary-hover: #1e7a9f;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --bg-light: #f8fafc;
    --bg-card: #ffffff;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

body.dark {
    --bg-light: #0f172a;
    --bg-card: #1e293b;
    --text-dark: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   HEADER
   ======================================== */

.header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
    box-shadow: var(--shadow-sm);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* ========================================
   CONTAINER
   ======================================== */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

main.container {
    flex: 1;
    padding-top: 2rem;
    padding-bottom: 3rem;
}

/* ========================================
   BOUTONS
   ======================================== */

.btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-logout {
    background-color: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.btn-logout:hover {
    background-color: var(--bg-light);
    color: var(--text-dark);
}

.btn-block {
    width: 100%;
}

.btn-delete {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete:hover {
    background-color: #dc2626;
    transform: scale(1.1);
}

/* ========================================
   ALERTES
   ======================================== */

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    border-left: 4px solid;
}

.alert-success {
    background-color: #d1fae5;
    border-color: var(--success-color);
    color: #065f46;
}

.alert-error {
    background-color: #fee2e2;
    border-color: var(--error-color);
    color: #991b1b;
}

.alert-warning {
    background-color: #fef3c7;
    border-color: var(--warning-color);
    color: #92400e;
}

body.dark .alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
}

body.dark .alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
}

body.dark .alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: #fcd34d;
}

/* ========================================
   FIL D'ARIANE
   ======================================== */

.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem 0;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.breadcrumb-label {
    color: var(--text-muted);
    font-weight: 500;
    margin-right: 0.25rem;
}

.breadcrumb-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.breadcrumb-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text-muted);
    margin: 0 0.25rem;
}

.breadcrumb-current {
    color: var(--text-dark);
    font-weight: 600;
}

/* ========================================
   BARRE D'ACTIONS
   ======================================== */

.actions-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

/* ========================================
   GRILLE DE FICHIERS
   ======================================== */

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.file-card {
    position: relative;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.file-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.file-card:hover .btn-delete {
    opacity: 1;
}

.file-card-link {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.file-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-align: center;
}

.file-icon.dir-icon {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.75rem;
    word-break: break-word;
    line-height: 1.4;
    color: var(--text-dark);
}

.file-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.813rem;
    color: var(--text-muted);
}

.file-meta span {
    display: block;
}

.file-count {
    font-weight: 500;
}

/* Icônes par extension */
.file-icon.pdf { font-size: 3rem; }
.file-icon.doc,
.file-icon.docx { font-size: 3rem; }
.file-icon.xls,
.file-icon.xlsx { font-size: 3rem; }
.file-icon.jpg,
.file-icon.jpeg,
.file-icon.png,
.file-icon.gif { font-size: 3rem; }

/* État vide */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state p:first-child {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.empty-state a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.empty-state a:hover {
    text-decoration: underline;
}

/* ========================================
   FORMULAIRES
   ======================================== */

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-light);
    color: var(--text-dark);
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(40, 157, 204, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.813rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ========================================
   MODALES
   ======================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background-color: var(--bg-light);
    color: var(--text-dark);
}

.modal-form {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
}

/* ========================================
   PAGE DE CONNEXION
   ======================================== */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.login-box {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 100%;
    border: 1px solid var(--border-color);
}

.login-box h2 {
    margin-bottom: 0.75rem;
    font-size: 1.5rem;
}

.login-box > p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.9375rem;
}

/* ========================================
   FOOTER
   ======================================== */

.footer {
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    margin-top: auto;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.debug-info {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    opacity: 0.7;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .site-title {
        font-size: 1.25rem;
    }
    
    .files-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .file-card-link {
        padding: 1rem;
    }
    
    .file-icon {
        width: 60px;
        height: 60px;
    }
    
    .actions-bar {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    /* Menu contextuel adapté mobile */
    .context-menu {
        min-width: 180px;
    }
}

@media (max-width: 480px) {
    .files-grid {
        grid-template-columns: 1fr;
    }
    
    .breadcrumb {
        font-size: 0.75rem;
    }
    
    .login-box {
        padding: 1.5rem;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.files-grid {
    animation: fadeIn 0.5s ease;
}