/* Shared visual layer for admin pages and forms. Keep module behavior in its own assets. */

:root {
    --admin-radius-control: 12px;
    --admin-radius-panel: 18px;
    --admin-space-page: clamp(18px, 2vw, 28px);
    --admin-space-card: clamp(20px, 2.2vw, 28px);
    --admin-control-line: rgba(102, 128, 125, .28);
    --admin-control-focus: 0 0 0 4px rgba(100, 178, 170, .16);
}

.admin-shell .admin-content {
    padding: clamp(22px, 2.6vw, 38px);
}

.admin-shell .crud-page {
    gap: clamp(18px, 2vw, 26px);
}

.admin-shell .page-heading,
.admin-shell .form-page-head {
    align-items: center;
    gap: 20px;
    margin-bottom: 2px;
}

.admin-shell .page-heading h1,
.admin-shell .form-page-head h1 {
    color: var(--ink);
    font-size: clamp(1.55rem, 2.2vw, 2rem);
    font-weight: 800;
    letter-spacing: -.035em;
    line-height: 1.2;
}

.admin-shell .form-page-head h1 {
    margin-top: 12px;
}

.admin-shell .page-heading p,
.admin-shell .form-page-head p,
.admin-shell .heading-meta {
    color: var(--muted);
    font-size: .88rem;
    line-height: 1.55;
}

.admin-shell .form-page-head p {
    max-width: 68ch;
    margin-top: 9px;
}

.admin-shell .back-link {
    min-height: 40px;
    padding: 9px 13px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .9);
    font-size: .82rem;
}

.admin-shell .back-link:hover {
    transform: translateX(-2px);
}

.admin-shell .crud-panel,
.admin-shell .access-editor,
.admin-shell .panel,
.admin-shell .user-summary-card,
.admin-shell .vehicle-section-card,
.admin-shell .site-content-card,
.admin-shell .brand-detail-image,
.admin-shell .vehicle-detail-image {
    border: 1px solid var(--line);
    border-radius: var(--admin-radius-panel);
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 12px 32px rgba(16, 42, 43, .065);
}

.admin-shell .crud-panel {
    overflow: hidden;
}

.admin-shell .panel-head,
.admin-shell .vehicle-section-heading {
    border-color: var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(247, 251, 250, .9));
}

.admin-shell .panel-head {
    min-height: 64px;
    padding: 18px 22px;
}

.admin-shell .panel-head h2,
.admin-shell .vehicle-section-heading h2 {
    color: var(--ink);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.4;
}

.admin-shell .access-editor,
.admin-shell .vehicle-editor,
.admin-shell .site-content-form {
    min-width: 0;
}

.admin-shell .access-editor {
    overflow: visible;
}

.admin-shell .access-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(18px, 2vw, 26px);
    padding: var(--admin-space-card);
}

.admin-shell .brand-form-grid {
    gap: clamp(18px, 2vw, 26px);
    padding: var(--admin-space-card);
}

.admin-shell .field,
.admin-shell .access-field {
    display: grid;
    align-content: start;
    gap: 8px;
    min-width: 0;
    color: var(--ink);
}

.admin-shell .field > label,
.admin-shell .access-field > label {
    color: var(--ink);
    font-size: .86rem;
    font-weight: 750;
    line-height: 1.45;
}

.admin-shell .form-label {
    display: inline-block;
    margin-bottom: 7px;
    color: var(--ink);
    font-size: .86rem;
    font-weight: 750;
    line-height: 1.45;
}

.admin-shell .crm-form-label,
.admin-shell .modal-content-box form > div > label {
    color: var(--ink);
    font-size: .86rem;
    font-weight: 750;
    line-height: 1.45;
}

