* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: #222;
}

body.login-page {
    min-height: 100vh;
    background: #c3e3d4 url('../img/bg.jpg') no-repeat center center;
    background-size: cover;
}

body.app-page,
body.has-app {
    min-height: 100vh;
    background: #fff;
}

button,
input,
select {
    font-family: inherit;
}

.login {
    width: 800px;
    max-width: 90%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    box-shadow: 0 0 15px rgba(0, 0, 0, .1);
    border-radius: 10px;
    overflow: hidden;
}

.login-grid {
    display: grid;
    grid-template-columns: 7fr 5fr;
    background: #fff;
}

.login-side {
    background: #ecf0f1;
    padding-top: 50px;
    min-height: 390px;
}

.login-side img {
    max-height: 200px;
    max-width: 90%;
    object-fit: contain;
}

.login-form-card {
    padding: 80px 20px;
    background: #fff;
}

.login-admin {
    width: 420px;
}

.login .logo {
    width: 80px;
    height: auto;
    margin-bottom: 20px;
}

.login .title {
    font-weight: 500;
    margin-bottom: 20px;
    font-size: 22px;
}

.login .title span {
    font-size: 16px;
    color: #666;
}

.formLabel {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
}

.textTitle {
    font-size: 22px;
    font-weight: 500;
    margin: 20px 0;
    padding: 0 20px;
}

.text {
    margin-bottom: 10px;
    font-size: 14px;
    padding: 0 20px;
    color: #575757;
}

.switcher {
    height: 8px;
    width: 8px;
    background: #ccd9c7;
    border-radius: 100px;
    display: inline-block;
    transition: width .5s ease;
    margin-right: 5px;
    border: 0;
    padding: 0;
}

.switcher:hover {
    cursor: pointer;
    background: #5c70b3;
}

.switcher.active {
    width: 16px;
    background: #5c70b3;
}

.app-shell {
    min-height: 100vh;
    background: #fff;
}

.topbar {
    background: #1976d2;
    color: #fff;
    margin-bottom: 20px;
}

.container {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 16px;
}

.toolbar {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.toolbar-title {
    font-size: 20px;
    font-weight: 500;
    line-height: 1.25;
}

.user-menu {
    position: relative;
}

.user-button {
    border: 0;
    background: transparent;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px;
    font-weight: 600;
}

.avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #42a5f5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    text-transform: uppercase;
    flex: 0 0 auto;
}

.dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    color: #222;
    min-width: 170px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .32);
    z-index: 50;
}

.dropdown.open {
    display: block;
}

