/* ══════════════════════════════════════════════
   TRANSCRIPTOR — Style global
   Minimaliste, professionnel, lisible.
   ══════════════════════════════════════════════ */

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

:root {
    --color-bg: #fafaf9;
    --color-surface: #ffffff;
    --color-text: #1c1917;
    --color-text-muted: #78716c;
    --color-primary: #4f46e5;
    --color-primary-hover: #4338ca;
    --color-primary-light: #eef2ff;
    --color-border: #e7e5e4;
    --color-border-hover: #d6d3d1;
    --color-success: #16a34a;
    --color-error: #dc2626;
    --color-warning: #f59e0b;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --max-width: 960px;
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Typography ─── */
h1, h2, h3 { font-weight: 600; line-height: 1.3; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.125rem; }
p { color: var(--color-text-muted); }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ─── */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

main {
    flex: 1;
    padding: 2rem 0;
}

/* ─── Header / Nav ─── */
.header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo:hover { text-decoration: none; }

.nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav a {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.15s;
}

.nav a:hover {
    color: var(--color-text);
    text-decoration: none;
}

.nav-credits {
    background: var(--color-primary-light);
    color: var(--color-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn:hover { text-decoration: none; }

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
}

.btn-secondary:hover {
    border-color: var(--color-border-hover);
    background: var(--color-bg);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-muted);
}

.btn-ghost:hover {
    color: var(--color-text);
    background: var(--color-bg);
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.825rem;
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ─── Cards ─── */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

/* ─── Upload Zone ─── */
.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--color-surface);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.upload-zone .icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.upload-zone h3 {
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.upload-zone p {
    font-size: 0.875rem;
}

.upload-zone input[type="file"] {
    display: none;
}

/* ─── Result Panel ─── */
.result-panel {
    display: none;
}

.result-panel.visible {
    display: block;
}

.result-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 1rem;
}

.result-tab {
    padding: 0.6rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.result-tab:hover {
    color: var(--color-text);
}

.result-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.result-content {
    display: none;
}

.result-content.active {
    display: block;
}

.result-text {
    white-space: pre-wrap;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.7;
    padding: 1.25rem;
    background: var(--color-bg);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    max-height: 500px;
    overflow-y: auto;
}

/* ─── Entities ─── */
.entities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.entity-group h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.entity-tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-radius: 99px;
    font-size: 0.8rem;
    margin: 0.15rem;
    font-weight: 500;
}

.entity-tag.lieu { background: #ecfdf5; color: #059669; }
.entity-tag.date { background: #fef3c7; color: #d97706; }
.entity-tag.profession { background: #fce7f3; color: #db2777; }
.entity-tag.lien { background: #f0f9ff; color: #0284c7; }

/* ─── Loading ─── */
.loader {
    display: none;
    text-align: center;
    padding: 3rem;
}

.loader.visible {
    display: block;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Stats bar ─── */
.stats-bar {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 0;
    font-size: 0.825rem;
    color: var(--color-text-muted);
}

.stats-bar span {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* ─── Modal ─── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.visible {
    display: flex;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.modal h2 {
    margin-bottom: 1.25rem;
}

.modal-close {
    float: right;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 0.25rem;
}

/* ─── Forms ─── */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: var(--color-text);
}

.form-group input {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-error {
    color: var(--color-error);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    display: none;
}

.form-error.visible {
    display: block;
}

.form-switch {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* ─── Pricing Cards ─── */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.pricing-card {
    text-align: center;
    padding: 2rem 1.5rem;
    position: relative;
}

.pricing-card.featured {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary);
}

.pricing-card .badge {
    position: absolute;
    top: -0.75rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary);
    color: white;
    padding: 0.2rem 0.85rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}

.pricing-card .price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 1rem 0 0.25rem;
}

.pricing-card .price-unit {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.pricing-card .credits {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.pricing-card .per-credit {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}

/* ─── Account / Dashboard ─── */
.account-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.history-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 2px solid var(--color-border);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.history-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.history-table tr:hover td {
    background: var(--color-bg);
}

.truncate {
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Footer ─── */
.footer {
    border-top: 1px solid var(--color-border);
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: auto;
}

/* ─── Alerts ─── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: none;
}

.alert.visible { display: block; }
.alert-error { background: #fef2f2; color: var(--color-error); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--color-success); border: 1px solid #bbf7d0; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ─── Hero section ─── */
.hero {
    text-align: center;
    padding: 2.5rem 0 1.5rem;
}

.hero h1 {
    margin-bottom: 0.75rem;
}

.hero p {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
    h1 { font-size: 1.5rem; }
    .hero { padding: 1.5rem 0 1rem; }
    .upload-zone { padding: 2rem 1rem; }
    .pricing-grid { grid-template-columns: 1fr; }
    .nav { gap: 0.75rem; }
    .nav a { font-size: 0.8rem; }
    .entities-grid { grid-template-columns: 1fr; }
    .stats-bar { flex-wrap: wrap; gap: 0.75rem; }
}
