/*
 * style.css - Thème DuckPond (Cybersécurité Dark Mode)
 * ======================================================
 *
 * ORGANISATION DU FICHIER :
 *   1. Variables CSS (palette de couleurs, espacements)
 *   2. Reset et base
 *   3. Navigation
 *   4. Page de connexion
 *   5. Tableau de bord — statistiques
 *   6. Tableau de bord — cartes de documents
 *   7. État vide
 *   8. Animations
 *   9. Utilitaires
 *
 * VARIABLES CSS (Custom Properties) :
 * Définies dans :root, elles permettent de modifier toute la palette
 * depuis un seul endroit. Syntaxe : var(--nom-variable)
 *
 * THÈME CYBERSÉCURITÉ :
 * Fond sombre (comme les terminaux), accents verts (#00ff88)
 * qui évoquent les écrans de hackers et les matrices de code.
 */

/* ============================================================
   1. VARIABLES CSS — PALETTE DE COULEURS
   ============================================================ */
:root {
    /* Couleurs de fond (de plus sombre à plus clair) */
    --bg-darkest:   #060a0f;
    --bg-dark:      #0d1117;   /* Fond principal */
    --bg-medium:    #161b22;   /* Cartes, navbar */
    --bg-light:     #21262d;   /* Éléments interactifs */
    --bg-hover:     #30363d;   /* Survol */

    /* Bordures */
    --border-color: #30363d;
    --border-active: #58a6ff;

    /* Texte */
    --text-primary:   #e6edf3;
    --text-secondary: #8b949e;
    --text-muted:     #6e7681;

    /* Couleurs d'accent */
    --accent-green:  #00ff88;   /* Vert "hacker" — nouveau fichier, succès */
    --accent-blue:   #58a6ff;   /* Bleu — infos, liens */
    --accent-orange: #f0883e;   /* Orange — avertissements, taille */
    --accent-red:    #ff4a4a;   /* Rouge — erreurs, suppression */
    --accent-purple: #bc8cff;   /* Violet — types MIME */

    /* Couleurs des cartes de statistiques */
    --stat-blue:   rgba(88, 166, 255, 0.15);
    --stat-green:  rgba(0, 255, 136, 0.12);
    --stat-orange: rgba(240, 136, 62, 0.15);
    --stat-red:    rgba(255, 74, 74, 0.15);

    /* Typographie */
    --font-main:  'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono:  'Consolas', 'Cascadia Code', 'Fira Code', monospace;

    /* Espacements */
    --spacing-sm:  0.5rem;
    --spacing-md:  1rem;
    --spacing-lg:  1.5rem;
    --spacing-xl:  2rem;

    /* Bordures arrondies */
    --radius-sm:  4px;
    --radius-md:  8px;
    --radius-lg:  12px;
    --radius-xl:  16px;

    /* Transitions */
    --transition-fast:   0.15s ease;
    --transition-normal: 0.3s ease;
}

/* ============================================================
   2. RESET ET BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
}

.dp-body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Liens */
a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { color: var(--text-primary); }

/* Code inline */
code {
    font-family: var(--font-mono);
    background: var(--bg-light);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.85em;
    color: var(--accent-green);
}

/* ============================================================
   3. BARRE DE NAVIGATION
   ============================================================ */
.dp-navbar {
    background: var(--bg-medium);
    border-bottom: 1px solid var(--border-color);
    padding: 0.6rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.dp-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-primary) !important;
    text-decoration: none;
}

.dp-logo-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.dp-brand-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-green);
    letter-spacing: -0.5px;
}

.dp-brand-tagline {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-left: 0.25rem;
}

/* Indicateur de statut WebSocket */
.dp-ws-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: var(--radius-xl);
    font-weight: 500;
    transition: all var(--transition-normal);
}

.dp-ws-connected {
    color: var(--accent-green);
    background: rgba(0, 255, 136, 0.1);
}

.dp-ws-connecting {
    color: var(--accent-orange);
    background: rgba(240, 136, 62, 0.1);
}

.dp-ws-disconnected {
    color: var(--accent-red);
    background: rgba(255, 74, 74, 0.1);
}

