/*
 * Settings centre — admin panel + customer portal settings pages.
 * Plain CSS on Filament's own colour variables (rgb triplets), so it follows
 * the panel's brand colour and dark mode. Markup:
 * resources/views/filament/settings/*.blade.php, components/settings/*.
 */

:root {
    --st-rail-w: 16.5rem;
    --st-gap: 2rem;
    --st-a: rgb(var(--primary-500));
    --st-b: rgb(var(--primary-600));
    --st-surface: #fff;
    --st-line: rgba(var(--gray-950), 0.07);
    --st-text: rgb(var(--gray-950));
    --st-muted: rgb(var(--gray-500));
}

.dark {
    --st-surface: rgb(var(--gray-900));
    --st-line: rgba(255, 255, 255, 0.09);
    --st-text: #fff;
    --st-muted: rgb(var(--gray-400));
}

/* ---- Layout ------------------------------------------------------------ */

.st-tabs {
    display: block;
}

.st-shell {
    display: grid;
    gap: 1rem;
    align-items: start;
}

@media (min-width: 1024px) {
    .st-shell {
        grid-template-columns: var(--st-rail-w) minmax(0, 1fr);
        gap: var(--st-gap);
    }
}

.st-main {
    position: relative;
    min-width: 0;
}

/* ---- Navigation rail --------------------------------------------------- */

.st-rail {
    min-width: 0;
}

@media (min-width: 1024px) {
    .st-rail {
        position: sticky;
        top: 5.25rem;
        max-height: calc(100vh - 6.5rem);
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 0 0.25rem 1rem 0;
        scrollbar-width: thin;
    }
}

/* Phones / tablets: the full list folds behind one button. */
.st-rail-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.875rem;
    background: var(--st-surface);
    box-shadow: 0 0 0 1px var(--st-line);
    text-align: left;
}

.st-rail-toggle-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.st-rail-toggle-label {
    font-size: 0.75rem;
    color: var(--st-muted);
}

.st-rail-toggle-current {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--st-text);
}

.st-rail-toggle-chev {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    color: var(--st-muted);
    transition: transform 0.2s ease;
}

.st-rotated {
    transform: rotate(180deg);
}

.st-rail-nav {
    display: none;
    margin-top: 0.5rem;
    padding: 0.75rem 0.5rem;
    border-radius: 0.875rem;
    background: var(--st-surface);
    box-shadow: 0 0 0 1px var(--st-line);
}

.st-rail-nav.st-open {
    display: block;
}

@media (min-width: 1024px) {
    .st-rail-toggle {
        display: none;
    }

    .st-rail-nav {
        display: block;
        margin: 0;
        padding: 0;
        background: transparent;
        box-shadow: none;
    }
}

.st-group + .st-group {
    margin-top: 1.25rem;
}

.st-group-label {
    margin-bottom: 0.25rem;
    padding: 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--st-muted);
}

.st-list {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.st-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.625rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    color: rgb(var(--gray-700));
    transition: background-color 0.15s ease, color 0.15s ease;
}

.st-item:hover {
    background: rgba(var(--gray-950), 0.04);
    color: var(--st-text);
}

.st-item:focus-visible,
.st-sub-item:focus-visible,
.st-chip:focus-visible,
.st-rail-toggle:focus-visible {
    outline: 2px solid rgb(var(--primary-500));
    outline-offset: 2px;
}

.dark .st-item {
    color: rgb(var(--gray-300));
}

.dark .st-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.st-item-icon {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
    color: rgb(var(--gray-400));
}

.st-item-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.st-item-active,
.st-item-active:hover {
    background: rgba(var(--primary-500), 0.1);
    color: rgb(var(--primary-700));
}

.st-item-active .st-item-icon {
    color: rgb(var(--primary-600));
}

.dark .st-item-active,
.dark .st-item-active:hover {
    background: rgba(var(--primary-400), 0.12);
    color: rgb(var(--primary-300));
}

.dark .st-item-active .st-item-icon {
    color: rgb(var(--primary-400));
}

/* Sections of the current page, nested under it. */
.st-sub {
    display: none;
}

@media (min-width: 1024px) {
    .st-sub {
        display: flex;
        flex-direction: column;
        gap: 1px;
        margin: 0.25rem 0 0.5rem 1.55rem;
        padding-left: 0.75rem;
        border-left: 1px solid var(--st-line);
    }
}

.st-sub-group {
    padding: 0.75rem 0.5rem 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--st-muted);
}

.st-sub-group:first-child {
    padding-top: 0.25rem;
}

