/* ================================================================
   KPDI Campus — BMW M Design System
   Inter 700 (display / labels) · 300 (body)
   ================================================================ */

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

:root {
    /* ── BMW M Surface ── */
    --bg:            #000000;
    --bg2:           #0d0d0d;
    --surface:       #1a1a1a;
    --surface2:      #262626;
    --surface-hover: #262626;

    /* ── Hairlines ── */
    --border:        #3c3c3c;
    --border-hover:  #555555;
    --border-focus:  #ffffff;

    /* ── Text ── */
    --text:          #ffffff;
    --text-dim:      #bbbbbb;
    --text-muted:    #7e7e7e;
    --text-light:    #ffffff;

    /* ── Semantic (functional only — not UI chrome) ── */
    --blue:          #0066b1;
    --blue-light:    #1c69d4;
    --blue-glow:     transparent;
    --violet:        #7e7e7e;
    --green:         #0fa336;
    --green-glow:    transparent;
    --amber:         #f4b400;
    --red:           #e22718;
    --red-glow:      transparent;

    /* ── M Tricolor (brand-identity dividers only) ── */
    --m-blue-light:  #0066b1;
    --m-blue-dark:   #1c69d4;
    --m-red:         #e22718;

    /* ── Login compat ── */
    --accent:        #ffffff;
    --bg-dark:       #000000;

    /* ── Zero radius (BMW M rule) ── */
    --radius-sm:  0px;
    --radius-md:  0px;
    --radius-lg:  0px;
    --radius-xl:  0px;

    --transition:      200ms ease;
    --transition-slow: 350ms ease;
}

html {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 300;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

body {
    min-height: 100vh;
    background: var(--bg);
}

.visually-hidden {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

/* ── Header ──────────────────────────────────────────────────── */
.header {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 32px; height: 64px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none; color: var(--text);
}

.logo-mark {
    width: 36px; height: 36px; border-radius: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.75rem; color: var(--text);
    flex-shrink: 0;
}

.logo-text {
    font-size: 0.875rem; font-weight: 700;
    letter-spacing: 0.05em; text-transform: uppercase;
}

.logo-sub {
    font-size: 0.6rem; color: var(--text-muted);
    font-weight: 300; letter-spacing: 0.08em; text-transform: uppercase;
}

.header-nav { display: flex; align-items: center; gap: 12px; }

.header-badge {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 14px; border-radius: 0;
    background: var(--surface); border: 1px solid var(--border);
    font-size: 0.7rem; font-weight: 700; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--text-muted);
}

/* ── Steps Bar ────────────────────────────────────────────────── */
.steps-bar {
    display: flex; align-items: center; justify-content: center;
    gap: 0; padding: 16px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--bg2);
    overflow-x: auto;
}

.step {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 12px; border-radius: 0;
    font-size: 0.7rem; font-weight: 700;
    letter-spacing: 1.5px; text-transform: uppercase;
    color: var(--text-muted); white-space: nowrap;
    transition: color var(--transition);
}

.step__num {
    width: 24px; height: 24px; border-radius: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; font-weight: 700;
    background: var(--surface); border: 1px solid var(--border);
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.step--active { color: var(--text); }
.step--active .step__num {
    background: var(--text); border-color: var(--text); color: var(--bg);
}

.step--done { color: var(--green); }
.step--done .step__num {
    background: transparent; border-color: var(--green); color: var(--green);
}

.step-line {
    width: 32px; height: 1px;
    background: var(--border); flex-shrink: 0;
}

/* ── Main ────────────────────────────────────────────────────── */
.main {
    max-width: 760px; margin: 0 auto;
    padding: 40px 24px 80px;
}

/* ── Panel ───────────────────────────────────────────────────── */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 36px;
    margin-bottom: 20px;
    animation: panelIn 0.3s ease both;
}

@keyframes panelIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.panel__header { margin-bottom: 28px; }

.panel__title {
    display: flex; align-items: center; gap: 12px;
    font-size: 0.875rem; font-weight: 700;
    letter-spacing: 1.5px; text-transform: uppercase;
    margin-bottom: 8px;
}

.panel__title-icon {
    width: 36px; height: 36px; border-radius: 0; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface2); border: 1px solid var(--border);
    color: var(--text-dim);
}