/* Bouton déconnexion */
.dp-btn-logout {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}
.dp-btn-logout:hover {
    background: rgba(255, 74, 74, 0.1);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

/* ============================================================
   4. PAGE DE CONNEXION
   ============================================================ */
.dp-main-fullscreen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-darkest);
    /* Grille de fond subtile (effet terminal) */
    background-image:
        linear-gradient(rgba(0, 255, 136, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 136, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

.dp-login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: var(--spacing-md);
}

.dp-login-card {
    background: var(--bg-medium);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow:
        0 0 0 1px rgba(0, 255, 136, 0.05),
        0 20px 60px rgba(0, 0, 0, 0.5);
}

.dp-login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.dp-login-logo {
    font-size: 3.5rem;
    line-height: 1;
    margin-bottom: 0.75rem;
    filter: drop-shadow(0 0 20px rgba(0, 255, 136, 0.3));
}

.dp-login-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-green);
    margin-bottom: 0.25rem;
    letter-spacing: -1px;
}

.dp-login-tagline {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-style: italic;
    margin-bottom: 0;
}

/* Inputs de formulaire */
.dp-input {
    background: var(--bg-dark) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-md) !important;
    padding: 0.6rem 1rem !important;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.dp-input:focus {
    border-color: var(--accent-green) !important;
    box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.1) !important;
    outline: none !important;
}

.dp-input::placeholder { color: var(--text-muted) !important; }

.dp-input-addon {
    background: var(--bg-light) !important;
    border: 1px solid var(--border-color) !important;
    border-left: none !important;
    color: var(--text-secondary) !important;
    border-radius: 0 var(--radius-md) var(--radius-md) 0 !important;
}
.dp-input-addon:hover { color: var(--text-primary) !important; }

.dp-form-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
}

/* Bouton principal */
.dp-btn-primary {
    background: var(--accent-green);
    border: none;
    color: #000;
    font-weight: 700;
    padding: 0.7rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: all var(--transition-normal);
}
.dp-btn-primary:hover {
    background: #00cc6a;
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.3);
    color: #000;
}
.dp-btn-primary:active { transform: translateY(0); }

/* Alerte d'erreur */
.dp-alert-error {
    background: rgba(255, 74, 74, 0.1);
    border: 1px solid rgba(255, 74, 74, 0.3);
    color: var(--accent-red);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.dp-login-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* ============================================================
   5. TABLEAU DE BORD — STRUCTURE PRINCIPALE
   ============================================================ */
.dp-main-content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
}

.dp-footer {
    background: var(--bg-medium);
    border-top: 1px solid var(--border-color);
    padding: 0.6rem 1.5rem;
    text-align: center;
}

.dp-page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0;
}

/* Badge EN DIRECT */
.dp-badge-live {
    font-size: 0.65rem;
    background: rgba(0, 255, 136, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(0, 255, 136, 0.3);
    padding: 4px 10px;
    border-radius: 20px;
    vertical-align: middle;
    font-weight: 600;
    letter-spacing: 1px;
}

/* Point pulsant (animation Live) */
.dp-pulse-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-green);
    animation: pulse 1.5s infinite;
    margin-right: 4px;
    vertical-align: middle;
}

/* ============================================================
   6. CARTES DE STATISTIQUES
   ============================================================ */
.dp-stat-card {
    background: var(--bg-medium);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.dp-stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-active);
}

.dp-stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.dp-stat-icon-blue   { background: var(--stat-blue);   color: var(--accent-blue);   }
.dp-stat-icon-green  { background: var(--stat-green);  color: var(--accent-green);  }
.dp-stat-icon-orange { background: var(--stat-orange); color: var(--accent-orange); }
.dp-stat-icon-red    { background: var(--stat-red);    color: var(--accent-red);    }

.dp-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    /* Transition pour le changement de valeur (animation compteur) */
    transition: color var(--transition-fast);
}

.dp-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Animation de mise à jour d'une stat */
.dp-stat-updated .dp-stat-value {
    color: var(--accent-green);
}

/* ============================================================
   7. SECTION ET CARTES DE DOCUMENTS
   ============================================================ */