.st-sub-item {
    position: relative;
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    line-height: 1.25rem;
    color: rgb(var(--gray-600));
    text-align: left;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.st-sub-item:hover {
    background: rgba(var(--gray-950), 0.035);
    color: var(--st-text);
}

.dark .st-sub-item {
    color: rgb(var(--gray-400));
}

.dark .st-sub-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.st-sub-label {
    flex: 1;
    min-width: 0;
}

.st-sub-active,
.st-sub-active:hover {
    font-weight: 600;
    color: rgb(var(--primary-700));
}

.dark .st-sub-active,
.dark .st-sub-active:hover {
    color: rgb(var(--primary-300));
}

/* The one accent: a brand-gradient marker on the section being edited. */
.st-sub-active::before {
    content: "";
    position: absolute;
    top: 0.3rem;
    bottom: 0.3rem;
    left: calc(-0.75rem - 1px);
    width: 2px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--st-a), var(--st-b));
}

/* Phones / tablets: this page's sections as a scrollable strip. */
.st-chips {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-bottom: 0.25rem;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
}

.st-chips::-webkit-scrollbar {
    display: none;
}

.st-chip {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    border-radius: 999px;
    background: var(--st-surface);
    box-shadow: 0 0 0 1px var(--st-line);
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgb(var(--gray-700));
    scroll-snap-align: start;
}

.dark .st-chip {
    color: rgb(var(--gray-300));
}

.st-chip-active {
    background: linear-gradient(135deg, var(--st-a), var(--st-b));
    box-shadow: none;
    color: #fff !important;
}

.st-chip-active .st-hint {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

@media (min-width: 1024px) {
    .st-chips {
        display: none;
    }
}

/* ---- Status hints ------------------------------------------------------ */

.st-hint {
    flex-shrink: 0;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.st-hint-gray { background: rgba(var(--gray-500), 0.12); color: rgb(var(--gray-600)); }
.st-hint-primary { background: rgba(var(--primary-500), 0.12); color: rgb(var(--primary-700)); }
.st-hint-info { background: rgba(var(--info-500), 0.12); color: rgb(var(--info-700)); }
.st-hint-success { background: rgba(var(--success-500), 0.14); color: rgb(var(--success-700)); }
.st-hint-warning { background: rgba(var(--warning-500), 0.18); color: rgb(var(--warning-700)); }
.st-hint-danger { background: rgba(var(--danger-500), 0.13); color: rgb(var(--danger-700)); }

.dark .st-hint-gray { color: rgb(var(--gray-300)); }
.dark .st-hint-primary { color: rgb(var(--primary-300)); }
.dark .st-hint-info { color: rgb(var(--info-300)); }
.dark .st-hint-success { color: rgb(var(--success-300)); }
.dark .st-hint-warning { color: rgb(var(--warning-300)); }
.dark .st-hint-danger { color: rgb(var(--danger-300)); }

/* ---- Section header (right column) ------------------------------------- */

.st-panel {
    animation: st-in 0.18s ease-out;
}

@keyframes st-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

.st-head {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    margin-bottom: 1.25rem;
}

.st-head-icon {
    display: grid;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    place-items: center;
    border-radius: 0.75rem;
    background: rgba(var(--primary-500), 0.1);
    color: rgb(var(--primary-600));
}

.dark .st-head-icon {
    background: rgba(var(--primary-400), 0.14);
    color: rgb(var(--primary-300));
}

.st-head-icon-svg {
    width: 1.25rem;
    height: 1.25rem;
}

.st-head-title {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.75rem;
    color: var(--st-text);
}

.st-head-description {
    max-width: 68ch;
    font-size: 0.875rem;
    line-height: 1.5rem;
    color: var(--st-muted);
}

/* Filament sections inside the settings centre: calmer headers. */
.st-main .fi-section {
    border-radius: 0.875rem;
}

.st-main .fi-section-header-heading {
    font-size: 0.9375rem;
}

.st-main .fi-section-header-description {
    max-width: 72ch;
}

/* ---- Save bar ---------------------------------------------------------- */

.st-savebar {
    position: sticky;
    bottom: 1rem;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding: 0.625rem 0.625rem 0.625rem 1rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 0 0 1px var(--st-line), 0 10px 30px -14px rgba(var(--gray-950), 0.35);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.dark .st-savebar {
    background: rgba(var(--gray-900), 0.94);
    box-shadow: 0 0 0 1px var(--st-line), 0 10px 30px -14px rgba(0, 0, 0, 0.7);
}

.st-savebar-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: rgb(var(--gray-600));
}

.dark .st-savebar-status {
    color: rgb(var(--gray-300));
}

.st-savebar-shortcut {
    display: none;
    margin-left: 0.25rem;
    font-size: 0.75rem;
    color: var(--st-muted);
}

@media (min-width: 768px) {
    .st-savebar-shortcut {
        display: inline;
    }
}

.st-dot {
    width: 0.5rem;
    height: 0.5rem;
    flex-shrink: 0;
    border-radius: 999px;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.st-dot-ok {
    background: rgb(var(--success-500));
}

.st-dot-warn {
    background: rgb(var(--warning-500));
    box-shadow: 0 0 0 4px rgba(var(--warning-500), 0.2);
}

.st-savebar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

@media (prefers-reduced-motion: reduce) {
    .st-panel,
    .st-rail-toggle-chev,
    .st-item,
    .st-sub-item,
    .st-dot {
        animation: none !important;
        transition: none !important;
    }
}

/* ---- Payment gateways (status panels) ---------------------------------- */

.pg-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pg-card {
    display: grid;
    gap: 1rem;
    padding: 1.125rem 1.25rem;
    border-radius: 0.875rem;
    background: var(--st-surface);
    box-shadow: 0 0 0 1px var(--st-line);
}

@media (min-width: 768px) {
    .pg-card {
        grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) auto;
        align-items: center;
        gap: 1.5rem;
    }
}

.pg-card-off .pg-identity,
.pg-card-off .pg-status {
    opacity: 0.6;
}

.pg-identity {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-width: 0;
}

.pg-logo {
    display: grid;
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    place-items: center;
    overflow: hidden;
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 0 0 1px var(--st-line);
}

.pg-logo img {
    max-width: 2.25rem;
    max-height: 2.25rem;
    object-fit: contain;
}

.pg-logo-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: rgb(var(--gray-400));
}

.pg-name-block {
    min-width: 0;
}

.pg-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--st-text);
}

