@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

/* ── Základ ──────────────────────────────────────────────────────── */

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

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    -webkit-font-smoothing: antialiased;
}

/* ── Horní lišta ─────────────────────────────────────────────────── */

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0 1rem;
    padding-top: env(safe-area-inset-top);
    height: calc(56px + env(safe-area-inset-top));
    background: linear-gradient(135deg, #1b6ec2, #0d4a9e);
    box-shadow: 0 2px 12px rgba(13, 74, 158, 0.35);
    padding-bottom: 10px;
}

.app-header-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-header-user {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.75);
    margin-right: 0.25rem;
}

.header-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.header-btn:hover { background: rgba(255,255,255,0.25); }
.header-btn:disabled { opacity: 0.5; cursor: default; }
.header-btn-logout { font-size: 1rem; }

/* ── Obsah stránky ───────────────────────────────────────────────── */

.app-content {
    max-width: 760px;
    margin: 0 auto;
    padding: 1rem 0.75rem 0;
}

/* ── Banner nových známek ────────────────────────────────────────── */

.new-grades-banner {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border: 1px solid #b8dfc5;
    border-radius: 14px;
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
}

.new-grades-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #155724;
    margin-bottom: 0.6rem;
}

.new-grade-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.2rem 0;
}

.new-grade-subject {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1a3a24;
}

.new-grade-desc {
    font-size: 0.85rem;
    color: #2d6a3f;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Loading stav ────────────────────────────────────────────────── */

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    color: #6c757d;
}

/* ── Karta předmětu ──────────────────────────────────────────────── */

.subject-card {
    background: #fff;
    border-radius: 16px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
    overflow: hidden;
}

.subject-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.1rem 0.75rem;
    border-bottom: 1px solid #f0f2f5;
}

.subject-name {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a2e;
}

.subject-avg {
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
}