.panel__subtitle {
    font-size: 0.875rem; font-weight: 300; color: var(--text-dim);
    line-height: 1.6; padding-left: 48px;
}

.panel__actions {
    display: flex; justify-content: flex-end;
    gap: 12px; margin-top: 28px;
}

.panel__actions--between { justify-content: space-between; }

/* ── Dropzone ─────────────────────────────────────────────────── */
.dropzone {
    border: 1px dashed var(--border);
    border-radius: 0;
    padding: 48px 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    position: relative;
    margin-bottom: 24px;
}

.dropzone:hover,
.dropzone:focus,
.dropzone--dragover {
    border-color: var(--text);
    background: rgba(255,255,255,0.02);
    outline: none;
}

.dropzone--has-file {
    border-style: solid;
    border-color: var(--green);
    background: transparent;
    padding: 20px 24px;
}

.dropzone__icon {
    width: 64px; height: 64px; border-radius: 0;
    background: var(--surface2); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-dim); margin: 0 auto 16px;
}

.dropzone__text  { font-size: 0.9rem; font-weight: 300; color: var(--text-dim); margin-bottom: 6px; }
.dropzone__link  { color: var(--text); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.dropzone__hint  { font-size: 0.75rem; font-weight: 300; color: var(--text-muted); }
.dropzone__selected { width: 100%; }

.file-preview {
    display: flex; align-items: center; gap: 14px;
    background: var(--surface2); border: 1px solid var(--green);
    border-radius: 0; padding: 14px 18px;
}

.file-preview__icon {
    width: 36px; height: 36px; border-radius: 0; flex-shrink: 0;
    background: transparent; border: 1px solid var(--green);
    display: flex; align-items: center; justify-content: center;
    color: var(--green);
}

.file-preview__info { flex: 1; min-width: 0; text-align: left; }
.file-preview__name { font-size: 0.875rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-preview__size { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.file-preview__remove {
    width: 30px; height: 30px; border-radius: 0; flex-shrink: 0;
    border: 1px solid var(--border); background: transparent;
    color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: border-color var(--transition), color var(--transition);
}
.file-preview__remove:hover { border-color: var(--red); color: var(--red); }

/* ── Page Range ──────────────────────────────────────────────── */
.page-range {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 20px 24px;
    margin-bottom: 8px;
}

.page-range__header {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.7rem; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1.5px;
    margin-bottom: 16px;
}

.page-range__inputs { display: flex; align-items: flex-start; gap: 16px; }

.page-range__separator {
    color: var(--text-muted); font-size: 1.2rem; font-weight: 300;
    padding-top: 32px; flex-shrink: 0;
}

/* ── Inputs ──────────────────────────────────────────────────── */
.input-group { flex: 1; display: flex; flex-direction: column; gap: 6px; }

.input-label {
    font-size: 0.7rem; font-weight: 700; color: var(--text-muted);
    letter-spacing: 1.5px; text-transform: uppercase;
}

.input {
    width: 100%; padding: 10px 14px; height: 48px;
    border-radius: 0;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text); font-family: inherit; font-size: 0.9rem; font-weight: 300;
    transition: border-color var(--transition);
    outline: none;
}

.input:focus        { border-color: var(--text); box-shadow: none; }
.input::placeholder { color: var(--text-muted); }
.input-hint         { font-size: 0.7rem; font-weight: 300; color: var(--text-muted); }

.textarea {
    width: 100%; padding: 14px 16px;
    border-radius: 0;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text); font-family: inherit; font-size: 0.9rem; font-weight: 300;
    resize: vertical; min-height: 160px; line-height: 1.7;
    transition: border-color var(--transition);
    outline: none;
}

.textarea:focus        { border-color: var(--text); box-shadow: none; }
.textarea::placeholder { color: var(--text-muted); }

/* ── Progress ────────────────────────────────────────────────── */
.upload-progress { margin-top: 20px; }

.progress-bar {
    width: 100%; height: 4px; border-radius: 0;
    background: var(--surface2); overflow: hidden; margin-bottom: 10px;
}

.progress-bar__fill {
    height: 100%; border-radius: 0;
    background: var(--text);
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.7rem; font-weight: 700; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--text-muted); text-align: center;
}

/* ── Stats Row ───────────────────────────────────────────────── */
.stats-row {
    display: flex; gap: 1px; margin-bottom: 24px; flex-wrap: wrap;
    background: var(--border); border: 1px solid var(--border);
}

