/* ═══════════════════════════════════════════════════════════
   ADVERTI — Klientská zóna stylesheet
   Barvy: --dark #221f20, --red #a93635, --white #fff, --light #f4f3f1
   Fonty: Ubuntu (headliny), Inter (body)
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;500;700&family=Inter:wght@300;400;500;600&display=swap');

:root {
    --dark:    #221f20;
    --red:     #a93635;
    --red-d:   #8a2b2a;
    --white:   #ffffff;
    --light:   #f4f3f1;
    --mid:     #dedad6;
    --muted:   #8c8885;
    --green:   #2e7d32;
    --green-bg:#e8f5e9;
    --yellow:  #f57c00;
    --yellow-bg:#fff3e0;
    --blue:    #1565c0;
    --blue-bg: #e3f2fd;
    --err:     #c62828;
    --err-bg:  #ffebee;

    --headline: 'Ubuntu', -apple-system, sans-serif;
    --sans:     'Inter', -apple-system, sans-serif;

    --nav-h:   60px;
    --sidebar: 240px;
    --ease:    180ms ease;
    --radius:  6px;
    --shadow:  0 2px 8px rgba(34,31,32,.1);
}

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

html { font-size: 15px; }

body {
    font-family: var(--sans);
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

img { display: block; max-width: 100%; }

/* ── LOGIN STRÁNKA ─────────────────────────────────────────── */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark);
    padding: 20px;
}

.login-box {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 8px 40px rgba(0,0,0,.3);
    padding: 48px 40px 40px;
    width: 100%;
    max-width: 420px;
}

.login-logo {
    display: block;
    height: 44px;
    margin: 0 auto 28px;
}

.login-box h1 {
    font-family: var(--headline);
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}

.login-box .login-sub {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 28px;
}

/* ── FORMULÁŘE ─────────────────────────────────────────────── */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--mid);
    border-radius: var(--radius);
    font-family: var(--sans);
    font-size: 14px;
    color: var(--dark);
    background: var(--white);
    transition: border-color var(--ease);
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--red);
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238c8885' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--red);
    cursor: pointer;
}

/* ── TLAČÍTKA ──────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background var(--ease), color var(--ease), opacity var(--ease);
    white-space: nowrap;
}

.btn-primary {
    background: var(--red);
    color: var(--white);
}
.btn-primary:hover { background: var(--red-d); color: var(--white); text-decoration: none; }

.btn-secondary {
    background: var(--dark);
    color: var(--white);
}
.btn-secondary:hover { opacity: .85; color: var(--white); text-decoration: none; }

.btn-outline {
    background: transparent;
    color: var(--dark);
    border: 1.5px solid var(--mid);
}
.btn-outline:hover { border-color: var(--dark); text-decoration: none; }

.btn-danger {
    background: var(--err);
    color: var(--white);
}
.btn-danger:hover { opacity: .85; color: var(--white); text-decoration: none; }

.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-full { width: 100%; justify-content: center; padding: 12px; font-size: 14px; margin-top: 8px; }

/* ── LAYOUT — APP SHELL ────────────────────────────────────── */

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ───────────────────────────────────────────────── */

.sidebar {
    width: var(--sidebar);
    background: var(--dark);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 50;
    overflow-y: auto;
}

.sidebar__logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar__logo img {
    height: 28px;
}

.sidebar__section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.4);
    padding: 20px 20px 6px;
}

.sidebar__nav {
    flex: 1;
    padding: 8px 0;
}

.sidebar__nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,.75);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--ease), color var(--ease);
    border-left: 3px solid transparent;
}

.sidebar__nav a:hover,
.sidebar__nav a.active {
    background: rgba(255,255,255,.08);
    color: var(--white);
    border-left-color: var(--red);
    text-decoration: none;
}

.sidebar__nav a svg { flex-shrink: 0; }

.sidebar__footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.1);
    font-size: 12px;
    color: rgba(255,255,255,.5);
}

