/* ==========================================================
   Telmiko Download-Portal
   Telmiko Design · Modern Healthcare
   ========================================================== */

:root {
    /* Telmiko Color Palette */
    --primary-blue: #1E5EFF;
    --accent-cyan: #00D4FF;
    --accent-purple: #5533FF;
    --neutral-white: #FFFFFF;
    --neutral-light: #F5F7FA;
    --neutral-gray: #E8EBF0;
    --text-dark: #1A1A1A;
    --text-light: #6B7280;

    /* Portal-specific colors */
    --bg: #f0f4ff;
    --bg-elev: #ffffff;
    --ink: #1a1f2e;
    --ink-soft: #4a5468;
    --ink-muted: #8a93a5;
    --line: #e5e1d8;
    --line-strong: #d4cfc3;
    --brand-soft: #eff5ff;
    --success: #059669;
    --success-soft: #ecfdf5;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(26, 31, 46, 0.04);
    --shadow-md: 0 4px 14px rgba(26, 31, 46, 0.06);
    --shadow-lg: 0 12px 40px rgba(26, 31, 46, 0.08);
}

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

html,
body {
    min-height: 100vh;
}

body {
    font-family: "adelphi-pe-variable", sans-serif;
    font-variation-settings: 'wght' 400, 'opsz' 10, 'slnt' 0;
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary-blue);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== GATE (Login) ===== */

body.gate {
    background:
        radial-gradient(ellipse at top left, rgba(30, 94, 255, 0.05), transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(85, 51, 255, 0.04), transparent 50%),
        var(--bg);
}

.gate-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px 20px;
}

.gate-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
}

.gate-title {
    font-family: "adelphi-pe-variable", sans-serif;
    font-variation-settings: 'wght' 600, 'opsz' 12, 'slnt' 0;
    font-weight: 600;
    font-size: 34px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 28px 0 12px;
}

.gate-lead {
    color: var(--ink-soft);
    font-size: 15px;
    margin-bottom: 28px;
}

.gate-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.gate-footer {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    font-size: 13px;
    color: var(--ink-muted);
    text-align: center;
}

/* ===== BRAND ===== */

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

.brand-logo {
    height: 40px;
    width: auto;
}

.brand-name {
    font-family: "adelphi-pe-variable", sans-serif;
    font-variation-settings: 'wght' 600, 'opsz' 10, 'slnt' 0;
    font-weight: 600;
    font-size: 18px;
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.brand-sub {
    font-size: 12px;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
}

/* ===== FORMS ===== */

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-soft);
}

.optional {
    color: var(--ink-muted);
    font-weight: 400;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="file"],
.field textarea,
.field select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    color: var(--ink);
    background: var(--bg-elev);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field textarea {
    resize: vertical;
    min-height: 80px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.field input[type="file"] {
    padding: 8px;
    cursor: pointer;
}

/* ===== BUTTONS ===== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none !important;
}

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

.btn-primary:hover {
    background: #1a4ce6;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-ghost {
    background: transparent;
    color: var(--ink-soft);
    border-color: var(--line-strong);
}

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

.btn-download {
    background: var(--brand-soft);
    color: var(--primary-blue);
    border-color: transparent;
    margin-top: auto;
    width: 100%;
    padding: 10px 16px;
    font-weight: 500;
}

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

.btn-danger-ghost {
    background: transparent;
    color: var(--danger);
    border-color: var(--line);
    padding: 7px 12px;
    font-size: 13px;
}

.btn-danger-ghost:hover {
    background: var(--danger-soft);
    border-color: var(--danger);
}

/* ===== ALERTS ===== */

.alert {
    padding: 12px 14px;
    background: var(--danger-soft);
    border: 1px solid #fecaca;
    color: var(--danger);
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
}

.alert-success {
    background: var(--success-soft);
    border-color: #a7f3d0;
    color: var(--success);
}

/* ===== TOPBAR ===== */

.topbar {
    background: var(--bg-elev);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(8px);
}

.topbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-greet {
    font-size: 14px;
    color: var(--ink-soft);
}

/* ===== PORTAL ===== */

.portal-wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

.hero {
    margin-bottom: 40px;
}

.hero h1 {
    font-family: "adelphi-pe-variable", sans-serif;
    font-variation-settings: 'wght' 600, 'opsz' 12, 'slnt' 0;
    font-weight: 600;
    font-size: 48px;
    line-height: 1;
    letter-spacing: -0.03em;
    margin-bottom: 10px;
}

.hero p {
    font-size: 17px;
    color: var(--ink-soft);
    max-width: 560px;
}

/* ===== CATEGORIES ===== */

.cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
}