.admin-shell .field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="color"]),
.admin-shell .field select:not([multiple]):not(.searchable-select-native),
.admin-shell .field textarea:not(.site-content-source),
.admin-shell .access-field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="color"]),
.admin-shell .access-field select:not([multiple]):not(.searchable-select-native),
.admin-shell form:not(.crud-toolbar) input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]):not([type="range"]):not(.searchable-select-native),
.admin-shell form:not(.crud-toolbar) select:not([multiple]):not(.status-select):not([data-native="true"]):not(.searchable-select-native),
.admin-shell form:not(.crud-toolbar) textarea:not(.site-content-source),
.admin-shell .form-control,
.admin-auth .field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="color"]) {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 11px 14px;
    color: var(--ink);
    border: 1px solid var(--admin-control-line);
    border-radius: var(--admin-radius-control);
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(16, 42, 43, .025);
    font: inherit;
    font-size: .9rem;
    line-height: 1.45;
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.admin-shell .field select:not([multiple]):not(.searchable-select-native),
.admin-shell .access-field select:not([multiple]):not(.searchable-select-native) {
    padding-inline-end: 40px;
}

.admin-shell .field textarea:not(.site-content-source),
.admin-shell .form-control:is(textarea):not(.site-content-source) {
    min-height: 132px;
    resize: vertical;
}

.admin-shell .field :is(input, select, textarea):focus-visible,
.admin-shell .access-field :is(input, select, textarea):focus-visible,
.admin-shell .form-control:focus-visible,
.admin-auth .field input:focus-visible {
    border-color: var(--teal-deep);
    outline: 0;
    box-shadow: var(--admin-control-focus);
}

.admin-shell .field :is(input, select, textarea)[aria-invalid="true"],
.admin-shell .field .is-invalid,
.admin-shell .access-field :is(input, select, textarea)[aria-invalid="true"],
.admin-shell .access-field .is-invalid {
    border-color: var(--danger);
}

.admin-shell .field-help,
.admin-shell .field-hint,
.admin-shell .access-field > small:not(.field-error) {
    color: var(--muted);
    font-size: .78rem;
    line-height: 1.55;
}

.admin-shell .field-error,
.admin-shell .crm-form-group .field-error,
.admin-shell .access-field .field-error {
    color: var(--danger);
    font-size: .78rem;
    line-height: 1.45;
}

.admin-shell .form-section-head {
    gap: 5px;
    padding: 15px 17px;
    border: 1px solid rgba(100, 178, 170, .2);
    border-radius: 13px;
    background: var(--teal-soft);
}

.admin-shell .form-section-head h3 {
    margin: 0;
    color: var(--ink);
    font-size: .94rem;
    font-weight: 800;
}

.admin-shell .form-section-head p {
    margin: 0;
    color: var(--muted);
    font-size: .78rem;
    line-height: 1.5;
}

.admin-shell .access-form-actions,
.admin-shell .form-actions,
.admin-shell .vehicle-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 18px var(--admin-space-card) var(--admin-space-card);
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .96);
}

.admin-shell .crud-page .access-form-actions > a,
.admin-shell .crud-page .access-form-actions > button,
.admin-shell .crud-page .form-actions > a,
.admin-shell .crud-page .form-actions > button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 48px;
    border-radius: 12px;
    font-size: .9rem;
    font-weight: 750;
}

.admin-shell .crud-page .site-content-actions > a,
.admin-shell .crud-page .site-content-actions > button {
    flex: 1 1 0;
    min-width: 0;
}

.admin-shell .crud-page .access-form-actions .secondary,
.admin-shell .crud-page .form-actions .secondary {
    color: var(--ink);
    border-color: var(--line);
    background: #fff;
}

.admin-shell .crud-page .access-form-actions .secondary:hover,
.admin-shell .crud-page .form-actions .secondary:hover {
    color: var(--teal-deep);
    border-color: rgba(62, 143, 136, .45);
    background: var(--teal-soft);
}

