/* =========================================================
   RESET & ZÁKLAD
========================================================= */

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

html, body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont,
                 "Segoe UI", Roboto, Arial, sans-serif;
    background: #f5f6f8;
    color: #111827;
}

a {
    color: inherit;
    text-decoration: none;
}

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

/* =========================================================
   LAYOUT
========================================================= */

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px;
}

/* ================= HEADER ================= */

.header {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    background: linear-gradient(180deg, #0f172a, #020617);
    color: #ffffff;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

/* BRAND */
.brand {
    text-decoration: none;
    line-height: 1.1;
}

.brand-main {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .05em;
}

.brand-sub {
    display: block;
    font-size: 11px;
    letter-spacing: .2em;
    opacity: .7;
}

/* USER */
.user-box {
    position: relative;
    display: flex;
    align-items: center;
}

.user-name {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.user-menu {
    position: absolute;
    top: 30px;
    right: 0;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,.15);
    min-width: 160px;
    padding: 6px 0;
    display: none;
    z-index: 2000;
}

.user-menu.open {
    display: block;
}

.user-menu a {
    display: block;
    padding: 8px 14px;
    font-size: 13px;
    color: #111827;
    text-decoration: none;
}

.user-menu a:hover {
    background: #f3f4f6;
}

.logout-link {
    font-size: 12px;
    color: #c7d2fe;
    text-decoration: none;
}

.logout-link:hover {
    text-decoration: underline;
}

/* ================= ACTION BAR ================= */

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.action-left,
.action-right {
    display: flex;
    gap: 10px;
}

/* =========================================================
   BUTTONS
========================================================= */

.action-btn {
    appearance: none;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    background: #ffffff;
    transition: background .15s, border .15s;
}

.action-btn.back {
    border-color: #d1d5db;
    color: #374151;
}

.action-btn.primary {
    background: #2563eb;
    color: #ffffff;
}

.action-btn.secondary {
    background: #e5e7eb;
    color: #374151;
}

.action-btn.danger {
    border-color: #ef4444;
    color: #ef4444;
    background: #ffffff;
}

.action-btn:hover {
    filter: brightness(0.96);
}

/* =========================================================
   FLASH ZPRÁVY
========================================================= */

.flash,
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 13px;
}

.flash.success,
.alert.success {
    background: #ecfdf5;
    color: #065f46;
}

.flash.error,
.alert.error {
    background: #fef2f2;
    color: #991b1b;
}

/* =========================================================
   FORMS – ZÁKLAD (BEZ STYLU KARET)
========================================================= */

.form-view,
.form-edit,
.form-permissions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 32px;
}

.field {
    display: flex;
    flex-direction: column;
}

label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

input,
select {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    font-size: 14px;
    background: #ffffff;
}

input:focus,
select:focus {
    outline: none;
    border-color: #2563eb;
}

/* =========================================================
   HELPERS
========================================================= */

.list-separator {
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        #e5e7eb,
        transparent
    );
    margin: 32px 0 24px;
}
/* =========================================================
   FORM EDIT – READ ONLY STAV
========================================================= */

.form-edit input:disabled,
.form-edit select:disabled,
.form-edit textarea:disabled {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: #374151;
    cursor: default;
}

.form-edit input:disabled::placeholder {
    color: transparent;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 768px) {

    .container {
        padding: 16px;
    }

    .form-view,
    .form-edit,
    .form-permissions {
        grid-template-columns: 1fr;
    }

    .header {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .header-right {
        flex-wrap: nowrap;
    }
}
/* =========================================================
   FORM – PERMISSIONS
========================================================= */

.form-permissions {
    display: grid;
    gap: 24px;
}

.permission-group {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px;
}

.permission-group h3 {
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

.permission-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 13px;
}

.permission-item input {
    margin-top: 3px;
}

.permission-text strong {
    display: block;
    font-weight: 600;
    color: #111827;
}

.permission-text small {
    display: block;
    color: #6b7280;
    font-size: 12px;
}
/* =========================================================
   HEADER – RESPONSIVE FIX
========================================================= */

@media (max-width: 768px) {

    .header {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .header-left {
        flex-shrink: 0;
    }

    .header-right {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-left: auto;
        flex-wrap: nowrap;
    }

    .user-name {
        font-size: 12px;
        white-space: nowrap;
    }

    .logout-link {
        font-size: 12px;
        white-space: nowrap;
    }
}
/* =========================================================
   LOGIN PAGE
========================================================= */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(
        circle at top,
        #1e293b,
        #020617 75%
    );
}

/* wrapper jen kvůli mobilům */
.login-wrapper {
    width: 100%;
    padding: 24px;
}

/* BRAND NAD KARTOU */

.login-brand {
    text-align: center;
    margin-bottom: 20px;
}

.login-brand .brand-big {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: .08em;
    color: #ffffff;
}

.login-brand .brand-small {
    display: block;
    font-size: 12px;
    letter-spacing: .3em;
    color: #cbd5f5;
}

/* KARTA */

.login-card {
    max-width: 420px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 30px 60px rgba(0,0,0,.35);
}

/* NADPIS */

.login-card h2 {
    text-align: center;
    margin-bottom: 24px;
}

/* FORM */

.login-card .form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-card .form-group {
    display: flex;
    flex-direction: column;
}

.login-card label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.login-card input {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #d1d5db;
    font-size: 14px;
}

.login-card input:focus {
    outline: none;
    border-color: #2563eb;
}

/* ERROR */

.login-card .error-box {
    background: #fef2f2;
    color: #991b1b;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* MOBILE */

@media (max-width: 480px) {
    .login-card {
        padding: 24px;
    }

    .login-brand .brand-big {
        font-size: 26px;
    }
}
