/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Base */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: #1a1a2e;
    background: #f0f2f5;
    min-height: 100vh;
}

/* Navbar */
.navbar {
    background: #fff;
    border-bottom: 1px solid #e4e6eb;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.nav-brand {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: -0.3px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    background: none;
    border: none;
    cursor: pointer;
}

.nav-link:hover { background: #f0f2f5; color: #1a1a2e; }
.nav-link.active { background: #e8f0fe; color: #1967d2; }
.logout-btn { color: #c62828; }
.logout-btn:hover { background: #fbe9e7; }

/* Container */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-error { background: #fce4ec; color: #c62828; border: 1px solid #ef9a9a; }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.alert-info { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    gap: 6px;
}
.btn-primary { background: #1967d2; color: #fff; }
.btn-primary:hover { background: #1557b0; }
.btn-secondary { background: #e4e6eb; color: #333; }
.btn-secondary:hover { background: #d4d6db; }
.btn-danger { background: #fce4ec; color: #c62828; }
.btn-danger:hover { background: #ef9a9a; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; }
.btn-link { background: none; color: #1967d2; padding: 6px 12px; }
.btn-link:hover { background: #e8f0fe; }
.btn-retry { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
.btn-retry:hover { background: #ffe0b2; }
.btn-retry:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-protocol { background: #1967d2; color: #fff; }
.btn-protocol:hover { background: #1557b0; }
.btn-analytics { background: #37474f; color: #fff; }
.btn-analytics:hover { background: #263238; }
.btn-report-legacy { background: #e4e6eb; color: #666; font-size: 12px; padding: 5px 10px; }
.btn-report-legacy:hover { background: #d4d6db; }

/* Login */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-title {
    font-size: 28px;
    font-weight: 800;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.login-subtitle {
    color: #888;
    font-size: 14px;
    margin-bottom: 32px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e4e6eb;
    border-radius: 10px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s;
    background: #fafbfc;
}
.form-input:focus { border-color: #1967d2; background: #fff; }

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h1 {
    font-size: 22px;
    font-weight: 700;
}

/* Reports table */
.reports-table-wrapper {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.reports-table {
    width: 100%;
    border-collapse: collapse;
}
.reports-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    background: #fafbfc;
    border-bottom: 1px solid #e4e6eb;
}
.reports-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f2f5;
    font-size: 14px;
}
.reports-table tr:last-child td { border-bottom: none; }
.reports-table tr:hover { background: #fafbfc; }
.filename { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Dialog type pills */
.dialog-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.pill-consultation { background: #e8f5e9; color: #2e7d32; }
.pill-technical { background: #fff3e0; color: #e65100; }
.pill-mixed { background: #e3f2fd; color: #1565c0; }

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.status-processing { background: #fff3e0; color: #e65100; }
.status-error { background: #fce4ec; color: #c62828; }

/* Error hint tooltip */
.error-hint {
    display: inline-block;
    margin-left: 4px;
    cursor: help;
    color: #c62828;
    font-size: 13px;
}

/* Actions cell */
.actions-cell { white-space: nowrap; }
.actions-cell .btn { margin-right: 4px; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    background: #fff;
    border-radius: 12px;
    color: #888;
}
.empty-state p { margin-bottom: 16px; font-size: 16px; }

/* Upload */
.upload-container {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.drop-zone {
    border: 2px dashed #d4d6db;
    border-radius: 16px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafbfc;
}
.drop-zone:hover, .drop-zone.drag-over {
    border-color: #1967d2;
    background: #e8f0fe;
}
.drop-icon { font-size: 48px; margin-bottom: 12px; }
.drop-text { font-size: 18px; font-weight: 600; color: #333; }
.drop-hint { font-size: 14px; color: #888; margin-top: 4px; }
.drop-formats { font-size: 12px; color: #aaa; margin-top: 12px; text-transform: uppercase; letter-spacing: 0.5px; }

/* URL section */
.url-section { margin-top: 24px; }
.or-divider {
    text-align: center;
    color: #aaa;
    font-size: 13px;
    margin-bottom: 12px;
    position: relative;
}
.or-divider::before, .or-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 35%;
    height: 1px;
    background: #e4e6eb;
}
.or-divider::before { left: 0; }
.or-divider::after { right: 0; }
.url-input-group {
    display: flex;
    gap: 8px;
}
.url-input-group .form-input { flex: 1; }
.url-hint { font-size: 12px; color: #aaa; margin-top: 6px; }

/* File info */
.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #e8f0fe;
    border-radius: 10px;
    margin-bottom: 16px;
}
.file-name { font-weight: 600; flex: 1; }
.file-size { color: #888; font-size: 13px; }

/* Progress */
.progress-container { margin-top: 24px; }
.progress-bar-wrapper {
    height: 8px;
    background: #e4e6eb;
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #1967d2, #4285f4);
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}
.progress-info {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 14px;
}
.progress-percent { font-weight: 700; color: #1967d2; }
.progress-message { color: #888; }

/* Progress stages */
.progress-stages {
    display: flex;
    gap: 4px;
    margin-top: 16px;
}
.stage {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    font-size: 11px;
    font-weight: 600;
    color: #aaa;
    background: #f0f2f5;
    border-radius: 8px;
    transition: all 0.3s;
}
.stage.active { background: #e8f0fe; color: #1967d2; }
.stage.completed { background: #e8f5e9; color: #2e7d32; }

/* Result */
.result-container { margin-top: 24px; text-align: center; }
.result-success h3 { font-size: 20px; margin-bottom: 16px; color: #2e7d32; }
.result-success .btn { margin: 0 8px; }

/* Error container */
.error-container { margin-top: 24px; }

/* Responsive */
@media (max-width: 640px) {
    .container { padding: 16px 12px; }
    .login-card { padding: 24px; }
    .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .reports-table { font-size: 13px; }
    .reports-table th, .reports-table td { padding: 8px 12px; }
    .url-input-group { flex-direction: column; }
    .progress-stages { flex-wrap: wrap; }
    .stage { flex: unset; width: calc(33% - 4px); }
}

@media print {
    .navbar, .btn, .delete-btn { display: none; }
}
