/* ============================================================
   Systém evidencie pacientov - hlavný štýl
   Autor: Vladyslav Frolov | Téma č. 25
   ============================================================ */

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

:root {
    --accent:    #F0A500;
    --accent-dk: #c98c00;
    --dark:      #1a1a1a;
    --gray-900:  #222;
    --gray-700:  #444;
    --gray-500:  #777;
    --gray-300:  #ccc;
    --gray-100:  #f4f4f4;
    --white:     #fff;
    --danger:    #c0392b;
    --success:   #27ae60;
    --radius:    6px;
    --shadow:    0 2px 8px rgba(0,0,0,.10);
    --navbar-h:  60px;
}

html {
    font-size: 15px;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    background: var(--gray-100);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

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

/* ── Navbar ── */
.navbar {
    background: var(--dark);
    height: var(--navbar-h);
    display: flex;
    align-items: center;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
    width: 100%;
    box-sizing: border-box;
}

.navbar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    min-width: 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    text-decoration: none;
}

.navbar-brand img.logo-fei {
    height: 30px;
}

.navbar-brand img.logo-kps {
    height: 30px;
}

.navbar-sep {
    width: 1px;
    height: 20px;
    background: #444;
    flex-shrink: 0;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.navbar-nav a {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    color: #aaa;
    font-size: .82rem;
    border-radius: var(--radius);
    transition: all .15s;
    white-space: nowrap;
    text-decoration: none;
}

.navbar-nav a:hover { color: var(--accent); background: rgba(240,165,0,.1); }
.navbar-nav a.active { color: var(--accent); background: rgba(240,165,0,.08); }

.navbar-nav a svg { width: 13px; height: 13px; flex-shrink: 0; }

.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
    flex-shrink: 0;
}

.navbar-user {
    font-size: .78rem;
    color: #777;
}

.navbar-user span { color: #bbb; }

.navbar-user a {
    color: var(--danger);
    font-size: .78rem;
    margin-left: 10px;
}

/* ── Content ── */
.content {
    display: block;
    width: 100%;
    padding: 0;
    box-sizing: border-box;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 28px 24px;
    box-sizing: border-box;
}

/* ── Cards ── */
.card {
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

/* Карточки с формами — ограниченная ширина, по центру */
.card-form {
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
}

.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header h2 {
    font-size: .92rem;
    font-weight: 600;
    color: var(--gray-700);
}

.card-body { padding: 20px; }

/* ── Stat tiles ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
    width: 100%;
}

.stat-tile {
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 18px 20px 18px 22px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--accent);
    transition: transform .18s, box-shadow .18s;
}

.stat-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,.12);
}

.stat-tile .num {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

.stat-tile .label {
    font-size: .72rem;
    color: var(--gray-500);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ── Tables ── */
.tbl-wrap { overflow-x: auto; }

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

table thead th {
    background: var(--gray-100);
    color: var(--gray-700);
    padding: 9px 14px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--gray-300);
    white-space: nowrap;
}

table thead th a {
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}

table thead th a:hover { color: var(--accent); }

table tbody tr { border-bottom: 1px solid var(--gray-100); transition: background .12s; }
table tbody tr:hover { background: rgba(240,165,0,.04); }
table tbody td { padding: 9px 14px; color: var(--gray-700); }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
}

.badge-admin  { background: #fdf3dc; color: #8a5d00; }
.badge-doctor { background: #e8f4fd; color: #1a6fa8; }
.badge-nurse  { background: #eafaf1; color: #1a7a40; }
.badge-M      { background: #e8f4fd; color: #1a5fa0; }
.badge-F      { background: #fdeef3; color: #a01a50; }

/* ── Forms ── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }

label {
    font-size: .75rem;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: .04em;
}

input[type="text"],
input[type="email"],
input[type="date"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: .87rem;
    color: var(--dark);
    background: var(--white);
    transition: border-color .15s;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(240,165,0,.15);
}

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

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: var(--radius);
    font-size: .83rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .15s;
    text-decoration: none;
    line-height: 1.4;
}

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

.btn-outline { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-sm { padding: 5px 10px; font-size: .76rem; }

/* ── Search bar ── */
.search-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }

/* ── Alerts ── */
.alert {
    padding: 11px 16px;
    border-radius: var(--radius);
    font-size: .86rem;
    margin-bottom: 16px;
    border-left: 4px solid;
}

.alert-success { background: #eafaf1; border-color: var(--success); color: #1a6a3a; }
.alert-error   { background: #fdeaea; border-color: var(--danger);  color: #8a1a1a; }
.alert-info    { background: #fdf3dc; border-color: var(--accent);  color: #7a4a00; }

/* ── Pagination ── */
.pagination {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 16px;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: .82rem;
    color: var(--gray-700);
    transition: all .15s;
    text-decoration: none;
}

.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { background: var(--accent); border-color: var(--accent); color: var(--white); font-weight: 700; }

/* ── Login page ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-900);
    padding: 20px;
}

.login-box {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,.3);
    width: 100%;
    max-width: 380px;
    overflow: hidden;
}

.login-header {
    background: var(--dark);
    padding: 24px 28px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.login-header .logos {
    display: flex;
    align-items: center;
    gap: 14px;
}

.login-header img.logo-fei {
    height: 30px;
}

.login-header img.logo-kps {
    height: 28px;
}

.login-header .sep {
    width: 1px;
    height: 24px;
    background: #444;
}

.login-header h2 {
    font-size: .74rem;
    color: #888;
    text-align: center;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.login-body { padding: 24px 28px; }
.login-body .form-group { margin-bottom: 14px; }
.login-body .btn { width: 100%; justify-content: center; margin-top: 8px; padding: 10px; }

.login-footer {
    text-align: center;
    font-size: .8rem;
    color: var(--gray-500);
    padding: 0 28px 22px;
}

/* ── Bar chart ── */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 110px;
    margin-top: 10px;
}

.bar-wrap { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; min-width: 0; }
.bar { width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 4px; opacity: .85; transition: opacity .15s; }
.bar:hover { opacity: 1; }
.bar-label { font-size: .62rem; color: var(--gray-500); text-align: center; }
.bar-val   { font-size: .7rem; color: var(--gray-700); font-weight: 600; }

/* ── Animations ── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .3s ease both; }

/* ── Mobile hamburger ── */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
}
.hamburger span { display: block; width: 20px; height: 2px; background: #aaa; border-radius: 2px; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .navbar-nav {
        display: none;
        position: fixed;
        top: var(--navbar-h);
        left: 0;
        right: 0;
        background: var(--dark);
        flex-direction: column;
        align-items: flex-start;
        padding: 8px 16px 16px;
        border-top: 1px solid #333;
        box-shadow: 0 4px 12px rgba(0,0,0,.3);
        gap: 2px;
        z-index: 99;
        width: 100%;
        box-sizing: border-box;
    }
    .navbar-nav.open { display: flex; }
    .navbar-nav a { width: 100%; box-sizing: border-box; }
    .hamburger { display: flex; }
    .content { padding: 0; }
    .container { padding: 16px; }
}

@media (max-width: 600px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid  { grid-template-columns: 1fr; }
    .navbar-user span { display: none; }
    .tbl-wrap { font-size: .78rem; }
}

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