/* Кабінет покупця і сторінки авторизації (login/register/forgot/reset + /cabinet) */

/* ---------- Форми авторизації ---------- */

.auth-container {
    max-width: 460px;
    margin: 40px auto 60px;
    padding: 0 16px;
}

.auth-card {
    background: #fff;
    border-radius: 12px;
    padding: 32px 28px;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.08);
}

.auth-card h1 {
    font-size: 24px;
    color: #222;
    margin-bottom: 6px;
}

.auth-sub {
    color: #777;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.auth-field {
    margin-bottom: 14px;
}

.auth-field label {
    display: block;
    font-size: 13px;
    color: #555;
    margin-bottom: 5px;
}

.auth-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
}

.auth-field input[readonly] {
    background: #fafafa;
    color: #777;
}

.auth-field input:focus {
    outline: none;
    border-color: var(--g-brand-500, #2c7a5b);
}

.auth-agree {
    margin: 4px 0 14px;
    font-size: 13px;
    color: #555;
    line-height: 1.5;
}

.auth-agree label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}

.auth-agree input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--g-brand-500, #2c7a5b);
}

.auth-agree a {
    color: var(--g-brand-500, #2c7a5b);
}

.auth-error {
    background: #fdecea;
    color: #b3261e;
    border: 1px solid #f5c6cb;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 14px;
    line-height: 1.5;
}

.auth-ok {
    background: #e8f5ee;
    color: #1e6b45;
    border: 1px solid #bfe3d0;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 14px;
    line-height: 1.5;
}

.btn-customer {
    display: inline-block;
    width: 100%;
    background: var(--g-brand-500, #2c7a5b);
    color: #fff;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
}

.btn-customer:hover {
    background: #236a4d;
}

.btn-customer[disabled] {
    opacity: 0.6;
    cursor: default;
}

.btn-secondary {
    display: inline-block;
    background: #fff;
    color: var(--g-brand-500, #2c7a5b);
    border: 1px solid var(--g-brand-500, #2c7a5b);
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
}

.btn-secondary:hover {
    background: #f2f8f5;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    padding: 11px 16px;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.btn-google:hover {
    background: #fafafa;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #999;
    font-size: 13px;
    margin: 18px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}

.auth-links {
    margin-top: 18px;
    font-size: 14px;
    color: #777;
    text-align: center;
    line-height: 1.8;
}

.auth-links a {
    color: var(--g-brand-500, #2c7a5b);
}

/* ---------- Кабінет (мінімалізм: тонкі лінії замість карток і тіней;
   спільна розмітка — includes/cabinet_ui.php) ---------- */

.cab {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 72px;
    max-width: 1040px;
    margin: 0 auto;
    color: var(--g-ink, #222);
    font-size: 15px;
    line-height: 1.5;
}

.cab h1 {
    font-family: var(--g-font-headings, inherit);
    font-size: 30px;
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: 28px;
}

.cab h2 {
    font-family: var(--g-font-headings, inherit);
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 18px;
}

.cab a {
    color: inherit;
}

.cab :focus-visible {
    outline: 2px solid var(--g-brand-500, #2c7a5b);
    outline-offset: 2px;
}

.cab-hint {
    font-size: 13px;
    color: var(--g-ink-3, #666);
}

/* Бічна навігація */
.cab-side {
    align-self: start;
    position: sticky;
    top: 24px;
}

.cab-who {
    margin-bottom: 24px;
    overflow-wrap: anywhere;
}

.cab-who-name {
    font-weight: 500;
}

.cab-who-mail {
    font-size: 13px;
    color: var(--g-ink-3, #666);
}

.cab-nav {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.cab-nav a,
.cab-logout {
    display: block;
    padding: 9px 0;
    background: none;
    border: 0;
    font: inherit;
    color: var(--g-ink-3, #666);
    text-decoration: none;
    cursor: pointer;
    transition: color .15s;
}

.cab-nav a:hover,
.cab-logout:hover,
.cab-nav a.active {
    color: var(--g-ink, #222);
}

.cab-nav a.active {
    font-weight: 500;
    box-shadow: inset 0 -1px 0 currentColor;
}

/* Секції */
.cab-block {
    padding: 32px 0;
    border-top: 1px solid var(--g-border, #e5e5e5);
}

.cab-block h2 + .cab-hint {
    margin: -10px 0 18px;
}

.cab-note {
    padding: 12px 0 12px 16px;
    margin-bottom: 24px;
    border-left: 2px solid var(--g-brand-500, #2c7a5b);
}

.cab-note-err {
    border-color: var(--g-red-500, #c0202c);
    color: var(--g-red-800, #8a1020);
}

/* Форми */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 20px;
}

.form-grid .full {
    grid-column: 1 / -1;
}

.form-grid .auth-field {
    margin-bottom: 0;
}

.cab .auth-field label {
    color: var(--g-ink-3, #666);
}

.cab .auth-field input,
.cab .auth-field select {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--g-border, #ddd);
    border-radius: var(--g-radius-sm, 8px);
    background-color: var(--g-surface, #fff);
    color: inherit;
    font: inherit;
    font-size: 16px; /* менше 16px — iOS масштабує сторінку при фокусі */
    transition: border-color .15s;
}

.cab .auth-field select {
    appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='gray' stroke-width='1.5'%3E%3Cpath d='m1 1 5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.cab .auth-field input:hover,
.cab .auth-field select:hover {
    border-color: var(--g-border-strong, #777);
}

.cab .auth-field input:focus,
.cab .auth-field select:focus {
    outline: none;
    border-color: var(--g-brand-500, #2c7a5b);
    box-shadow: 0 0 0 1px var(--g-brand-500, #2c7a5b);
}

.cab .auth-field input[aria-invalid] {
    border-color: var(--g-red-500, #c0202c);
}

.cab-field-err {
    margin-top: 6px;
    font-size: 13px;
    color: var(--g-red-500, #c0202c);
}

.cab-actions {
    margin-top: 24px;
}

.cab .cab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 28px;
    border: 1px solid var(--g-action, #078345);
    border-radius: var(--g-radius-sm, 8px);
    background: var(--g-action, #078345);
    color: var(--g-on-color, #fff);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}

.cab .cab-btn:hover {
    background: var(--g-action-hover, #066f3b);
}

.cab .cab-btn-line,
.cab .cab-btn-line:hover {
    background: transparent;
    border-color: var(--g-border, #ddd);
    color: inherit;
}

.cab .cab-btn-line:hover {
    border-color: var(--g-ink, #222);
}

.cab-note[hidden] {
    display: none;
}

.cab-note-warn {
    border-left-color: var(--g-amber-900, #c77700);
}

.cab-save {
    padding-top: 24px;
    border-top: 1px solid var(--g-border, #e5e5e5);
}

.cab-dialog {
    width: min(440px, calc(100vw - 32px));
    margin: auto;
    padding: 28px;
    border: 1px solid var(--g-border, #e5e5e5);
    border-radius: 8px;
    background: var(--g-surface, #fff);
    color: var(--g-ink, #222);
}

.cab-dialog::backdrop {
    background: rgb(0 0 0 / 40%);
}

.cab-dialog h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.cab-dialog-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.cab .cab-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
    cursor: pointer;
}

.cab .cab-check input {
    flex: none;
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    accent-color: var(--g-action, #078345);
}

.cab-login-mail {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    margin-bottom: 12px;
    overflow-wrap: anywhere;
}

.cab-more summary {
    display: inline-block;
    padding: 8px 0;
    cursor: pointer;
    list-style: none;
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: var(--g-grey-400, #999);
}

.cab-more summary::-webkit-details-marker {
    display: none;
}

.cab-more summary:hover {
    text-decoration-color: currentColor;
}

.cab-more[open] summary {
    margin-bottom: 8px;
}

.cab-more > .cab-hint {
    margin-bottom: 16px;
}

/* Список замовлень */
.cab-orders,
.cab-items,
.cab-steps {
    list-style: none;
}

.cab-orders li {
    border-top: 1px solid var(--g-border, #e5e5e5);
}

.cab-orders li:last-child {
    border-bottom: 1px solid var(--g-border, #e5e5e5);
}

.cab-order {
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 20px 0;
    text-decoration: none;
}

.cab-order:hover .cab-order-name {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cab-thumb {
    flex: 0 0 72px;
    height: 72px;
    border-radius: var(--g-radius-sm, 8px);
    background: var(--g-grey-100, #f5f5f5);
    overflow: hidden;
}

.cab-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Кілька товарів у замовленні: колаж фото + перелік назв */
.cab-thumb-multi {
    display: grid;
    grid-template: 1fr 1fr / 1fr 1fr;
    gap: 2px;
    background: none;
}

.cab-thumb-two > :last-child {
    grid-area: 2 / 2;
}

.cab-thumb-multi > span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    background: var(--g-grey-100, #f5f5f5);
    overflow: hidden;
    font-size: 13px;
    font-weight: 500;
    color: var(--g-ink-2, #444);
}

.cab-order-count {
    margin: 2px 0;
    font-weight: 500;
}

.cab .cab-order-line {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.cab-order-line .cab-order-name {
    min-width: 0;
}

.cab-order-line + .cab-order-line {
    margin-top: 2px;
}

.cab-order-qty {
    flex: none;
    font-weight: 500;
}

.cab-order-body,
.cab-item-body {
    flex: 1;
    min-width: 0;
}

.cab-order-body > span {
    display: block;
}

.cab-order-meta {
    font-size: 13px;
    color: var(--g-ink-3, #666);
}

.cab .cab-order-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.cab-order-side {
    flex: 0 0 auto;
    max-width: 200px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    text-align: right;
}

.cab-order-sum {
    font-weight: 500;
    white-space: nowrap;
}

.cab-status {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    font-size: 13px;
    color: var(--g-ink-2, #444);
}

.cab-status i {
    flex: 0 0 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--g-grey-400, #999);
    transform: translateY(-1px);
}

.cab-empty {
    padding: 64px 0;
    border-top: 1px solid var(--g-border, #e5e5e5);
    text-align: center;
    color: var(--g-ink-3, #666);
}

.cab-empty p {
    margin-bottom: 20px;
}

.cab-pager {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin-top: 28px;
}

.cab-pager a,
.cab-pager span {
    min-width: 40px;
    line-height: 40px;
    text-align: center;
    text-decoration: none;
    color: var(--g-ink-3, #666);
}

.cab-pager a:hover,
.cab-pager .current {
    color: var(--g-ink, #222);
    box-shadow: inset 0 -1px 0 currentColor;
}

.cab-review-text {
    display: block;
    overflow-wrap: anywhere;
}

/* Сторінка замовлення */
.cab-back {
    display: inline-block;
    margin-bottom: 16px;
    font-size: 13px;
    text-decoration: none;
}

.cab-back:hover {
    text-decoration: underline;
}

.cab-order-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px 24px;
    margin-bottom: 28px;
}

.cab-order-head h1 {
    margin-bottom: 4px;
}

.cab-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 32px;
}

.cab-steps li {
    padding-top: 10px;
    border-top: 2px solid var(--g-border, #e5e5e5);
    font-size: 13px;
    color: var(--g-ink-3, #666);
}

.cab-steps .done {
    border-color: var(--g-brand-500, #2c7a5b);
    color: var(--g-ink, #222);
}

.cab-steps [aria-current] {
    font-weight: 500;
}

.cab-track {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px 0;
    border-top: 1px solid var(--g-border, #e5e5e5);
}

.cab-track-num {
    font-size: 18px;
    letter-spacing: .02em;
    font-variant-numeric: tabular-nums;
}

.cab-items li {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.cab-item-sum {
    text-align: right;
    white-space: nowrap;
}

.cab-item-sum strong {
    font-weight: 500;
}

.cab-total {
    margin: 28px 0 0 auto;
    max-width: 380px;
}

.cab-total div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 4px 0;
}

.cab-total dt {
    color: var(--g-ink-3, #666);
}

.cab-total dd {
    text-align: right;
}

.cab-total .cab-total-sum {
    margin-top: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--g-border, #e5e5e5);
    font-size: 17px;
    font-weight: 500;
}

.cab-total-sum dt {
    color: inherit;
}

.cab-facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px 32px;
}

.cab-facts dt {
    font-size: 13px;
    color: var(--g-ink-3, #666);
}

.cab-mod-chips {
    margin-top: 4px;
    font-size: 13px;
    color: var(--g-ink-2, #444);
}

.cab-mod-chip {
    display: block;
}

.cab-mod-text {
    overflow-wrap: anywhere;
}

@media (max-width: 800px) {
    .cab {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
    }

    .cab-side {
        position: static;
    }

    .cab-who {
        margin-bottom: 12px;
    }

    .cab-nav {
        flex-direction: row;
        gap: 24px;
        border-bottom: 1px solid var(--g-border, #e5e5e5);
    }

    .cab-nav a,
    .cab-logout {
        padding: 12px 0;
    }

    .cab-nav form {
        margin-left: auto;
    }

    .cab h1 {
        font-size: 26px;
    }
}

@media (max-width: 560px) {
    .cab-nav {
        gap: 14px;
        overflow-x: auto;
        font-size: 14px;
        white-space: nowrap;
    }

    .form-grid,
    .cab-facts {
        grid-template-columns: 1fr;
    }

    .cab-order,
    .cab-items li {
        flex-wrap: wrap;
        gap: 10px 16px;
        align-items: flex-start;
    }

    .cab-thumb {
        flex-basis: 60px;
        height: 60px;
    }

    .cab-order-side,
    .cab-item-sum {
        flex: 1 0 100%;
        max-width: none;
        padding-left: 76px;
        text-align: left;
    }

    .cab-order-side {
        flex-direction: row;
        justify-content: space-between;
        align-items: baseline;
        gap: 12px;
    }

    .cab-total {
        max-width: none;
    }

    .cab-actions .cab-btn,
    .cab-track .cab-btn {
        width: 100%;
    }
}

/* Автокомпліти доставки (місто/відділення/вулиця) — як у кошику */
.autocomplete-box {
    position: relative;
}

.pac-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--g-surface, #fff);
    border: 1px solid var(--g-border, #ddd);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 260px;
    overflow-y: auto;
    z-index: 30;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.1);
}

.pac-list .pac-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid var(--g-border, #f0f0f0);
    line-height: 1.4;
}

.pac-list .pac-item:hover,
.pac-list .pac-item.active {
    background: var(--g-grey-100, #f2f8f5);
}

.pac-empty {
    padding: 10px 12px;
    color: var(--g-ink-3, #666);
    font-size: 13px;
}