.avg-1 { color: #28a745; }
.avg-2 { color: #1b6ec2; }
.avg-3 { color: #e6850e; }
.avg-5 { color: #dc3545; }

/* ── Tabulka známek ──────────────────────────────────────────────── */

.grades-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.grades-table thead tr {
    background: #f8f9fa;
}

.grades-table th {
    padding: 0.45rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #9098a9;
    border-bottom: 1px solid #eef0f3;
    white-space: nowrap;
}

.grades-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #f4f5f7;
    vertical-align: middle;
}

.grades-table tbody tr:last-child td {
    border-bottom: none;
}

.grades-table tbody tr:hover {
    background: #fafbfc;
}

/* Sloupce */
.col-grade { width: 52px; text-align: center; }
.col-weight { width: 48px; text-align: center; font-size: 0.82rem; }
.col-desc { color: #3a3a4a; }
.col-date { width: 72px; text-align: right; font-size: 0.8rem; white-space: nowrap; }

/* ── Odznaky (badge) pro známky ──────────────────────────────────── */

.grade-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.95rem;
    color: #fff;
}

.badge-1 { background: #28a745; }
.badge-2 { background: #1b6ec2; }
.badge-3 { background: #e6850e; }
.badge-5 { background: #dc3545; }
.badge-other { background: #6c757d; }

/* ── Patička karty ───────────────────────────────────────────────── */

.subject-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #fafbfc;
    border-top: 1px solid #f0f2f5;
    font-size: 0.78rem;
}

/* ── Demo stránka ────────────────────────────────────────────────── */

.demo-badge {
    background: rgba(255,255,255,0.25);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
}

.demo-banner {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 12px;
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    color: #7a5c00;
    margin-bottom: 1rem;
}

.demo-banner a { color: #1b6ec2; font-weight: 600; }

/* ── Simulace známky ─────────────────────────────────────────────── */

.sim-toggle-btn {
    background: #eef4ff;
    border: 1.5px solid #1b6ec2;
    border-radius: 10px;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1b6ec2;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.sim-toggle-btn:hover {
    background: #dce9ff;
    border-color: #1559a0;
}

.sim-panel {
    padding: 0.85rem 1rem;
    background: #f8f9ff;
    border-top: 1px solid #e8ecf8;
}

.sim-row {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.sim-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.sim-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #9098a9;
}

.sim-select {
    border: 1.5px solid #d0d5dd;
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    font-size: 16px; /* min 16px = iOS Safari nezoomuje */
    font-weight: 600;
    color: #1a1a2e;
    background: #fff;
    cursor: pointer;
    outline: none;
    min-width: 64px;
}

.sim-select:focus { border-color: #1b6ec2; }

.sim-input-number {
    border: 1.5px solid #d0d5dd;
    border-radius: 8px;
    padding: 0.4rem 0.5rem;
    font-size: 16px; /* min 16px = iOS Safari nezoomuje */
    font-weight: 600;
    color: #1a1a2e;
    background: #fff;
    width: 72px;
    outline: none;
    -moz-appearance: textfield;
}

.sim-input-number:focus { border-color: #1b6ec2; }
.sim-input-number::-webkit-inner-spin-button,
.sim-input-number::-webkit-outer-spin-button {
    opacity: 1;
}

.sim-result {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-left: auto;
    align-items: flex-end;
}

.sim-result-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #9098a9;
}

.sim-result-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
}

.sim-add-btn {
    align-self: flex-end;
    background: #1b6ec2;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.45rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.sim-add-btn:hover { background: #1559a0; }

/* Simulované řádky v tabulce */
.sim-row-table {
    background: #f5f7ff;
}

.sim-row-table td {
    border-bottom: 1px dashed #c8d0e8 !important;
    font-style: italic;
}

.sim-badge {
    opacity: 0.75;
    outline: 2px dashed rgba(255,255,255,0.6);
    outline-offset: -3px;
}

.sim-desc-cell {
    color: #7b8bb2 !important;
    font-size: 0.82rem;
}

.col-del {
    width: 32px;
    text-align: center;
    padding: 0 0.25rem !important;
}

.sim-del-btn {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.2rem;
    line-height: 1;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.sim-del-btn:hover { opacity: 1; }

/* ── Validační hlášky (Blazor formuláře) ─────────────────────────── */

.valid.modified:not([type=checkbox]) { outline: 1px solid #28a745; }
.invalid { outline: 1px solid #dc3545; }
.validation-message { color: #dc3545; font-size: 0.82rem; }

/* ── Chybová lišta Blazoru ───────────────────────────────────────── */

#blazor-error-ui {
    background: #fff3cd;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,.15);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-size: 0.9rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ── Přihlašovací stránka ────────────────────────────────────────── */

.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1b6ec2 0%, #0d4a9e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    padding-top: max(env(safe-area-inset-top), 1rem);
}

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

.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 24px 64px rgba(0,0,0,0.28);
}

.login-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.logo-icon {
    font-size: 3rem;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0;
    color: #1a1a2e;
    letter-spacing: -0.02em;
}

.login-subtitle {
    color: #6c757d;
    margin: 0.25rem 0 0;
    font-size: 0.95rem;
}

.login-hint {
    font-size: 0.88rem;
    color: #6c757d;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 0.6rem 0.85rem;
    margin: 0 0 0.25rem;
    line-height: 1.5;
}

.login-form { margin-top: 1.5rem; }

.detected-username {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1b6ec2;
    background: #eef4ff;
    border: 2px solid #1b6ec2;
    border-radius: 10px;
    padding: 0.65rem 1rem;
    letter-spacing: 0.01em;
}

/* ── Info modal (přidat na plochu) ───────────────────────────── */

.info-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 500;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.info-modal {
    background: #fff;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.18);
    animation: slideUp 0.2s ease;
}

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

.info-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.25rem 0.75rem;
    border-bottom: 1px solid #f0f2f5;
    position: sticky;
    top: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
}

.info-modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a2e;
}

.info-close-btn {
    background: #f0f2f5;
    border: none;
    color: #6c757d;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.info-close-btn:hover { background: #e2e5ea; }

.info-modal-body {
    padding: 1rem 1.25rem 1.5rem;
}

.info-modal-lead {
    font-size: 0.9rem;
    color: #4a4a5a;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.info-platform {
    background: #f8f9ff;
    border: 1px solid #e8ecf8;
    border-radius: 14px;
    padding: 1rem 1.1rem;
    margin-bottom: 0.85rem;
}

.info-platform-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 0.6rem;
}

.info-steps {
    margin: 0;
    padding-left: 1.3rem;
    font-size: 0.88rem;
    color: #3a3a4a;
    line-height: 1.7;
}

.info-steps li { margin-bottom: 0.15rem; }

.info-icon-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e8ecf8;
    border-radius: 6px;
    padding: 0.05rem 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1b6ec2;
    vertical-align: middle;
}

.info-modal-note {
    font-size: 0.82rem;
    color: #9098a9;
    margin: 0.9rem 0 0;
    line-height: 1.5;
}