.cat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 100px;
    background: var(--bg-elev);
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none !important;
    transition: all 0.15s;
}

.cat:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.cat.active {
    background: var(--primary-blue);
    color: var(--neutral-white);
    border-color: var(--primary-blue);
}

.cat-count {
    font-size: 12px;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    font-variant-numeric: tabular-nums;
}

.cat.active .cat-count {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== FILE GRID ===== */

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.file-card {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.file-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--line-strong);
}

.file-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.file-icon {
    display: inline-block;
    padding: 4px 8px;
    font-family: monospace;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    background: var(--ink);
    color: var(--bg-elev);
    border-radius: 4px;
}

.file-cat {
    font-size: 12px;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.file-title {
    font-family: "adelphi-pe-variable", sans-serif;
    font-variation-settings: 'wght' 600, 'opsz' 10, 'slnt' 0;
    font-weight: 600;
    font-size: 19px;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.file-desc {
    font-size: 14px;
    color: var(--ink-soft);
    line-height: 1.5;
    flex-grow: 1;
}

.file-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
}

.file-meta span:first-child::after {
    content: '·';
    margin-left: 10px;
    color: var(--line-strong);
}

/* ===== EMPTY ===== */

.empty {
    text-align: center;
    padding: 80px 20px;
    color: var(--ink-muted);
}

.empty-mark {
    font-family: "adelphi-pe-variable", sans-serif;
    font-variation-settings: 'wght' 600, 'opsz' 12, 'slnt' 0;
    font-size: 64px;
    color: var(--line-strong);
    margin-bottom: 12px;
}

/* ===== PORTAL FOOTER ===== */

.portal-footer {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--ink-muted);
    font-size: 13px;
    border-top: 1px solid var(--line);
}

/* ===== ADMIN ===== */

.admin-wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.admin-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 32px;
    align-items: start;
}

@media (max-width: 900px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }
}

.admin-panel {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}

.admin-panel h2 {
    font-family: "adelphi-pe-variable", sans-serif;
    font-variation-settings: 'wght' 600, 'opsz' 10, 'slnt' 0;
    font-weight: 600;
    font-size: 22px;
    letter-spacing: -0.01em;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.counter {
    font-family: monospace;
    font-size: 13px;
    font-weight: 400;
    color: var(--ink-muted);
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ===== ADMIN LIST ===== */

.admin-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.admin-item:last-child {
    border-bottom: none;
}

.admin-item-main {
    flex: 1;
    min-width: 0;
}

.admin-item-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.admin-item-title strong {
    font-weight: 500;
    font-size: 15px;
}

.admin-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--ink-muted);
}

.admin-item-meta .mono {
    font-family: monospace;
    color: var(--ink-soft);
}

.inline-form {
    flex-shrink: 0;
}

.muted {
    color: var(--ink-muted);
    font-size: 14px;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 640px) {
    .hero h1 {
        font-size: 36px;
    }

    .topbar-inner {
        padding: 14px 16px;
    }

    .portal-wrap {
        padding: 32px 16px 60px;
    }

    .user-greet {
        display: none;
    }

    .gate-card {
        padding: 32px 24px;
    }
}