/* Vzhled navazuje na evtech.cz: modrá #1997e5, doplňková #468c98,
   nadpisy Exo 2, text Source Sans 3. */

:root {
    --color-primary: #1997e5;
    --color-primary-hover: #1877e5;
    --color-secondary: #468c98;
    --color-secondary-hover: #3b7580;
    --color-text: #252525;
    --color-muted: #6b7580;
    --color-border: #e3e8ee;
    --color-bg: #f5f7fa;
    --color-surface: #ffffff;
    --color-success: #2e9e5b;
    --color-danger: #d64545;
    --color-warning: #d98c1f;
    --font-text: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    --font-heading: "Exo 2", "Source Sans 3", -apple-system, "Segoe UI", Arial, sans-serif;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(20, 40, 60, .08);
    --shadow-lifted: 0 4px 16px rgba(20, 40, 60, .10);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-text);
    font-size: 16px;
    line-height: 1.55;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 .6rem;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }

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

.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Hlavička ---------------------------------------------------------- */

.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 20;
}

.site-header .container {
    display: flex;
    align-items: center;
    gap: 28px;
    min-height: 66px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--color-text);
    white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--color-text); }

.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: grid;
    place-items: center;
    color: #fff;
    font-size: .95rem;
    font-weight: 700;
}

.main-nav {
    display: flex;
    gap: 4px;
    margin-right: auto;
    flex-wrap: wrap;
}

.main-nav a {
    padding: 8px 14px;
    border-radius: var(--radius);
    color: var(--color-text);
    font-weight: 600;
    font-size: .95rem;
}
.main-nav a:hover { background: rgba(25, 151, 229, .08); color: var(--color-primary); text-decoration: none; }
.main-nav a.is-active { background: var(--color-primary); color: #fff; }

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .9rem;
    color: var(--color-muted);
}

/* --- Obsah ------------------------------------------------------------- */

.page { padding: 28px 0 60px; }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.page-head p { margin: 0; color: var(--color-muted); }

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.card-head h2, .card-head h3 { margin: 0; }

/* --- Statistiky -------------------------------------------------------- */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-top: 3px solid var(--color-primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
}
.stat.is-secondary { border-top-color: var(--color-secondary); }
.stat.is-success { border-top-color: var(--color-success); }
.stat.is-warning { border-top-color: var(--color-warning); }

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.1;
}
.stat-label { color: var(--color-muted); font-size: .88rem; }

/* --- Mřížka zdrojů ----------------------------------------------------- */

.source-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

.source-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s ease, transform .15s ease;
}
.source-card:hover { box-shadow: var(--shadow-lifted); transform: translateY(-2px); }

.source-card h3 { margin-bottom: 2px; }
.source-card h3 a { color: var(--color-text); }
.source-card h3 a:hover { color: var(--color-primary); text-decoration: none; }

.source-meta {
    font-size: .84rem;
    color: var(--color-muted);
    margin-bottom: 12px;
}

.source-summary {
    font-size: .93rem;
    color: #414b56;
    margin: 0 0 14px;
}

.source-card .change-list { margin-top: auto; }

/* --- Seznam změn ------------------------------------------------------- */

.change-list { list-style: none; margin: 0; padding: 0; }

.change-list li {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid var(--color-border);
    font-size: .92rem;
}
.change-list li:first-child { border-top: none; }

.change-title { flex: 1; min-width: 0; }
.change-title a { color: var(--color-text); }
.change-title a:hover { color: var(--color-primary); }

.change-value { color: var(--color-muted); font-size: .85rem; white-space: nowrap; }
.change-value strong { color: var(--color-text); }

/* --- Štítky ------------------------------------------------------------ */

.tag {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 100px;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    white-space: nowrap;
    background: #eef1f5;
    color: var(--color-muted);
}

.tag-added { background: rgba(46, 158, 91, .12); color: var(--color-success); }
.tag-removed { background: rgba(214, 69, 69, .12); color: var(--color-danger); }
.tag-price_up { background: rgba(214, 69, 69, .12); color: var(--color-danger); }
.tag-price_down { background: rgba(46, 158, 91, .12); color: var(--color-success); }
.tag-availability { background: rgba(217, 140, 31, .14); color: var(--color-warning); }
.tag-highlight { background: rgba(25, 151, 229, .12); color: var(--color-primary); }
.tag-updated { background: rgba(70, 140, 152, .14); color: var(--color-secondary); }