.dropdown a,
.dropdown button {
    color: #222;
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border: 0;
    background: #fff;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}

.tabs-grid,
.filters-grid,
.cart-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.filters-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cart-summary-grid {
    grid-template-columns: 1fr 1fr;
    align-items: center;
    margin-bottom: 0;
}

.btn {
    border-radius: 4px;
    min-height: 37px;
    padding: 8px 14px;
    border: 1px solid #1976d2;
    background: #fff;
    color: #1976d2;
    cursor: pointer;
    font-weight: 500;
    line-height: 1.2;
}

.btn:hover {
    filter: brightness(.98);
}

.btn-contained,
.btn.active {
    background: #1976d2;
    color: #fff;
}

.btn-success {
    border-color: #2e7d32;
    background: #2e7d32;
    color: #fff;
}

.btn-danger {
    border-color: #d32f2f;
    background: #d32f2f;
    color: #fff;
}

.full-width {
    width: 100%;
}

.text-input,
.select-input {
    width: 100%;
    min-height: 40px;
    border: 1px solid #c4c4c4;
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 14px;
    background: #fff;
}

.search-wrap,
.adorned-wrap {
    position: relative;
}

.search-wrap input,
.adorned-wrap input {
    padding-right: 74px;
}

.search-wrap:after {
    content: "Keresés";
    color: #666;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
}

.adorned-prefix,
.adorned-suffix {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 13px;
    pointer-events: none;
}

.adorned-prefix {
    left: 10px;
}

.adorned-suffix {
    right: 10px;
}

.adorned-wrap.has-prefix input {
    padding-left: 78px;
}

.content-card {
    margin-bottom: 24px;
}

.table-wrap {
    width: 100%;
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 650px;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid #e0e0e0;
    text-align: left;
    vertical-align: middle;
    font-size: 14px;
}

th {
    font-weight: 700;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 1;
}

.amount-input {
    width: 110px;
    text-align: right;
}

.product-table th:nth-child(4),
.product-table td:nth-child(4),
.product-table th:nth-child(5),
.product-table td:nth-child(5) {
    text-align: right;
}

.product-table th:nth-child(4),
.product-table td:nth-child(4) {
    white-space: nowrap;
}

.product-table th:nth-child(5),
.product-table td:nth-child(5) {
    white-space: nowrap;
}

.product-table .amount-input {
    width: 76px;
}

.cart {
    position: fixed;
    left: 80px;
    bottom: 20px;
    width: 440px;
    max-width: calc(100vw - 120px);
    z-index: 30;
}

.cart-box {
    background: #fff;
    box-shadow: 0 0 15px rgba(0, 0, 0, .1);
    border-radius: 4px;
    overflow: hidden;
}

.cart-box.money-cart {
    background: #f0f0f0;
}

.cart-title {
    text-align: center;
    width: 100%;
    font-size: 20px;
    padding: 14px;
}

.cart-inner {
    padding: 12px;
}

.cart-table-wrap {
    max-height: 440px;
    overflow-x: hidden;
    overflow-y: auto;
}

.cart-table {
    min-width: 0;
    table-layout: fixed;
}

.cart-table th,
.cart-table td {
    padding: 12px 10px;
}

.cart-table th:nth-child(1),
.cart-table td:nth-child(1) {
    width: auto;
    overflow-wrap: anywhere;
}

.cart-table th:nth-child(2),
.cart-table td:nth-child(2) {
    width: 62px;
    text-align: right;
    white-space: nowrap;
}

.cart-table th:nth-child(3),
.cart-table td:nth-child(3) {
    width: 116px;
    text-align: right;
    white-space: nowrap;
}

.cart-table th:nth-child(4),
.cart-table td:nth-child(4) {
    width: 30px;
    padding-left: 2px;
    padding-right: 2px;
    text-align: center;
}

.cart-toggle {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 31;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    border: 0;
    color: #1976d2;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
    cursor: pointer;
    font-size: 20px;
}

.icon-button {
    border: 0;
    background: transparent;
    color: #ef8f00;
    cursor: pointer;
    font-size: 18px;
}

.overlay {
    display: none;
    height: 100vh;
    width: 100%;
    position: fixed;
    background: #fff;
    z-index: 9999999;
    top: 0;
    left: 0;
}

.overlay.open {
    display: block;
}

.overlay-inner {
    top: 50%;
    left: 50%;
    position: absolute;
    transform: translate(-50%, -50%);
    width: min(720px, 90%);
    text-align: center;
}

.overlay-title {
    font-size: 32px;
    font-weight: 700;
}

.overlay-title.success,
.overlay-text.success {
    color: #53a653;
}

.overlay-title.error,
.overlay-text.error {
    color: red;
}

.overlay-text {
    font-size: 24px;
    margin-top: 6px;
}

.alert {
    padding: 12px;
    border-radius: 4px;
    margin: 12px 0;
    font-size: 14px;
}

.alert-error {
    color: #b71c1c;
    background: #ffebee;
    border: 1px solid #ffcdd2;
}

.loader {
    height: 4px;
    width: 100%;
    overflow: hidden;
    background: #bbdefb;
    border-radius: 2px;
}

.loader:before {
    content: "";
    display: block;
    width: 35%;
    height: 100%;
    background: #1976d2;
    animation: loading 1s infinite ease-in-out;
}

@keyframes loading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(310%); }
}

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 100;
    padding: 24px;
}

.modal-backdrop.open {
    display: block;
}

.modal-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    max-width: calc(100vw - 48px);
    max-height: 90vh;
    overflow: auto;
    background: #fff;
    border: 2px solid #000;
    box-shadow: 0 12px 32px rgba(0,0,0,.28);
    padding: 32px;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
}

.modal-total {
    text-align: center;
    margin: 16px 0;
}

.modal-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.modal-actions.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.small-muted {
    color: #666;
    font-size: 13px;
}

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

    .login-side {
        display: none;
    }

    .toolbar-title {
        font-size: 16px;
    }

    .user-name {
        display: none;
    }

    .tabs-grid,
    .filters-grid,
    .cart-summary-grid,
    .modal-actions,
    .modal-actions.three {
        grid-template-columns: 1fr;
    }

    .cart {
        position: relative;
        left: 0;
        bottom: auto;
        width: 100%;
        max-width: 100%;
        padding-top: 20px;
        margin-top: 20px;
    }
}

@media (max-width: 992px) {
    .desktop-title {
        display: none;
    }
    .mobile-title {
        display: inline !important;
    }
}
