/* ==========================================================================
   1. RESET & CSS PROMĚNNÉ
   ========================================================================== */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0284c7;
    --text: #1f2937;
    --text-muted: #6b7280;
    --bg-light: #f9fafb;
    --border-color: #e5e7eb;
    --color-red-dark-accent: #991b1b;
}

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

html, body {
    margin: 0;
    padding: 0;
    font-family: inherit;
    color: var(--text);
    background-color: var(--bg-light);
}

body {
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
}

table {
    border-collapse: separate;
    overflow: hidden;
}

/* ==========================================================================
   2. PŘIHLAŠOVACÍ STRÁNKA (LOGIN)
   ========================================================================== */
body.login-page {
    display: flex;
    height: 100vh;
    justify-content: center;
    align-items: center;
    margin: 0;
}

.login-box {
    padding: 40px;
    width: 100%;
    max-width: 350px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.login-box h2 {
    margin-top: 0;
    margin-bottom: 24px;
    text-align: center;
}

.login-box .error {
    margin-bottom: 15px;
    text-align: center;
    padding: 10px;
    background-color: #fee2e2;
    color: var(--danger);
    border-radius: 4px;
}

.login-box button {
    width: 100%;
    padding: 14px;
    cursor: pointer;
    margin-top: 10px;
}

/* ==========================================================================
   3. SPOLEČNÉ FORMULÁŘOVÉ PRVKY A TLAČÍTKA
   ========================================================================== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    margin-bottom: 15px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
}

input, select, textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #ffffff;
}

textarea {
    min-height: 90px;
}

input[type="checkbox"], input[type="radio"] {
    min-height: auto;
    width: auto;
    padding: 0;
}

button, .btn, .top-nav-btn, .menu-btn, .system-toggle-select {
    min-height: 40px;
    height: 40px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    border-radius: 4px;
    border: 1px solid transparent;
    text-decoration: none;
    font-size: 0.9rem;
}

.btn {
    width: max-content;
    background: var(--primary);
    color: #ffffff;
}

.btn:hover { background: var(--primary-hover); }
.btn.small { min-height: 36px; height: 36px; padding: 0 13px; }
.btn.smallest { min-height: 30px; height: 30px; padding: 0 8px; font-size: 0.8rem; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: transparent; border-color: var(--border-color); color: var(--text); }
.btn-silver { background: #e5e7eb; color: var(--text); }
.btn-gray { background: #4b5563; color: #fff; }

/* ==========================================================================
   4. HLAVIČKA, NAVIGACE A MENU
   ========================================================================== */
header {
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 99;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
}

.header-left-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

header h1 { margin: 0; font-size: 1.25rem; }
.menu-toggle { cursor: pointer; padding: 0 10px; }

.top-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    margin-right: 18px;
}

.main-layout {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 50px);
}

.container {
    width: 100%;
    margin: 0 auto;
    padding: 15px;
}

.menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: #ffffff;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    transform: translateX(-100%);
    transition: transform 0.2s ease-in-out;
}

