:root {
    --primary-color: #000000;
    --secondary-color: #333333;
    --bg-main: #ffffff;
    --bg-card: #ffffff;
    --text-main: #000000;
    --text-muted: #666666;
    --accent: #000000;
    --success: #000000;
    --error: #ff0000;
    --shadow: none;
    --border: 1px solid #eeeeee;
    --border-radius: 0px;
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Auth / Login Screen */
#auth-screen {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #ffffff;
}

.auth-card {
    background: #ffffff;
    padding: 40px;
    width: 100%;
    max-width: 450px;
    border: 2px solid #000;
    text-align: center;
}

.auth-card h1 {
    font-size: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.auth-card p {
    margin-bottom: 30px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Main Layout */
#admin-layout {
    display: none;
    padding-top: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 50px;
    padding-bottom: 15px;
    border-bottom: 2px solid #000;
}

header h1 {
    font-size: 1.2rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.tab-btn {
    margin-right: 10px;
    border-radius: 0 !important;
}

.tab-btn.active {
    border-bottom: 4px solid #000 !important;
    background: #f5f5f5 !important;
}

.tab-btn:hover {
    background: #fafafa;
}

/* Grid System */
.grid-main {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 60px;
    transition: all 0.3s ease;
}

.grid-main.no-sidebar {
    grid-template-columns: 1fr;
    max-width: 900px;
    margin: 0 auto;
}

/* Sidebar & Content Area */
.card-sidebar {
    height: fit-content;
    position: sticky;
    top: 40px;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 25px;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 800;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
textarea {
    width: 100%;
    padding: 12px 0;
    border: none;
    border-bottom: 1px solid #000;
    background: transparent;
    color: #000;
    font-size: 1rem;
    transition: var(--transition);
}

input:focus,
textarea:focus {
    outline: none;
    border-bottom-width: 2px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 30px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid #000;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
    background: transparent;
    color: #000;
}

.btn-primary {
    background-color: #000;
    color: #fff;
    width: 100%;
}

.btn-primary:hover {
    background-color: #333;
}

.btn-outline:hover {
    background: #f5f5f5;
}

.btn-save {
    background-color: #000;
    color: #fff;
    width: 100%;
}

.btn-danger {
    border-color: #ccc;
    color: #999;
}

.btn-danger:hover {
    border-color: #ff0000;
    color: #ff0000;
    background: #fff;
}

/* Dynamic Sections */
.food-section {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.section-title-input {
    font-weight: 900 !important;
    font-size: 1.1rem;
    color: var(--primary-color);
    width: auto;
}

.item-row {
    display: grid;
    grid-template-columns: 1fr 100px 30px 40px;
    gap: 15px;
    margin-bottom: 12px;
    align-items: center;
    background: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.item-row.dragging {
    opacity: 0.5;
    background: #fafafa;
    border: 1px dashed #ccc;
}

.drag-handle {
    cursor: grab;
    color: #ccc;
    font-size: 1.2rem;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drag-handle:hover {
    color: var(--primary-color);
}

/* Calendar Widget */
.calendar-widget {
    user-select: none;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    gap: 5px;
}

.calendar-day-name {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 0.8rem;
    padding-bottom: 10px;
}

.calendar-day {
    padding: 8px 0;
    border-radius: 0px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.calendar-day:hover {
    background: #f0f0f0;
}

.calendar-day.has-menu {
    background: var(--primary-color);
    color: #fff;
    font-weight: bold;
}

/* Selected Day Helper */
.calendar-day.active {
    background: transparent;
    color: #000;
    font-weight: bold;
    border: 2px solid #ff0000;
}

/* Conflict fix if both active and has-menu */
.calendar-day.has-menu.active {
    background: var(--primary-color);
    color: #fff;
    border: 2px solid #ff0000;
    /* Distinct border */
}

.calendar-day.today {
    border: 1px solid var(--primary-color);
}

.calendar-day.empty {
    cursor: default;
    background: transparent !important;
}

/* Toasts / Feedback */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    background: #000000;
    border-left: 4px solid #ffffff;
    color: #ffffff;
    padding: 15px 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-top: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    animation: slideIn 0.3s ease-out;
}

.toast.error {
    border-left-color: #ff0000;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

/* Loading Spinner if needed */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #000;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .grid-main {
        grid-template-columns: 1fr;
    }

    .card-sidebar {
        position: static;
        margin-bottom: 40px;
    }
}

@media (max-width: 600px) {
    .item-row {
        grid-template-columns: 30px 1fr 70px 30px;
        gap: 8px;
    }

    .container {
        padding: 10px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px 15px;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 30px;
    }

    header>div:last-child {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Wrap tabs to multiple lines if needed */
    div[style*="display: flex"] {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex-grow: 1;
        text-align: center;
        margin-bottom: 5px;
    }

    /* Adjust Item Row for mobile */
    .item-row {
        grid-template-columns: 30px 1fr;
        /* Drag + Name */
        grid-template-rows: auto auto;
        gap: 10px;
        padding: 10px;
        border: 1px solid #eee;
        border-radius: 8px;
    }

    /* Name input takes full width on row 1 next to drag handle */
    .item-row input:first-of-type {
        grid-column: 2 / -1;
        width: 100%;
    }

    /* Price input moves to row 2 */
    .item-row input:nth-of-type(2) {
        grid-column: 1 / span 2;
        /* Span full width or shared */
        grid-row: 2;
        width: 100%;
    }

    /* Delete button absolute or moved */
    .item-row .btn-danger {
        grid-column: 2;
        grid-row: 3;
        width: 100%;
        justify-self: end;
    }

    /* Drag handle stays at top left */
    .drag-handle {
        grid-column: 1;
        grid-row: 1;
    }

    /* Better layout for item row on mobile */
    .item-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        padding: 15px;
        gap: 10px;
        border: 1px solid #e0e0e0;
        background: #fafafa;
    }

    .drag-handle {
        width: 30px;
        height: 30px;
        font-size: 1.5rem;
    }

    .item-row input[placeholder="Název pokrmu"] {
        flex: 1 1 100%;
        /* Full width force new line if needed, or share */
        order: 2;
        min-width: 200px;
    }

    .item-row input[placeholder="Cena"] {
        flex: 1 1 100px;
        order: 3;
    }

    .item-row .btn-danger {
        flex: 0 0 auto;
        padding: 8px 12px;
        order: 4;
        margin-left: auto;
    }

    /* Re-order drag handle to be first visual element but maybe not full width */
    .drag-handle {
        order: 1;
    }

    /* Adjust Inputs to prevent zoom */
    input[type="text"],
    input[type="number"],
    textarea {
        font-size: 16px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    /* Title container */
    .section-header>div:first-child {
        width: 100%;
    }

    /* Buttons container */
    .section-header>div:last-child {
        width: 100%;
        justify-content: flex-start;
        /* Keeps buttons together */
        gap: 10px;
        /* Space between buttons */
    }

    /* Settings inputs */
    #closure-dates-wrapper {
        flex-direction: column;
        gap: 15px;
    }

    #closure-dates-wrapper .form-group {
        width: 100%;
        margin-bottom: 0;
    }

    /* Opening Hours Row on Mobile */
    .hours-row {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px !important;
        padding: 15px 0 !important;
    }

    .hours-row>span {
        width: 100% !important;
        border-bottom: 2px solid #000;
        padding-bottom: 5px;
        margin-bottom: 5px;
        font-size: 1.1rem !important;
    }

    .hours-times {
        width: 100%;
        justify-content: space-between;
    }

    .hours-times input[type="time"] {
        flex: 1;
        width: auto !important;
    }
}

@media (max-width: 480px) {
    .calendar-day {
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .calendar-header span {
        font-size: 1.1rem;
    }
}