.admin-shell .primary,
.admin-shell .secondary,
.admin-shell .crm-btn-primary,
.admin-auth .primary,
.admin-auth .secondary {
    min-height: 46px;
    padding: 11px 18px;
    border-radius: 12px;
    font-size: .88rem;
    font-weight: 750;
    line-height: 1.25;
    transition: color .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.admin-shell .primary:focus-visible,
.admin-shell .secondary:focus-visible,
.admin-shell .crm-btn-primary:focus-visible,
.admin-auth .primary:focus-visible,
.admin-auth .secondary:focus-visible {
    outline: 3px solid rgba(62, 143, 136, .3);
    outline-offset: 3px;
}

.admin-shell .user-summary-grid {
    gap: 16px;
}

.admin-shell .user-summary-card {
    align-content: start;
    min-height: 116px;
    padding: 21px;
    box-shadow: 0 8px 22px rgba(16, 42, 43, .045);
}

.admin-shell .user-summary-card .summary-label {
    color: var(--muted);
    font-size: .74rem;
    letter-spacing: .035em;
}

.admin-shell .user-summary-card strong {
    font-size: .96rem;
    line-height: 1.5;
}

.admin-shell .crud-toolbar {
    gap: 12px;
    padding: 18px 22px;
    border-bottom-color: var(--line);
    background: rgba(255, 255, 255, .72);
}

.admin-shell .crud-toolbar input,
.admin-shell .crud-toolbar select,
.admin-shell .crud-toolbar > .searchable-select .searchable-select-trigger {
    min-height: 44px;
    border-radius: 11px;
}

.admin-shell .crm-form-group {
    display: grid;
    gap: 8px;
}

.admin-shell .crm-btn-primary {
    color: #fff;
    border-color: var(--teal);
    background: linear-gradient(135deg, var(--mint), var(--teal));
    box-shadow: 0 7px 16px rgba(100, 178, 170, .2);
}

.admin-shell .crm-btn-primary:hover {
    color: #fff;
    background: linear-gradient(135deg, #9fc394, #55a79f);
}

.admin-shell .sticky-form-actions {
    position: sticky;
    inset-block-end: 8px;
    z-index: 5;
    margin: 0 12px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(16, 42, 43, .12);
}

.admin-auth .form-card {
    padding: clamp(28px, 4vw, 40px);
    border-radius: 22px;
    box-shadow: 0 22px 58px rgba(16, 42, 43, .1);
}

.admin-auth .form-card h1 {
    margin-bottom: 26px;
    color: var(--ink);
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.25;
}

.admin-auth .form-stack {
    gap: 20px;
}

.admin-auth .field label {
    color: var(--ink);
    font-size: .86rem;
}

.admin-auth .form-stack .primary {
    min-height: 48px;
    margin-top: 4px;
}

html[dir="rtl"] .admin-shell .field select:not([multiple]):not(.searchable-select-native),
html[dir="rtl"] .admin-shell .access-field select:not([multiple]):not(.searchable-select-native) {
    padding-inline: 40px 14px;
    background-position: 14px 50%, 19px 50%;
}

@media (max-width: 768px) {
    .admin-shell .admin-content {
        padding: 22px 16px;
    }

    .admin-shell .crud-page {
        gap: 16px;
    }

    .admin-shell .page-heading,
    .admin-shell .form-page-head {
        gap: 14px;
    }

    .admin-shell .access-form-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
        padding: 20px 18px;
    }

    .admin-shell .access-form-grid .field.full {
        grid-column: 1;
    }

    .admin-shell .brand-form-grid {
        gap: 18px;
        padding: 20px 18px;
    }

    .admin-shell .access-form-actions,
    .admin-shell .form-actions,
    .admin-shell .vehicle-form-actions {
        gap: 10px;
        padding: 16px 18px 20px;
    }

    .admin-shell .crud-page .access-form-actions:not(.site-content-actions) > a,
    .admin-shell .crud-page .access-form-actions:not(.site-content-actions) > button,
    .admin-shell .crud-page .form-actions > a,
    .admin-shell .crud-page .form-actions > button {
        flex-basis: 100%;
        min-height: 48px;
    }

    .admin-shell .crud-page .site-content-actions > a,
    .admin-shell .crud-page .site-content-actions > button {
        flex: 1 1 0;
        width: auto;
        min-height: 48px;
    }

    .admin-auth .auth-page {
        padding: 24px 18px;
    }

    .admin-auth .form-card {
        padding: 28px 22px;
    }

    .admin-auth .auth-logo {
        width: 170px;
        margin-bottom: 26px;
    }

    .admin-auth .auth-locale-switch {
        top: 16px;
        inset-inline-end: 16px;
        inset-inline-start: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .admin-shell .back-link,
    .admin-shell .primary,
    .admin-shell .secondary,
    .admin-auth .primary,
    .admin-auth .secondary,
    .admin-shell .field :is(input, select, textarea),
    .admin-shell .access-field :is(input, select, textarea),
    .admin-shell .form-control,
    .admin-auth .field input {
        transition: none;
    }
}
