/* Infernus Design System — shared component tokens & refinements.
 * Loaded after page-level styles so it can act as a consistency layer on
 * top of existing markup/classes without requiring a full template rewrite.
 * Fase 4: extend here (not with a parallel stylesheet) when unifying the
 * look of cards, buttons, inputs, badges, tables, alerts, modals, and
 * loading states across admin + storefront pages. */
:root {
    --ui-surface: rgba(8, 8, 8, 0.92);
    --ui-surface-strong: rgba(12, 12, 12, 0.98);
    --ui-line: rgba(255, 255, 255, 0.09);
    --ui-line-accent: rgba(var(--primary-rgb), 0.27);
    --ui-glow: 0 18px 54px rgba(0, 0, 0, 0.28);
    --ui-glow-accent: 0 22px 70px rgba(var(--primary-rgb), 0.14);
}

html { scroll-padding-top: 92px; }

body {
    background-attachment: fixed;
    letter-spacing: -0.008em;
}

body::before { opacity: 0.46; }
body::after { opacity: 0.28; }

/* Navigation */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--ui-line);
    background: color-mix(in srgb, var(--navbar-bg) 92%, transparent);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(22px) saturate(135%);
    -webkit-backdrop-filter: blur(22px) saturate(135%);
}

.navbar-container { min-height: 72px; }

.navbar-brand img,
.nav-logo-img {
    max-height: 43px;
    object-fit: contain;
}

.nav-links a,
.navbar-nav a {
    border-radius: 12px;
    font-weight: 650;
}

.nav-links a:hover,
.navbar-nav a:hover {
    background: rgba(var(--primary-rgb), 0.08);
}

/* Shared surfaces */
:is(.card, .auth-card, .co-summary, .co-payment, .pdp-section-card, .pdp-buy-panel,
    .product-card, .stat-card, .metric-card, .financial-card, .chart-card,
    .bundle-summary-card, .bundle-product-card, .ticket-chat, .link-card) {
    border-color: var(--ui-line);
    background: linear-gradient(145deg, rgba(255,255,255,.025), transparent 42%), var(--ui-surface);
    box-shadow: var(--ui-glow);
    backdrop-filter: blur(16px);
}

:is(.card, .product-card, .stat-card, .metric-card, .bundle-product-card) {
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

:is(.product-card, .stat-card, .metric-card, .bundle-product-card):hover {
    transform: translateY(-3px);
    border-color: var(--ui-line-accent);
    box-shadow: var(--ui-glow-accent);
}

.page-header {
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--ui-line);
}