.tag-state { background: rgba(46, 158, 91, .12); color: var(--color-success); }
.tag-state.is-off { background: #eef1f5; color: var(--color-muted); }

/* --- Tabulky ----------------------------------------------------------- */

.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
}

table.data th, table.data td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

table.data th {
    font-family: var(--font-heading);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--color-muted);
    background: #fafbfc;
    white-space: nowrap;
}

table.data tbody tr:hover { background: #fafbfc; }
table.data td.num { text-align: right; white-space: nowrap; }

/* --- Formuláře --------------------------------------------------------- */

.field { margin-bottom: 14px; }

.field label {
    display: block;
    font-weight: 600;
    font-size: .9rem;
    margin-bottom: 4px;
}

.field input[type="text"],
.field input[type="url"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field select,
.field textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: .95rem;
    color: var(--color-text);
    background: #fff;
}

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

.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(25, 151, 229, .14);
}

.field-inline { display: flex; align-items: center; gap: 8px; }
.field-inline label { margin: 0; }
.field-hint { font-size: .82rem; color: var(--color-muted); margin-top: 4px; }

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0 16px;
}

.btn {
    display: inline-block;
    padding: 9px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--color-primary);
    color: #fff;
    font-family: var(--font-text);
    font-weight: 600;
    font-size: .95rem;
    cursor: pointer;
    transition: background .15s ease;
}
.btn:hover { background: var(--color-primary-hover); color: #fff; text-decoration: none; }

.btn-secondary { background: var(--color-secondary); }
.btn-secondary:hover { background: var(--color-secondary-hover); }

.btn-ghost {
    background: transparent;
    border-color: var(--color-border);
    color: var(--color-text);
}
.btn-ghost:hover { background: #f3f5f8; color: var(--color-text); }

.btn-small { padding: 5px 12px; font-size: .85rem; }

/* --- Hlášky ------------------------------------------------------------ */

.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    border-left: 3px solid var(--color-success);
    background: rgba(46, 158, 91, .08);
    margin-bottom: 20px;
}
.flash.is-error { border-left-color: var(--color-danger); background: rgba(214, 69, 69, .08); }

.empty {
    padding: 28px 20px;
    text-align: center;
    color: var(--color-muted);
    background: #fafbfc;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
}

.token-box {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .9rem;
    word-break: break-all;
    background: #0f2432;
    color: #7fd4ff;
    padding: 14px 16px;
    border-radius: var(--radius);
    margin: 10px 0;
}

/* --- Přihlášení -------------------------------------------------------- */

.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(150deg, #eef5fb 0%, #f5f7fa 55%, #eaf1f2 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lifted);
    padding: 32px;
}

.login-card .brand { margin-bottom: 20px; }

/* --- Detail ------------------------------------------------------------ */

.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    align-items: start;
}

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

.timeline { list-style: none; margin: 0; padding: 0; }

.timeline li {
    padding: 10px 0 10px 16px;
    border-left: 2px solid var(--color-border);
    position: relative;
}

.timeline li::before {
    content: "";
    position: absolute;
    left: -5px;
    top: 17px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-border);
}
.timeline li.has-changes::before { background: var(--color-primary); }

.timeline .t-date { font-weight: 600; font-size: .9rem; }
.timeline .t-meta { font-size: .83rem; color: var(--color-muted); }

.filters {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.filters .field { margin-bottom: 0; min-width: 190px; }

.pagination {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 18px;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: .9rem;
    background: #fff;
}
.pagination .is-current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.muted { color: var(--color-muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

details.editor summary {
    cursor: pointer;
    font-weight: 600;
    font-size: .9rem;
    color: var(--color-primary);
    padding: 6px 0;
}
details.editor[open] summary { margin-bottom: 10px; }

.site-footer {
    padding: 22px 0;
    border-top: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: .85rem;
    background: var(--color-surface);
}

@media (max-width: 640px) {
    .site-header .container { min-height: auto; padding-top: 10px; padding-bottom: 10px; }
    .main-nav { order: 3; width: 100%; }
    h1 { font-size: 1.45rem; }
}
