/* ComicEngine admin panel — większość stylingu robi MudBlazor.
   Tu zostają tylko: pre-hydration fallback dla body i style ekranu logowania
   (Login.razor jest SSR-only, bez interaktywnych komponentów Mud). */

html, body { height: 100%; margin: 0; }

body {
    background: #0b0b10;
    color: #ececf1;
    font-family: "Roboto", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

code {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.85em;
    word-break: break-all;
}

/* ============================================================
   RECENT EPISODES list — używana na dashboardzie.
   Każdy element to klikalna karta, hover lift + accent border.
   ============================================================ */

.recent-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem 0.75rem 0.6rem;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: border-color 140ms ease, transform 140ms ease, background 140ms ease;
}
.recent-item:hover {
    border-color: var(--mud-palette-primary);
    background: rgba(139, 92, 246, 0.04);
    transform: translateY(-1px);
    text-decoration: none;
    color: inherit;
}

.recent-number {
    flex: 0 0 auto;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--mud-palette-text-secondary);
    min-width: 36px;
    text-align: left;
}

.recent-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.recent-title {
    font-weight: 600;
    color: var(--mud-palette-text-primary);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.recent-meta {
    font-size: 0.78rem;
    color: var(--mud-palette-text-secondary);
}

@media (max-width: 600px) {
    .recent-item { padding: 0.65rem 0.8rem 0.65rem 0.5rem; gap: 0.55rem; }
    .recent-number { font-size: 0.85rem; min-width: 30px; }
    .recent-title { font-size: 0.9rem; }
}

/* ============================================================
   JOBS — admin page z listą Quartz triggerów
   ============================================================ */

.jobs-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.job-card {
    border: 1px solid var(--mud-palette-lines-default);
    transition: border-color 140ms ease;
}
.job-card:hover { border-color: var(--mud-palette-primary); }

.job-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.job-card-title { flex: 1; min-width: 0; }

.job-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.job-card-cell { min-width: 0; }
.job-card-label {
    color: var(--mud-palette-text-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 0.3rem;
}
.job-card-value {
    font-size: 0.9rem;
    color: var(--mud-palette-text-primary);
    line-height: 1.4;
}
.job-card-sub {
    color: var(--mud-palette-text-secondary);
    font-size: 0.75rem;
    margin-top: 0.15rem;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

.job-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    border-top: 1px solid var(--mud-palette-lines-default);
    padding-top: 0.85rem;
}

@media (max-width: 600px) {
    .job-card-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   STORIES list — klikalne karty-wiersze z action buttonem obok
   ============================================================ */

.stories-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.story-card {
    display: flex;
    align-items: stretch;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    transition: border-color 140ms ease, background 140ms ease;
    overflow: hidden;
}
.story-card:hover {
    border-color: var(--mud-palette-primary);
    background: rgba(139, 92, 246, 0.04);
}

.story-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.85rem 1rem;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}
.story-main:hover { text-decoration: none; color: inherit; }

.story-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.story-title-wrap {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}
.story-id {
    color: var(--mud-palette-text-secondary);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.8rem;
    flex: 0 0 auto;
}
.story-title {
    font-weight: 600;
    font-size: 1.02rem;
    color: var(--mud-palette-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.story-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--mud-palette-text-secondary);
    font-size: 0.82rem;
    flex-wrap: wrap;
}
.story-meta .mud-icon-root { font-size: 1rem !important; }
.story-genre {
    color: var(--mud-palette-primary);
    background: rgba(139, 92, 246, 0.12);
    padding: 0.1rem 0.55rem;
    border-radius: 99px;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.meta-dot { opacity: 0.5; }

.story-actions {
    display: flex;
    align-items: center;
    padding: 0 1rem;
    border-left: 1px solid var(--mud-palette-lines-default);
}

@media (max-width: 600px) {
    .story-card { flex-direction: column; }
    .story-actions {
        border-left: none;
        border-top: 1px solid var(--mud-palette-lines-default);
        padding: 0.6rem 1rem;
        justify-content: flex-end;
    }
    .story-title { white-space: normal; }
}

/* ============================================================
   CHARACTERS grid — karty z reference image (lub placeholder z inicjałem)
   ============================================================ */

.character-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}
.character-card-link:hover { text-decoration: none; color: inherit; }

.character-card {
    height: 100%;
    border: 1px solid var(--mud-palette-lines-default);
    transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
    overflow: hidden;
    background: var(--mud-palette-surface);
}
.character-card-link:hover .character-card {
    border-color: var(--mud-palette-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.character-media {
    height: 200px;
    background-size: cover;
    background-position: center;
    background-color: #1f1f28;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}
.character-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}
.character-placeholder span {
    font-size: 4rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.character-body {
    padding: 0.9rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.character-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--mud-palette-text-primary);
    margin-bottom: 0.25rem;
}
.character-anchor {
    font-size: 0.78rem;
    color: var(--mud-palette-text-secondary);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.character-anchor strong {
    color: var(--mud-palette-text-primary);
    font-weight: 600;
    margin-right: 0.25rem;
}
.character-expr {
    font-style: italic;
    margin-top: 0.2rem;
    border-top: 1px dashed var(--mud-palette-lines-default);
    padding-top: 0.4rem;
}

/* ============================================================
   BOTTOM NAV — Material-style bottom navigation dla mobile (<md).
   3 sekcje stale widoczne, większe tap-targety na kciuk.
   ============================================================ */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(22, 22, 29, 0.96);
    border-top: 1px solid #2f2f3a;
    backdrop-filter: saturate(180%) blur(8px);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
    justify-content: space-around;
    align-items: stretch;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    color: #95959e;
    text-decoration: none;
    padding: 0.5rem 0.6rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    flex: 1;
    transition: color 140ms ease, background 140ms ease;
    border-top: 2px solid transparent;
    min-width: 0;
}
.bottom-nav-item:hover,
.bottom-nav-item:focus {
    color: #ececf1;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.03);
}
.bottom-nav-item.active {
    color: #8b5cf6;
    border-top-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.08);
}
.bn-icon {
    display: inline-flex;
    line-height: 1;
}
.bn-label {
    line-height: 1;
}

/* Padding pod content na mobile — bottom nav nie zakrywa ostatniego elementu */
@media (max-width: 959.95px) {
    .mud-main-content {
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0)) !important;
    }
}

/* Story detail tabs — kompaktowy mode żeby wszystkie 6 sekcji mieściło się bez scrollu */
.story-tabs .mud-tab {
    min-width: 0;
    padding: 8px 14px;
    font-size: 0.85rem;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
}
@media (max-width: 768px) {
    .story-tabs .mud-tab {
        padding: 8px 10px;
        font-size: 0.78rem;
    }
}

/* ============================================================
   LOGIN — SSR-only form (cookie SignIn wymaga pełnego HTTP POST),
   więc nie używamy interaktywnych MudTextField. Stylujemy ręcznie
   tak, by pasowało do reszty (Material-ish outlined inputs).
   ============================================================ */

.login-shell {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    max-width: 420px;
    width: 100%;
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}
.login-header > * { display: block; margin: 0 auto; }
.login-header .mud-icon-root { margin-bottom: 0.5rem; }

.login-field { margin-bottom: 1rem; }
.login-field label {
    display: block;
    margin-bottom: 0.35rem;
    color: #95959e;
    font-size: 0.8rem;
    font-weight: 500;
}
.login-field input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    color: #ececf1;
    border: 1px solid #40404a;
    border-radius: 4px;
    padding: 0.7rem 0.85rem;
    font: inherit;
    font-size: 16px; /* anti-zoom iOS Safari */
    transition: border-color 140ms ease, box-shadow 140ms ease;
}
.login-field input:hover { border-color: #5a5a66; }
.login-field input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}
.login-field .validation-message {
    color: #f87171;
    font-size: 0.78rem;
    margin-top: 0.3rem;
}

.login-submit {
    width: 100%;
    background: #8b5cf6;
    color: #1a1a1d;
    border: none;
    border-radius: 4px;
    padding: 0.7rem 1rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background 140ms ease;
}
.login-submit:hover { background: #7c3aed; }
.login-submit:active { transform: translateY(1px); }