.stat-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 16px 20px; border-radius: 0;
    background: var(--surface); border: none; flex: 1;
}

.stat-chip__val {
    font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em;
    color: var(--text);
    background: none; -webkit-background-clip: unset; -webkit-text-fill-color: unset;
}

.stat-chip--used .stat-chip__val {
    color: var(--red);
    background: none; -webkit-background-clip: unset; -webkit-text-fill-color: unset;
}

.stat-chip--free .stat-chip__val {
    color: var(--green);
    background: none; -webkit-background-clip: unset; -webkit-text-fill-color: unset;
}

.stat-chip__lbl {
    font-size: 0.7rem; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 1.5px;
}

/* ── Tickets Grid ────────────────────────────────────────────── */
.tickets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    margin-bottom: 28px;
}

.ticket-chip {
    aspect-ratio: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    border-radius: 0;
    background: var(--surface);
    border: none;
    cursor: pointer; user-select: none;
    transition: background var(--transition);
    position: relative;
}

.ticket-chip:hover  { background: var(--surface2); }
.ticket-chip:active { opacity: 0.7; }

.ticket-chip__num {
    font-size: 1rem; font-weight: 700; line-height: 1; color: var(--green);
}

.ticket-chip__lbl {
    font-size: 0.5rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: rgba(15, 163, 54, 0.6); margin-top: 3px;
}

.ticket-chip--used { background: #2b2b2b; }
.ticket-chip--used .ticket-chip__num { color: var(--red); }
.ticket-chip--used .ticket-chip__lbl { color: rgba(226,39,24,0.6); }

.ticket-chip--used::after {
    content: '';
    position: absolute; top: 5px; right: 5px;
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--red);
}

.ticket-chip--assigned            { background: var(--surface2); }
.ticket-chip--assigned .ticket-chip__num { color: var(--text-dim); }
.ticket-chip--assigned .ticket-chip__lbl { color: var(--text-muted); }

/* ── Names Area ──────────────────────────────────────────────── */
.names-area { margin-bottom: 24px; }

.names-counter {
    font-size: 0.7rem; font-weight: 700; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--text-muted); margin-top: 8px;
    text-align: right;
}

.names-counter__free { color: var(--green); font-weight: 700; }

/* ── Assignments ─────────────────────────────────────────────── */
.assignments-preview {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 0; padding: 20px; margin-bottom: 20px;
}

.assignments-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}

.assignments-header__title {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.7rem; font-weight: 700; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--text-dim);
}

.assignments-list {
    display: flex; flex-direction: column; gap: 1px;
    background: var(--border);
}

.assignment-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-radius: 0;
    background: var(--surface); border: none;
    animation: rowIn 0.2s ease both;
}

@keyframes rowIn {
    from { opacity: 0; transform: translateX(-4px); }
    to   { opacity: 1; transform: translateX(0); }
}

.assignment-row__name {
    font-size: 0.875rem; font-weight: 300; color: var(--text);
    flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.assignment-row__ticket {
    display: flex; align-items: center; gap: 6px;
    flex-shrink: 0; margin-left: 12px;
}

.ticket-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 40px; padding: 4px 10px; border-radius: 0;
    font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em;
    background: transparent; border: 1px solid var(--text-dim);
    color: var(--text);
}

/* ── Late Student ─────────────────────────────────────────────── */
.late-student-section {
    background: var(--surface2); border: 1px solid var(--amber);
    border-radius: 0; padding: 16px 20px; margin-top: 16px;
}

.late-student__header {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.7rem; font-weight: 700; color: var(--amber);
    margin-bottom: 12px; text-transform: uppercase; letter-spacing: 1.5px;
}

.late-student__form { display: flex; gap: 10px; }
.late-student__form .input { flex: 1; }

/* ── Link Card ───────────────────────────────────────────────── */
.link-card {
    background: var(--surface2); border: 1px solid var(--green);
    border-radius: 0; padding: 24px; margin-bottom: 24px;
}

.link-card__status {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.7rem; font-weight: 700; color: var(--green);
    text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 12px;
}

.link-card__url {
    font-size: 0.85rem; font-weight: 300; color: var(--text-dim);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 0; padding: 12px 16px;
    word-break: break-all; line-height: 1.5;
    font-family: 'Inter', monospace; margin-bottom: 16px;
}