.menu.open { transform: translateX(0); }
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    display: none;
    background: rgba(0,0,0,0.4);
}
.menu-overlay.open { display: block; }
.menu-close { align-self: flex-end; cursor: pointer; margin-bottom: 20px; }
.menu-btn { width: 100%; justify-content: flex-start; margin-bottom: 6px; background: transparent; }
.menu-btn.active { background: #f3f4f6; font-weight: 600; }
.menu-btn.menu-reserve { margin-top: 12px; }
.menu-btn.menu-management { margin-bottom: 18px; }

/* ==========================================================================
   5. BOXY, SEKCIE A TABULKY
   ========================================================================== */
.view-section { display: none; margin-bottom: 20px; }
.view-section.active { display: block; }

.bo-box {
    padding: 20px;
    margin-bottom: 20px;
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.bo-box > h2, .view-section > h2, .bo-box h3 {
    margin: 0;
    padding: 0 0 14px 0;
}

.table-responsive { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 15px; }
th, td { padding: 12px; text-align: left; }
th { font-weight: 600; }

.status-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    z-index: 10000;
    background: var(--success);
    color: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* ==========================================================================
   6. AKORDEON REZERVACÍ
   ========================================================================== */
.accordion-list { display: flex; flex-direction: column; gap: 10px; }
.res-group-title { margin: 15px 0 8px 2px; font-weight: 600; }
.accordion-item { overflow: hidden; border: 1px solid var(--border-color); border-radius: 4px; }
.accordion-header { padding: 12px 14px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; user-select: none; }
.accordion-header-info { display: flex; flex-direction: column; }
.accordion-content { max-height: 0; overflow: hidden; transition: max-height 0.2s ease-out; }
.accordion-content-inner { padding: 12px 14px; display: flex; flex-direction: column; gap: 0; }
.accordion-content-inner div { margin-bottom: 5px; }

/* ==========================================================================
   7. KALENDÁŘE A SLOTY
   ========================================================================== */
.bo-calendar { padding: 12px; margin-bottom: 20px; }
.bo-calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-weight: 600; }
.bo-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.bo-calendar-day-label { padding: 4px 0; font-weight: 600; }
.bo-calendar-day { padding: 8px 0; cursor: pointer; border-radius: 4px; }
.bo-calendar-day.empty { cursor: default; }
.bo-calendar-day.has-slots { font-weight: bold; background: #e0f2fe; }
.bo-calendar-day.active { background: var(--primary); color: #fff; }

.grid-3 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 20px; }
.slot-badge { padding: 12px 10px; text-align: center; position: relative; border: 1px solid var(--border-color); border-radius: 4px; }
.slot-badge.obsazeno { background: #fee2e2; }
.slot-vazba-varovani { position: absolute; top: -8px; left: -8px; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; z-index: 2; cursor: help; color: var(--danger); }
.slot-del {
	position: absolute;
	top: -8px;
	right: -8px;
    width: 10px;
    height: 10px;
    min-width: 10px;
    min-height: 10px;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 50%;
    font-size: 10px;
    line-height: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* Profesionální kalendář */
.pro-cal-wrapper { padding: 15px; margin-bottom: 25px; border: 1px solid var(--border-color); border-radius: 6px; background: #fff; }
.pro-cal-header-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 15px; padding-bottom: 12px; }
.pro-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.pro-cal-head-cell { text-align: center; padding: 6px 0; font-weight: 600; }
.pro-cal-day-box { min-height: 85px; padding: 6px; cursor: pointer; display: flex; flex-direction: column; border: 1px solid var(--border-color); border-radius: 4px; user-select: none; }
.pro-cal-day-box.empty { cursor: default; background: #f9fafb; border: 1px dashed var(--border-color); }
.pro-cal-day-box.today { border-color: var(--primary); }
.pro-cal-day-box.selected { outline: 2px solid var(--primary); }
.pro-cal-day-num { margin-bottom: 4px; display: flex; justify-content: space-between; align-items: center; }
.pro-cal-chip { padding: 2px 5px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; font-size: 0.75rem; border-radius: 3px; background: #e0f2fe; }
.pro-cal-chip.more-res { text-align: center; color: #fff; }
.pro-cal-mobile-dot { display: none; width: 6px; height: 6px; margin: 3px auto 0 auto; border-radius: 50%; background: var(--primary); }
.pro-cal-detail-card { padding: 15px; background: #fff; border: 1px solid var(--border-color); border-radius: 6px; }
.cal-desktop-view { display: block; }
.cal-mobile-view { display: none; }

/* ==========================================================================
   8. PRŮVODCE VLOŽENÍM REZERVACE (WIZARD)
   ========================================================================== */
.admin-reservation-shell { display: grid; grid-template-columns: 400px 400px; gap: 24px; align-items: start; justify-content: center; }
.admin-reservation-main, .admin-reservation-summary { width: 400px; max-width: 400px; min-width: 400px; }
.admin-reservation-summary { position: sticky; top: 20px; }
.admin-reservation-steps { display: flex; align-items: flex-start; justify-content: center; margin: 18px 0 24px; gap: 18px; padding: 18px 0; }
.admin-reservation-step-item { display: flex; flex-direction: column; align-items: center; min-width: 58px; gap: 5px; font-size: 0.8rem; }
.admin-step-circle { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--border-color); }
.admin-reservation-step-item.active .admin-step-circle { background: var(--primary); color: #fff; border-color: var(--primary); }
.admin-reservation-buttons { display: flex; gap: 8px; padding: 10px 15px; justify-content: center; align-items: center; }
.admin-reservation-buttons-vertical { flex-direction: column; }
.admin-reservation-buttons-inline { flex-direction: row; flex-wrap: wrap; }
.admin-reservation-buttons button { width: 100%; min-height: 38px; height: 38px; padding: 0 12px; }
.admin-reservation-top-services { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; justify-content: center; }
.admin-reservation-top-services button { width: auto; min-height: 34px; height: 34px; padding: 0 10px; }
.admin-reservation-times { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; padding: 0 10px; }
.admin-reservation-time { min-height: 40px; height: 40px; cursor: pointer; border: 1px solid var(--border-color); border-radius: 4px; background: #fff; }
.admin-reservation-time.occupied, .admin-reservation-time.invalid { cursor: not-allowed; opacity: 0.5; }
.admin-reservation-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 15px; padding: 15px 25px; justify-content: center; align-items: center; }
.admin-reservation-link-back { display: inline-flex; align-items: center; min-height: 40px; text-decoration: none; color: var(--text-muted); }
.admin-reservation-client-form { width: 400px; max-width: 100%; padding: 15px 25px; display: flex; flex-direction: column; gap: 10px; }
.admin-reservation-input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.admin-reservation-hidden { display: none !important; }

/* ==========================================================================
   9. SPRÁVA REZERVACÍ (TABULKA, FILTRY, IKONY)
   ========================================================================== */
.reservation-management-filters { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 10px; align-items: end; margin: 18px 0 15px; padding: 15px; background: #fff; border: 1px solid var(--border-color); border-radius: 4px; }
.reservation-management-table th, .reservation-management-table td { padding: 12px 10px; vertical-align: middle; }
.rm-result { font-size: 1.5rem; text-align: center; }
.rm-action-btn { min-height: 34px; height: 34px; width: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 4px; margin-left: 3px; }
.rm-action-btn.rm-delete { color: var(--danger); }
.rm-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.rm-field-wide { grid-column: 1 / -1; }

/* ==========================================================================
   10. MEDIA QUERIES (RESPONZIVITA)
   ========================================================================== */
@media (min-width: 992px) {
    .menu-toggle { display: none; }
    header { padding: 15px 40px; }
    .main-layout { flex-direction: row; }
    .menu { position: static; width: 300px; height: auto; transform: none; box-shadow: none; border-right: 1px solid var(--border-color); }
    .menu-close { display: none; }
    .container { padding: 30px 40px; flex: 1; }
    .view-grid-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; align-items: start; }
    .view-grid-full { grid-column: span 2; }
    .form-row { flex-direction: row; }
    .grid-3 { grid-template-columns: repeat(12, 1fr); }
    .accordion-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; align-items: start; }
    .res-group-title { grid-column: span 4; margin-top: 25px; }
}

@media (max-width: 1050px) {
    .reservation-management-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .reservation-filter-actions { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
    .admin-reservation-shell { grid-template-columns: 100%; justify-content: center; }
    .admin-reservation-main, .admin-reservation-summary { width: 100% !important; max-width: 100% !important; min-width: 0 !important; }
    .admin-reservation-summary { position: static; }
    .top-nav { margin-right: 8px; }
    .top-nav-btn span { display: none; }
}

@media (max-width: 768px) {
    .pro-cal-day-box { min-height: 44px; padding: 4px 2px; align-items: center; justify-content: center; }
    .pro-cal-day-num { margin-bottom: 0; width: 100%; justify-content: center; }
    .pro-cal-chip { display: none !important; }
    .pro-cal-mobile-dot { display: block; }
    .cal-desktop-view { display: none !important; }
    .cal-mobile-view { display: block !important; }
    .mobile-res-card { padding: 12px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--border-color); border-radius: 4px; background: #fff; }
    .mobile-res-card .top-row { display: flex; justify-content: space-between; align-items: center; }
    .infotext-grid { grid-template-columns: 1fr; }
}

@media (max-width: 450px) {
    .admin-reservation-input-row { grid-template-columns: 1fr; }
    .admin-reservation-step-separator { display: none; }
}