.page-header h1,
.page-header h2,
.admin-page-title {
    background: linear-gradient(110deg, #fff 8%, var(--text-secondary) 68%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Forms and actions */
.form-group { margin-bottom: 1.2rem; }

:is(.form-control, input[type="text"], input[type="email"], input[type="password"],
    input[type="url"], input[type="number"], input[type="search"], select, textarea) {
    min-height: 46px;
    border: 1px solid var(--ui-line);
    border-radius: 13px;
    background: rgba(4, 4, 4, 0.78);
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea.form-control,
textarea { min-height: 108px; }

:is(.form-control, input, select, textarea):focus {
    border-color: rgba(var(--primary-rgb), 0.72);
    background: rgba(7, 7, 7, 0.94);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.11);
}

.form-hint {
    display: block;
    margin-top: .48rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.btn {
    min-height: 42px;
    border-radius: 12px;
    font-weight: 750;
    letter-spacing: -0.01em;
}

.btn-primary {
    border: 1px solid rgba(255,255,255,.1);
    box-shadow: 0 10px 28px rgba(var(--primary-rgb), .24);
}

.btn-primary:hover { box-shadow: 0 14px 38px rgba(var(--primary-rgb), .34); }

.btn-secondary {
    border-color: var(--ui-line);
    background: rgba(255,255,255,.045);
}

.badge { border-radius: 999px; }

/* Alerts, modals & toasts — align with the shared surface tokens so every
 * dialog/notification component reads consistently regardless of page. */
.alert {
    border-color: var(--ui-line);
    background: linear-gradient(145deg, rgba(255,255,255,.02), transparent 42%), rgba(255, 255, 255, 0.035);
    backdrop-filter: blur(10px);
}

:is(.modal, .modal-overlay, .invoice-modal-overlay) > div {
    border-color: var(--ui-line);
    background: linear-gradient(160deg, rgba(255,255,255,.03), transparent 46%), var(--ui-surface-strong);
    box-shadow: var(--ui-glow);
    backdrop-filter: blur(20px);
}

/* Loading skeletons — lightweight utility for async admin/storefront
 * sections while data is fetched (tables, cards, stats). */
.skeleton {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    transform: translateX(-100%);
    animation: ui-skeleton-shimmer 1.4s ease-in-out infinite;
}

.skeleton-text { height: 0.9em; margin: 0.25em 0; }
.skeleton-title { height: 1.4em; width: 60%; }
.skeleton-avatar { width: 48px; height: 48px; border-radius: 50%; }
.skeleton-card { min-height: 140px; border: 1px solid var(--ui-line); }

@keyframes ui-skeleton-shimmer {
    100% { transform: translateX(100%); }
}

/* Tables */
.table-responsive {
    border: 1px solid var(--ui-line);
    background: rgba(4, 4, 4, .44);
}

.table { border-collapse: separate; border-spacing: 0; }

.table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--ui-surface-strong);
    color: var(--text-secondary);
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .055em;
}

.table tbody tr { transition: background-color 140ms ease; }
.table tbody tr:hover { background: rgba(var(--primary-rgb), .045); }

/* Home page rhythm */
.hero-fx {
    min-height: min(820px, calc(100svh - 72px));
    border-bottom: 1px solid var(--ui-line);
}

.hero-fx-content { max-width: 920px; }

.hero-fx-subtitle {
    max-width: 650px;
    font-size: clamp(1rem, 2.2vw, 1.24rem);
}

.hero-fx-stats {
    max-width: 820px;
    margin-inline: auto;
}

.search-fx { padding-block: clamp(26px, 5vw, 48px); }

.search-fx-wrap {
    min-height: 60px;
    border-color: var(--ui-line-accent);
    background: rgba(7, 7, 7, .88);
}

.search-fx-input,
.search-fx-input:hover,
.search-fx-input:focus {
    min-width: 0;
    min-height: 44px;
    padding: .55rem .2rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.search-fx-help {
    display: block;
    margin-top: .65rem;
    text-align: center;
    color: var(--text-muted);
}

.sec-fx { padding-block: clamp(34px, 6vw, 68px); }
.sec-fx + .sec-fx { border-top: 1px solid rgba(255,255,255,.045); }

.pgrid-fx { gap: clamp(16px, 2.4vw, 26px); }

.pc-fx {
    overflow: hidden;
    border-color: var(--ui-line);
    background: linear-gradient(150deg, rgba(255,255,255,.028), transparent 44%), var(--ui-surface);
    box-shadow: var(--ui-glow);
}

.pc-fx:hover {
    transform: translateY(-5px);
    border-color: var(--ui-line-accent);
    box-shadow: var(--ui-glow-accent);
}

.pc-fx-img img { transition: transform 420ms cubic-bezier(.2,.7,.2,1); }
.pc-fx:hover .pc-fx-img img { transform: scale(1.035); }

/* News */
.news-carousel { padding-inline: 2px; }

.news-fx-card {
    overflow: hidden;
    border: 1px solid var(--ui-line);
    border-radius: 22px;
    background: var(--ui-surface);
    box-shadow: var(--ui-glow);
}

.news-card-img {
    position: relative;
    min-height: 210px;
    overflow: hidden;
    background: radial-gradient(circle at 30% 30%, rgba(var(--primary-rgb),.18), transparent 56%), #090e16;
}

.news-card-img > img {
    width: 100%;
    height: 100%;
    min-height: 210px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.news-card-placeholder,
.news-card-placeholder-fallback {
    width: 100%;
    min-height: 210px;
    display: grid;
    place-items: center;
    color: rgba(var(--primary-rgb), .7);
    font-size: 2.25rem;
    background: radial-gradient(circle, rgba(var(--primary-rgb),.16), transparent 64%);
}

.news-card-img .news-card-placeholder-fallback {
    position: absolute;
    inset: 0;
}

.news-card-body { padding: 1.35rem; }

.news-admin-thumb {
    width: 72px;
    height: 48px;
    object-fit: cover;
    border: 1px solid var(--ui-line);
    border-radius: 10px;
}

.news-image-missing { color: var(--text-muted); font-size: .76rem; }

.news-upload-preview {
    width: min(100%, 360px);
    aspect-ratio: 16 / 9;
    margin-top: .75rem;
    object-fit: cover;
    border: 1px solid var(--ui-line-accent);
    border-radius: 14px;
}

/* Checkout */
.checkout-grid,
.co-layout { align-items: start; gap: clamp(20px, 4vw, 44px); }

.co-payment,
.co-summary { border-radius: 24px; }

.pix-code,
.pix-key { word-break: break-all; }

/* Admin */
.admin-body {
    background: radial-gradient(circle at 92% 4%, rgba(var(--primary-rgb),.12), transparent 25%), var(--bg);
}

.admin-sidebar {
    border-right: 1px solid var(--ui-line);
    background: rgba(5, 5, 5, .94);
    box-shadow: 16px 0 50px rgba(0,0,0,.2);
    backdrop-filter: blur(22px);
}

.sidebar-header { border-bottom: 1px solid var(--ui-line); }

.sidebar-link {
    margin: 2px 10px;
    border: 1px solid transparent;
    border-radius: 11px;
}

.sidebar-link:hover {
    border-color: rgba(var(--primary-rgb),.12);
    background: rgba(var(--primary-rgb),.065);
}

.sidebar-link.active {
    border-color: var(--ui-line-accent);
    background: linear-gradient(90deg, rgba(var(--primary-rgb),.16), rgba(var(--primary-rgb),.045));
    box-shadow: inset 3px 0 0 var(--primary);
}

.admin-header {
    border-bottom: 1px solid var(--ui-line);
    background: rgba(7, 7, 7, .88);
    backdrop-filter: blur(20px);
}

.admin-content {
    width: min(100%, 1480px);
    margin-inline: auto;
    padding: clamp(18px, 3vw, 38px);
}

.admin-content > .card { max-width: 100%; }

.settings-card {
    max-width: 1080px;
    margin-inline: auto;
}

.news-editor-card {
    max-width: 920px;
    margin: 0 auto 24px;
}

.gateway-fields {
    margin-top: 14px;
    padding: 18px;
    border: 1px solid var(--ui-line);
    border-radius: 16px;
    background: rgba(2, 2, 2, .58);
}

.gateway-status-note {
    display: flex;
    gap: .65rem;
    margin-bottom: 1rem;
    padding: .85rem 1rem;
    border: 1px solid rgba(52,211,153,.2);
    border-radius: 12px;
    color: #a7f3d0;
    background: rgba(52,211,153,.07);
    font-size: .84rem;
    line-height: 1.45;
}

.toast {
    border: 1px solid var(--ui-line);
    border-radius: 14px;
    backdrop-filter: blur(18px);
    box-shadow: var(--ui-glow);
}

/* Responsive details */
@media (max-width: 820px) {
    html { scroll-padding-top: 72px; }
    .navbar-container { min-height: 64px; }
    .hero-fx { min-height: auto; padding: 84px 18px 62px; }
    .hero-fx-stats { gap: 16px; }
    .fx-stat { width: calc(50% - 8px); padding: 0; border-right: 0; }
    .search-fx-wrap { border-radius: 18px; padding: 7px 7px 7px 16px; }
    .search-fx-btn { padding-inline: 18px; }
    .catalog-toolbar { align-items: stretch; flex-direction: column; }
    .catalog-toolbar-actions { width: 100%; }
    .catalog-sort-form { flex: 1; }
    .news-card-img,
    .news-card-img > img,
    .news-card-placeholder { min-height: 180px; }
    .admin-content { padding: 18px 14px 32px; }
    .gateway-fields { padding: 14px; }
}

@media (max-width: 520px) {
    .fx-stat { width: 100%; }
    .search-fx-btn span { display: none; }
    .search-fx-btn { width: 44px; justify-content: center; padding: 0; }
    .sec-fx-head { align-items: flex-start; }
    .sec-fx-more { width: 100%; margin-left: 60px; }
    .form-row { flex-direction: column; gap: 0; }
    .action-btns { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