.link-card__actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Monitor ──────────────────────────────────────────────────── */
.monitor-section {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 0; padding: 20px; margin-bottom: 20px;
}

.monitor-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}

.monitor-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.7rem; font-weight: 700; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--text-muted);
}

.monitor-grid {
    display: flex; flex-direction: column; gap: 1px;
    background: var(--border);
}

.monitor-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; border-radius: 0;
    background: var(--surface2); border: none; font-size: 0.82rem;
}

.monitor-row__name   { color: var(--text-dim); font-weight: 300; flex: 1; }
.monitor-row__ticket { color: var(--text); font-weight: 700; margin-right: 12px; }

.monitor-status {
    font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1.5px; padding: 2px 8px; border-radius: 0;
}

.monitor-status--opened  { background: transparent; border: 1px solid var(--green); color: var(--green); }
.monitor-status--waiting { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 0 20px; height: 48px; border-radius: 0;
    font-family: inherit; font-size: 0.75rem; font-weight: 700;
    letter-spacing: 1.5px; text-transform: uppercase;
    cursor: pointer; transition: all var(--transition);
    white-space: nowrap; text-decoration: none;
}

.btn:active  { opacity: 0.8; }
.btn:disabled { opacity: 0.3; cursor: not-allowed; }

.btn--sm { padding: 0 14px; height: 36px; font-size: 0.7rem; }
.btn--lg { padding: 0 32px; height: 52px; font-size: 0.8rem; }

/* Primary — white outline on black */
.btn--primary {
    background: var(--bg); color: var(--text);
    border: 1px solid var(--text); box-shadow: none;
}
.btn--primary:hover:not(:disabled) {
    background: var(--text); color: var(--bg);
    transform: none; box-shadow: none;
}

/* Secondary — dim outline */
.btn--secondary {
    background: transparent; border: 1px solid var(--border); color: var(--text-dim);
}
.btn--secondary:hover:not(:disabled) { border-color: var(--text); color: var(--text); }

/* Ghost */
.btn--ghost {
    background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
}
.btn--ghost:hover:not(:disabled) {
    background: var(--surface2); border-color: var(--border-hover); color: var(--text);
}

/* Danger outline */
.btn--danger-outline {
    background: transparent; border: 1px solid var(--red); color: var(--red);
}
.btn--danger-outline:hover:not(:disabled) {
    background: var(--red); color: var(--text); border-color: var(--red);
}

/* ── Dots ────────────────────────────────────────────────────── */
.dot {
    width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
    animation: dotPulse 2s ease-in-out infinite;
}

.dot--green { background: var(--green); }
.dot--amber { background: var(--amber); }
.dot--red   { background: var(--red); }

@keyframes dotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ── Toast Container ──────────────────────────────────────────── */
.toast-container {
    position: fixed; bottom: 24px; right: 24px; z-index: 9999;
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}

.toast {
    display: flex; align-items: center; gap: 10px;
    padding: 0 18px; height: 48px; border-radius: 0;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text); font-size: 0.7rem; font-weight: 700;
    letter-spacing: 1.5px; text-transform: uppercase;
    box-shadow: none; pointer-events: all;
    animation: toastIn 0.25s ease;
    max-width: 360px;
}

.toast--out { animation: toastOut 0.2s ease forwards; }

.toast--success { border-color: var(--green); }
.toast--success::before { content: '✓'; color: var(--green); font-weight: 700; }

.toast--error { border-color: var(--red); }
.toast--error::before { content: '✕'; color: var(--red); font-weight: 700; }

.toast--info { border-color: var(--border-hover); }
.toast--info::before { content: 'ℹ'; color: var(--text-dim); font-weight: 700; }

@keyframes toastIn  { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to   { opacity: 0; transform: translateX(12px); } }

/* ── Utility ──────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 640px) {
    .header  { padding: 0 16px; }
    .main    { padding: 24px 16px 60px; }
    .panel   { padding: 24px 20px; }
    .page-range__inputs  { flex-direction: column; }
    .page-range__separator { display: none; }
    .steps-bar { padding: 12px 16px; gap: 4px; }
    .step__label { display: none; }
    .link-card__actions  { flex-direction: column; }
    .late-student__form  { flex-direction: column; }
}