.sidebar__footer a {
    color: rgba(255,255,255,.5);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    transition: color var(--ease);
    text-decoration: none;
}

.sidebar__footer a:hover { color: var(--white); }

/* ── HLAVNÍ OBSAH ──────────────────────────────────────────── */

.main-content {
    margin-left: var(--sidebar);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--mid);
    padding: 0 32px;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar__title {
    font-family: var(--headline);
    font-size: 17px;
    font-weight: 700;
}

.topbar__user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.topbar__user-name { font-weight: 600; }
.topbar__user-role { color: var(--muted); font-size: 11px; }

.page-body {
    padding: 32px;
    flex: 1;
}

/* ── ALERTNÍ ZPRÁVY ────────────────────────────────────────── */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.alert--success { background: var(--green-bg); color: var(--green); border-left: 4px solid var(--green); }
.alert--error   { background: var(--err-bg);   color: var(--err);   border-left: 4px solid var(--err); }
.alert--info    { background: var(--blue-bg);   color: var(--blue);  border-left: 4px solid var(--blue); }
.alert--warning { background: var(--yellow-bg); color: var(--yellow); border-left: 4px solid var(--yellow); }

/* ── KARTY / PANELY ────────────────────────────────────────── */

.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.card__header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--mid);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card__title {
    font-family: var(--headline);
    font-size: 15px;
    font-weight: 700;
}

.card__body { padding: 24px; }

/* ── STATISTICKÉ DLAŽDICE ──────────────────────────────────── */

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

.stat-tile {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
}

.stat-tile__label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
}

.stat-tile__value {
    font-family: var(--headline);
    font-size: 32px;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
}

.stat-tile__value.red { color: var(--red); }

/* ── TABULKY ───────────────────────────────────────────────── */

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 2px solid var(--mid);
    white-space: nowrap;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--light);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: var(--light); }

/* ── ODZNAKY / BADGE ───────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-red    { background: var(--err-bg);    color: var(--err); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue); }
.badge-muted  { background: var(--light);     color: var(--muted); }

/* ── STRÁNKOVÝ NADPIS ──────────────────────────────────────── */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
    flex-wrap: wrap;
}

.page-header h1 {
    font-family: var(--headline);
    font-size: 22px;
    font-weight: 700;
}

/* ── VYHLEDÁVÁNÍ & FILTRY ──────────────────────────────────── */

.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    align-items: center;
}

.filter-bar .form-control {
    width: auto;
    min-width: 180px;
}

/* ── DOKUMENTY — KLIENTSKÝ POHLED ─────────────────────────── */

.doc-list { display: flex; flex-direction: column; gap: 2px; }

.doc-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--white);
    transition: box-shadow var(--ease);
    text-decoration: none;
    color: var(--dark);
}

.doc-item:hover { box-shadow: var(--shadow); text-decoration: none; }

.doc-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--light);
    font-size: 20px;
}

.doc-icon.pdf    { background: #ffebee; }
.doc-icon.html   { background: #e8f5e9; }
.doc-icon.link   { background: var(--blue-bg); }
.doc-icon.img    { background: #fce4ec; }
.doc-icon.office { background: #e8eaf6; }

.doc-info { flex: 1; min-width: 0; }
.doc-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta  { font-size: 12px; color: var(--muted); margin-top: 2px; }

.doc-date { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ── ZPRÁVY ────────────────────────────────────────────────── */

.msg-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--light);
    cursor: pointer;
    transition: background var(--ease);
}

.msg-item:last-child { border-bottom: none; }
.msg-item:hover { background: var(--light); }

.msg-item.unread { border-left: 3px solid var(--red); }
.msg-item.read   { border-left: 3px solid transparent; }

.msg-subject { font-weight: 600; font-size: 14px; }
.msg-item.unread .msg-subject { color: var(--dark); }
.msg-item.read .msg-subject   { color: var(--muted); font-weight: 400; }

.msg-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }

.msg-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--red);
    flex-shrink: 0;
}