.dp-section-header {
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.dp-section-title {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Conteneur de documents */
#documents-container {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* Carte d'un document */
.dp-doc-card {
    background: var(--bg-medium);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition:
        transform var(--transition-fast),
        border-color var(--transition-fast),
        box-shadow var(--transition-fast);
    overflow: hidden;
}

.dp-doc-card:hover {
    transform: translateX(3px);
    border-color: var(--border-active);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

/* Carte nouvelle (surlignage vert à l'arrivée) */
.dp-doc-card.dp-doc-new {
    border-color: var(--accent-green);
    box-shadow: 0 0 0 1px var(--accent-green), 0 4px 20px rgba(0, 255, 136, 0.2);
    animation: slideInHighlight 0.5s ease forwards;
}

.dp-doc-card-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.1rem;
}

/* Icône du type de fichier */
.dp-doc-icon {
    font-size: 2rem;
    flex-shrink: 0;
    width: 44px;
    text-align: center;
    line-height: 1;
}

/* Infos principales */
.dp-doc-info { min-width: 0; }

.dp-doc-filename {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.3rem;
}

/* Badges de métadonnées */
.dp-doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.dp-meta-badge {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: var(--radius-xl);
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    white-space: nowrap;
}

.dp-meta-ip   { color: var(--accent-orange); border-color: rgba(240,136,62,0.3); }
.dp-meta-key  { color: var(--accent-blue);   border-color: rgba(88,166,255,0.3); }
.dp-meta-type { color: var(--accent-purple); border-color: rgba(188,140,255,0.3); }

/* Notes du document */
.dp-doc-notes {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    font-style: italic;
}

/* Horodatage */
.dp-doc-time {
    min-width: 90px;
    flex-shrink: 0;
}

.dp-doc-time-value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.dp-doc-time-date {
    font-size: 0.75rem;
}

/* Boutons d'action */
.dp-doc-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.dp-btn-download {
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid rgba(88, 166, 255, 0.3);
    color: var(--accent-blue);
    border-radius: var(--radius-md);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.dp-btn-download:hover {
    background: rgba(88, 166, 255, 0.2);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    transform: translateY(-1px);
}

.dp-btn-delete {
    background: rgba(255, 74, 74, 0.1);
    border: 1px solid rgba(255, 74, 74, 0.3);
    color: var(--accent-red);
    border-radius: var(--radius-md);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.dp-btn-delete:hover {
    background: rgba(255, 74, 74, 0.2);
    border-color: var(--accent-red);
    color: var(--accent-red);
    transform: translateY(-1px);
}

/* Bouton son (notifications) */
.dp-btn-mute {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}
.dp-btn-mute:hover { color: var(--text-primary); border-color: var(--border-active); }

/* ============================================================
   8. ÉTAT VIDE
   ============================================================ */
.dp-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.dp-empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
    animation: float 3s ease-in-out infinite;
}

.dp-empty-title {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.dp-empty-text {
    font-size: 0.9rem;
    max-width: 400px;
    margin: 0 auto 1.5rem;
}

.dp-empty-hint {
    display: inline-block;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
}

/* ============================================================
   9. TOAST DE NOTIFICATION
   ============================================================ */
.dp-toast {
    background: var(--bg-medium);
    border: 1px solid var(--accent-green);
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.2);
}

/* ============================================================
   10. MODALE
   ============================================================ */
.dp-modal {
    background: var(--bg-medium);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-xl);
}

.dp-modal .modal-header {
    border-bottom-color: var(--border-color);
}

.dp-modal .modal-footer {
    border-top-color: var(--border-color);
}

/* ============================================================
   11. PAGINATION
   ============================================================ */
.dp-pagination .page-link {
    background: var(--bg-medium);
    border-color: var(--border-color);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.dp-pagination .page-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dp-pagination .page-item.active .page-link {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: #000;
    font-weight: 700;
}

/* ============================================================
   12. ANIMATIONS
   ============================================================ */

/* Pulsation du point "LIVE" */
@keyframes pulse {
    0%, 100% { opacity: 1;   transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.8); }
}

/* Apparition d'une nouvelle carte de document */
@keyframes slideInHighlight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Animation de suppression */
@keyframes slideOut {
    to {
        opacity: 0;
        transform: translateX(20px);
        max-height: 0;
        padding: 0;
        margin: 0;
    }
}

.dp-doc-removing {
    animation: slideOut 0.3s ease forwards;
}

/* Flottement du canard dans l'état vide */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-10px); }
}

/* Clignotement d'une valeur mise à jour */
@keyframes statFlash {
    0%   { color: var(--accent-green); }
    100% { color: var(--text-primary); }
}

.dp-stat-flash {
    animation: statFlash 1s ease;
}

/* ============================================================
   13. RESPONSIVE (MOBILE)
   ============================================================ */
@media (max-width: 576px) {
    .dp-doc-card-inner {
        flex-wrap: wrap;
        gap: 0.6rem;
    }

    .dp-doc-time {
        order: -1;  /* Place l'heure en premier sur mobile */
        flex-basis: 100%;
        text-align: left !important;
    }

    .dp-stat-card { padding: 1rem; }
    .dp-stat-value { font-size: 1.5rem; }
}

@media (max-width: 768px) {
    .dp-login-card { padding: 1.75rem; }
}

/* ============================================================
   14. SCROLLBAR PERSONNALISÉE (Chrome/Edge/Safari)
   ============================================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
