/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 30px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

header h1 {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 15px;
}

.subtitle code {
    background: #f5f5f5;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
}

nav {
    margin-top: 15px;
}

nav .link {
    display: inline-block;
    margin: 0 10px;
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

nav .link:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Formulaire de Configuration */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

.tokens-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.token-item {
    display: flex;
    flex-direction: column;
}

.token-item label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.token-input {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.95em;
    transition: border-color 0.3s;
}

.token-input:focus {
    outline: none;
    border-color: #667eea;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: 2px solid #e0e0e0;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
}

/* Lab Grid - Matrice de Tests 3x4 */
.lab-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 30px;
}

.test-cell {
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.test-cell:hover {
    border-color: #667eea;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.test-cell h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 600;
}

.token-display {
    min-height: 40px;
    padding: 10px;
    background: white;
    border-radius: 4px;
    font-family: monospace;
    font-size: 1.1em;
    color: #999;
    border: 1px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.token-display.token-revealed {
    color: #d32f2f;
    font-weight: bold;
    border: 2px solid #d32f2f;
    background: #ffebee;
    animation: reveal 0.5s ease-in;
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Scroll Target */
.scroll-target {
    margin-top: 500px;
}

/* Interaction Button */
.reveal-button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 10px;
}

.reveal-button:hover {
    background: #764ba2;
    transform: translateY(-2px);
}

.reveal-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Historique */
.history-container {
    margin-top: 30px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.history-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.history-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.history-table td {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.history-table tbody tr:hover {
    background: #f5f5f5;
}

.history-table tbody tr:last-child td {
    border-bottom: none;
}

.user-agent {
    font-size: 0.85em;
    color: #666;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state p {
    font-size: 1.2em;
    margin-bottom: 20px;
}

/* Footer */
footer {
    margin-top: 40px;
    text-align: center;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

footer .link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

footer .link:hover {
    text-decoration: underline;
}

/* Analytics Page (v2.1) */
.stats-section {
    margin-bottom: 40px;
    padding: 25px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.stats-section h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

/* Section Résumé */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.summary-item label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.summary-item strong,
.summary-item code {
    color: #333;
    font-size: 1em;
}

.user-agent-small {
    font-size: 0.85em;
    color: #666;
    word-break: break-all;
}

.tokens-list {
    margin-top: 20px;
}

.tokens-list h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.tokens-grid-small {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.token-item-small {
    padding: 10px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.token-label {
    font-size: 0.9em;
    color: #666;
    font-weight: 500;
}

.token-value {
    font-size: 0.85em;
    color: #d32f2f;
    font-weight: bold;
}

/* Grille de Détection */
.detection-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.detection-cell {
    padding: 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s;
}

.detection-cell.detected {
    background: #e8f5e9;
    border: 2px solid #4caf50;
}

.detection-cell.not-detected {
    background: #ffebee;
    border: 2px solid #f44336;
}

.detection-icon {
    font-size: 2em;
    flex-shrink: 0;
}

.detection-info {
    flex: 1;
}

.detection-info h4 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 1em;
}

.detection-type {
    font-size: 0.85em;
    color: #666;
    font-family: monospace;
}

.detection-details {
    margin-top: 8px;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
}

.badge-visible {
    background: #e3f2fd;
    color: #1976d2;
}

.badge-fetched {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* Logs Techniques */
.logs-container {
    overflow-x: auto;
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.logs-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.logs-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9em;
}

.logs-table td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.9em;
}

.logs-table tbody tr:hover {
    background: #f5f5f5;
}

.logs-table tbody tr:last-child td {
    border-bottom: none;
}

.logs-table tbody tr.user-agent-changed {
    background: #fff3cd;
}

.event-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
}

.event-page-load {
    background: #e3f2fd;
    color: #1976d2;
}

.event-api-call {
    background: #f3e5f5;
    color: #7b1fa2;
}

.event-client-report {
    background: #e8f5e9;
    color: #388e3c;
}

.changed-badge {
    display: inline-block;
    background: #ff9800;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: 600;
    margin-right: 5px;
}

.user-agent-cell {
    font-size: 0.85em;
    color: #666;
    word-break: break-all;
}

.empty-message {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* Fingerprint Client */
.fingerprint-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.fingerprint-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.fingerprint-item {
    padding: 15px;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.fingerprint-item label {
    display: block;
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.fingerprint-item strong {
    color: #333;
    font-size: 1em;
}

.fingerprint-item.webdriver-detected {
    background: #fff3cd;
    border-color: #ff9800;
}

.fingerprint-item .warning {
    color: #f44336;
    font-weight: bold;
}

.fingerprint-raw {
    margin-top: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.fingerprint-raw summary {
    cursor: pointer;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 10px;
}

.fingerprint-raw pre {
    background: white;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.85em;
    margin-top: 10px;
}

.fingerprint-empty {
    text-align: center;
    padding: 40px;
    background: #fff3cd;
    border-radius: 8px;
    border: 2px dashed #ff9800;
}

.warning-message {
    font-size: 1.2em;
    color: #f57c00;
    font-weight: 600;
    margin-bottom: 10px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-analytics {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    color: white;
}

.btn-analytics:hover {
    background: linear-gradient(135deg, #388e3c 0%, #2e7d32 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

/* Responsive */
@media (max-width: 1024px) {
    .detection-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .lab-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .lab-grid {
        grid-template-columns: 1fr;
    }
    
    .tokens-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .history-table {
        font-size: 0.9em;
    }
    
    .history-table th,
    .history-table td {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .detection-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .tokens-grid-small {
        grid-template-columns: 1fr;
    }
    
    .fingerprint-grid {
        grid-template-columns: 1fr;
    }
    
    .logs-table {
        font-size: 0.8em;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}
