/* BAC calculator — Reparo dark glass (shared: informatique.html, calculator.html) */
:root {
    --calc-bg: #020617;
    --calc-surface: rgba(15, 23, 42, 0.72);
    --calc-surface-2: rgba(30, 41, 59, 0.55);
    --calc-border: rgba(148, 163, 184, 0.18);
    --calc-text: #f1f5f9;
    --calc-muted: #94a3b8;
    --calc-accent-p: #34d399;
    --calc-accent-p-dim: rgba(52, 211, 153, 0.15);
    --calc-accent-c: #38bdf8;
    --calc-accent-c-dim: rgba(56, 189, 248, 0.12);
    --calc-glow-p: rgba(52, 211, 153, 0.35);
    --calc-glow-c: rgba(56, 189, 248, 0.35);
    --calc-radius: 18px;
    --calc-radius-sm: 12px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.calc-page {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    min-height: 100vh;
    color: var(--calc-text);
    background:
        radial-gradient(900px 500px at 12% -10%, rgba(99, 102, 241, 0.22), transparent 55%),
        radial-gradient(700px 400px at 88% 0%, rgba(236, 72, 153, 0.12), transparent 50%),
        radial-gradient(600px 400px at 50% 100%, rgba(34, 211, 238, 0.08), transparent 55%),
        var(--calc-bg);
    padding: 20px 18px 100px;
    -webkit-font-smoothing: antialiased;
}

.calc-shell {
    max-width: 1220px;
    margin: 0 auto;
}

.calculator-container {
    max-width: 1220px;
    margin: 0 auto;
}

/* Top navigation */
.calc-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
}

.calc-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--calc-text);
    background: var(--calc-surface-2);
    border: 1px solid var(--calc-border);
    backdrop-filter: blur(12px);
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.calc-pill:hover {
    border-color: rgba(148, 163, 184, 0.35);
    background: rgba(51, 65, 85, 0.55);
    transform: translateY(-1px);
}

.calc-pill--accent {
    border-color: rgba(52, 211, 153, 0.35);
    background: rgba(52, 211, 153, 0.1);
    color: #a7f3d0;
}

.calc-pill i {
    opacity: 0.9;
}

/* Hero */
.header.calc-hero,
.header {
    text-align: center;
    padding: 28px 20px 36px;
    margin-bottom: 8px;
}

.header h1 {
    font-size: clamp(1.45rem, 4vw, 2.15rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #f8fafc 0%, #cbd5e1 50%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header h1 i {
    -webkit-text-fill-color: #38bdf8;
    margin-right: 10px;
    vertical-align: middle;
}

.header p {
    font-size: 0.95rem;
    color: var(--calc-muted);
    font-weight: 500;
}

.calc-hero-badge {
    display: inline-flex;
    margin-top: 14px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #a5b4fc;
    border: 1px solid rgba(129, 140, 248, 0.35);
    background: rgba(99, 102, 241, 0.12);
}

/* Grid & cards */
.calculator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
    gap: 22px;
    margin-bottom: 28px;
}

.session-card {
    position: relative;
    border-radius: var(--calc-radius);
    padding: 22px 20px 24px;
    background: var(--calc-surface);
    border: 1px solid var(--calc-border);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.session-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--calc-radius) var(--calc-radius) 0 0;
    opacity: 0.95;
}

.session-card.principal::before {
    background: linear-gradient(90deg, #10b981, #34d399, #6ee7b7);
    box-shadow: 0 0 24px var(--calc-glow-p);
}

.session-card.controle::before {
    background: linear-gradient(90deg, #0284c7, #38bdf8, #7dd3fc);
    box-shadow: 0 0 24px var(--calc-glow-c);
}

.session-card:hover {
    border-color: rgba(148, 163, 184, 0.28);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.4);
}

.session-title {
    font-size: 1.15rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 18px;
    letter-spacing: -0.02em;
}

.principal .session-title {
    color: #6ee7b7;
}

.controle .session-title {
    color: #7dd3fc;
}

.subjects-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.subject-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: var(--calc-radius-sm);
    background: rgba(2, 6, 23, 0.35);
    border: 1px solid rgba(148, 163, 184, 0.1);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.subject-row:hover {
    border-color: rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.45);
}

.subject-row--option .coefficient {
    font-size: 0.72rem;
    line-height: 1.35;
    color: #c4b5fd;
}

.subject-row.disabled {
    opacity: 0.42;
    pointer-events: none;
    filter: grayscale(0.3);
}

.subject-label {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.subject-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--calc-text);
    margin-bottom: 3px;
}

.coefficient {
    font-size: 0.78rem;
    color: var(--calc-muted);
    font-weight: 500;
}