.pg-description {
    margin-top: 0.125rem;
    font-size: 0.8125rem;
    line-height: 1.25rem;
    color: var(--st-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pg-status {
    min-width: 0;
}

.pg-state {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.pg-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    background: currentColor;
}

.pg-tone-success { color: rgb(var(--success-600)); }
.pg-tone-warning { color: rgb(var(--warning-600)); }
.pg-tone-danger { color: rgb(var(--danger-600)); }
.pg-tone-gray { color: rgb(var(--gray-500)); }
.dark .pg-tone-success { color: rgb(var(--success-400)); }
.dark .pg-tone-warning { color: rgb(var(--warning-400)); }
.dark .pg-tone-danger { color: rgb(var(--danger-400)); }
.dark .pg-tone-gray { color: rgb(var(--gray-400)); }

.pg-explain {
    margin-top: 0.125rem;
    font-size: 0.8125rem;
    line-height: 1.25rem;
    color: var(--st-muted);
}

.pg-creds {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem 1rem;
    margin-top: 0.5rem;
}

.pg-cred {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--st-muted);
}

.pg-cred-icon {
    width: 0.95rem;
    height: 0.95rem;
    color: rgb(var(--gray-400));
}

.pg-cred-ok .pg-cred-icon {
    color: rgb(var(--success-500));
}

.pg-cred-current {
    font-weight: 600;
    color: rgb(var(--gray-700));
}

.dark .pg-cred-current {
    color: rgb(var(--gray-200));
}

.pg-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--st-line);
}

@media (min-width: 768px) {
    .pg-controls {
        flex-direction: column;
        align-items: flex-end;
        justify-content: center;
        padding-top: 0;
        border-top: 0;
    }
}

.pg-switch-row {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    cursor: pointer;
}

.pg-switch-label {
    min-width: 1.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--st-muted);
    text-align: right;
}

.pg-switch {
    position: relative;
    width: 2.75rem;
    height: 1.5rem;
    flex-shrink: 0;
    border-radius: 999px;
    background: rgb(var(--gray-300));
    transition: background-color 0.18s ease;
}

.dark .pg-switch {
    background: rgb(var(--gray-700));
}

.pg-switch-on,
.dark .pg-switch-on {
    background: linear-gradient(135deg, var(--st-a), var(--st-b));
}

.pg-switch-knob {
    position: absolute;
    top: 0.1875rem;
    left: 0.1875rem;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    transition: transform 0.18s ease;
}

.pg-switch-on .pg-switch-knob {
    transform: translateX(1.25rem);
}

.pg-switch:focus-visible,
.pg-link:focus-visible,
.pg-edit:focus-visible {
    outline: 2px solid rgb(var(--primary-500));
    outline-offset: 2px;
}

.pg-switch[disabled] {
    opacity: 0.6;
}

.pg-link {
    font-size: 0.75rem;
    font-weight: 500;
    color: rgb(var(--primary-600));
}

.pg-link:hover {
    text-decoration: underline;
}

.dark .pg-link {
    color: rgb(var(--primary-400));
}

.pg-actions {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
}

.pg-edit {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgb(var(--primary-600));
}

.pg-edit:hover {
    text-decoration: underline;
}

.dark .pg-edit {
    color: rgb(var(--primary-400));
}

.pg-edit-icon {
    width: 1rem;
    height: 1rem;
}

.pg-empty {
    padding: 2rem;
    border-radius: 0.875rem;
    background: var(--st-surface);
    box-shadow: 0 0 0 1px var(--st-line);
    text-align: center;
}

.pg-empty-title {
    font-weight: 600;
    color: var(--st-text);
}

.pg-empty-text {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--st-muted);
}

@media (prefers-reduced-motion: reduce) {
    .pg-switch,
    .pg-switch-knob {
        transition: none !important;
    }
}