.msg-detail { padding: 0; }

.msg-detail__header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--mid);
}

.msg-detail__subject { font-family: var(--headline); font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.msg-detail__meta    { font-size: 13px; color: var(--muted); }

.msg-detail__body {
    padding: 24px;
    font-size: 14.5px;
    line-height: 1.75;
}

.msg-detail__body p { margin-bottom: .8em; }
.msg-detail__body ul,
.msg-detail__body ol { margin: .5em 0 .5em 1.5em; }

/* ── MODAL ─────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(34,31,32,.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--ease);
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    transform: translateY(-20px);
    transition: transform var(--ease);
}

.modal-overlay.open .modal { transform: none; }

.modal__header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--mid);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal__title { font-family: var(--headline); font-size: 17px; font-weight: 700; }

.modal__close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    padding: 4px;
    font-size: 20px;
    line-height: 1;
}

.modal__body { padding: 24px; }

.modal__footer {
    padding: 16px 24px;
    border-top: 1px solid var(--mid);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ── PRÁZDNÝ STAV ──────────────────────────────────────────── */

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

.empty-state svg { margin: 0 auto 16px; opacity: .4; }
.empty-state p { font-size: 14px; }

/* ── UNREAD BADGE v sidebaru ───────────────────────────────── */

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--red);
    color: var(--white);
    font-size: 10px;
    font-weight: 700;
    padding: 0 5px;
    margin-left: auto;
}

/* ── RESPONSIVE ────────────────────────────────────────────── */

@media (max-width: 768px) {
    :root { --sidebar: 0px; }

    .sidebar {
        transform: translateX(-240px);
        width: 240px;
        transition: transform var(--ease);
    }

    .sidebar.open { transform: none; }

    .main-content { margin-left: 0; }

    .topbar { padding: 0 16px; position: sticky; top: 0; z-index: 50; transform: translateZ(0); -webkit-transform: translateZ(0); }
    .page-body { padding: 16px; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .btn-menu {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        cursor: pointer;
        color: var(--dark);
        padding: 14px;
        min-width: 48px;
        min-height: 48px;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
}

@media (min-width: 769px) {
    .btn-menu { display: none; }
}

/* ── UTILITY ───────────────────────────────────────────────── */

.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.ml-auto { margin-left: auto; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.fw-600 { font-weight: 600; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.divider { border: none; border-top: 1px solid var(--mid); margin: 20px 0; }

/* Spinner pro Raynet sync */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── KONTAKTY ──────────────────────────────────────────────── */

.contact-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.contact-row {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px 18px;
    transition: box-shadow var(--ease);
}

.contact-row:hover { box-shadow: var(--shadow); }

.contact-row__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--red);
    color: #fff;
    font-family: var(--headline);
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: .02em;
}

.contact-row__name {
    font-weight: 600;
    font-size: 14px;
    width: 190px;
    flex-shrink: 0;
    color: var(--dark);
    line-height: 1.3;
}

.contact-row__position {
    font-weight: 400;
    font-size: 12px;
    color: var(--muted);
    margin-top: 1px;
}

.contact-row__details {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    flex: 1;
}

.contact-row__item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--ease);
}

.contact-row__item:hover { color: var(--dark); text-decoration: none; }

.contact-row__item svg { flex-shrink: 0; opacity: .6; }

.contact-row__calendly {
    color: var(--red);
    font-weight: 500;
}

.contact-row__calendly svg { opacity: 1; }

.contact-row__calendly:hover { color: var(--red-d); }

@media (max-width: 768px) {
    .contact-list { gap: 10px; }
    .contact-row {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 12px;
        padding: 16px;
    }
    .contact-row__name { width: auto; flex: 1; min-width: 0; }
    .contact-row__details {
        flex-basis: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .contact-row__item { white-space: normal; font-size: 14px; }
}