.note-input {
    width: 96px;
    flex-shrink: 0;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(2, 6, 23, 0.55);
    color: var(--calc-text);
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.note-input:focus {
    outline: none;
    border-color: rgba(56, 189, 248, 0.55);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.note-input:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.note-input::-webkit-inner-spin-button,
.note-input::-webkit-outer-spin-button {
    opacity: 0.75;
    height: 28px;
}

.calculate-btn {
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    color: #020617;
    background: linear-gradient(135deg, #e2e8f0 0%, #f8fafc 40%, #cbd5e1 100%);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
}

.calculate-btn:active {
    transform: translateY(0);
}

.principal .calculate-btn {
    background: linear-gradient(135deg, #34d399 0%, #10b981 45%, #059669 100%);
    color: #022c22;
    box-shadow: 0 12px 36px rgba(16, 185, 129, 0.35);
}

.controle .calculate-btn {
    background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 45%, #0284c7 100%);
    color: #082f49;
    box-shadow: 0 12px 36px rgba(14, 165, 233, 0.3);
}

.average-display {
    margin-top: 20px;
    padding: 20px 18px;
    border-radius: var(--calc-radius-sm);
    text-align: center;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(2, 6, 23, 0.5);
}

.principal .average-display {
    border-color: rgba(52, 211, 153, 0.25);
    box-shadow: inset 0 0 40px rgba(52, 211, 153, 0.06);
}

.controle .average-display {
    border-color: rgba(56, 189, 248, 0.25);
    box-shadow: inset 0 0 40px rgba(56, 189, 248, 0.06);
}

.average-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--calc-muted);
    margin-bottom: 8px;
}

.average-value {
    font-size: clamp(2rem, 6vw, 2.65rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(180deg, #fff 0%, #e2e8f0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.result-badge {
    margin-top: 14px;
    padding: 10px 22px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: inline-block;
    border: 1px solid transparent;
}

.result-badge.result-admis {
    color: #ecfdf5;
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.9), rgba(5, 150, 105, 0.95));
    border-color: rgba(52, 211, 153, 0.45);
    animation: calc-pulse-ok 2.2s ease-in-out infinite;
}

.result-badge.result-controle {
    color: #fffbeb;
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.95), rgba(234, 88, 12, 0.9));
    border-color: rgba(251, 191, 36, 0.4);
    animation: calc-pulse-warn 2.2s ease-in-out infinite;
}

.result-badge.result-refuse {
    color: #fef2f2;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.92), rgba(185, 28, 28, 0.95));
    border-color: rgba(248, 113, 113, 0.4);
}

.result-message {
    margin-top: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--calc-muted);
}

@keyframes calc-pulse-ok {
    0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.35); }
    50% { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); }
}

@keyframes calc-pulse-warn {
    0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.3); }
    50% { box-shadow: 0 0 0 10px rgba(251, 191, 36, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .result-badge.result-admis,
    .result-badge.result-controle {
        animation: none;
    }
}

/* Instructions */
.instructions {
    border-radius: var(--calc-radius);
    padding: 22px 22px 24px;
    background: var(--calc-surface);
    border: 1px solid var(--calc-border);
    max-width: 820px;
    margin: 0 auto 28px;
    backdrop-filter: blur(14px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

.instructions p {
    margin: 10px 0;
    color: #cbd5e1;
    line-height: 1.65;
    font-size: 0.9rem;
}

.instructions strong {
    color: #a5b4fc;
    font-weight: 800;
}

.calc-upload-block {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.calc-upload-block > p:first-child {
    margin-bottom: 12px !important;
    color: var(--calc-text) !important;
}

.calc-upload-hint {
    margin-top: 10px;
    font-size: 0.82rem;
    color: var(--calc-muted) !important;
}

.upload-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
    color: #020617;
    background: linear-gradient(135deg, #a5b4fc, #818cf8);
    border: 1px solid rgba(129, 140, 248, 0.5);
    box-shadow: 0 10px 28px rgba(99, 102, 241, 0.3);
    transition: transform 0.15s ease;
}

.upload-link:hover {
    transform: translateY(-2px);
}

.calc-ai-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
}

.calc-ai-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.calc-pill--file {
    cursor: pointer;
    margin: 0;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.calc-ai-btn {
    cursor: pointer;
    border: none;
    border-radius: 12px;
    padding: 11px 20px;
    font-weight: 800;
    font-size: 0.88rem;
    font-family: inherit;
    color: #020617;
    background: linear-gradient(135deg, #a5b4fc, #818cf8);
    border: 1px solid rgba(129, 140, 248, 0.5);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.28);
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.calc-ai-btn:hover:not(:disabled) {
    transform: translateY(-2px);
}

.calc-ai-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.calc-ai-status {
    min-height: 1.35em;
    margin-top: 12px;
    font-size: 0.84rem;
    color: var(--calc-muted);
}

.calc-ai-status.is-ok {
    color: #6ee7b7;
}

.calc-ai-status.is-error {
    color: #fca5a5;
}

.warning-box {
    margin: 0 0 16px;
    padding: 14px 16px;
    border-radius: var(--calc-radius-sm);
    background: rgba(120, 53, 15, 0.2);
    border: 1px solid rgba(251, 191, 36, 0.28);
    color: #fde68a;
    font-size: 0.86rem;
    line-height: 1.5;
}

.warning-box strong {
    color: #fef3c7;
}

.footer {
    text-align: center;
    padding: 24px 16px;
    color: var(--calc-muted);
    font-size: 0.82rem;
}

.footer p {
    margin: 4px 0;
}

/* Celebration */
.celebration-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(2, 6, 23, 0.88);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    animation: calc-fade-in 0.4s ease;
}

.celebration-overlay.active {
    display: flex;
}

.celebration-content {
    text-align: center;
    padding: 32px;
}

.celebration-text {
    font-size: clamp(2.2rem, 10vw, 3.5rem);
    font-weight: 800;
    background: linear-gradient(135deg, #fde68a, #f472b6, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
}

.celebration-overlay .btn {
    padding: 14px 28px;
    border-radius: 12px;
    border: none;
    font-family: inherit;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    background: rgba(248, 250, 252, 0.95);
    color: #0f172a;
}

@keyframes calc-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 768px) {
    body.calc-page {
        padding: 16px 14px 88px;
    }

    .subject-row {
        flex-direction: column;
        align-items: stretch;
    }

    .note-input {
        width: 100%;
    }

    .header h1 {
        font-size: 1.4rem;
    }
}
