/* ============================================
   GlobalSource — Design System
   ============================================ */

:root {
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #0f172a;
    --color-muted: #64748b;
    --color-border: #e2e8f0;
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-accent: #06b6d4;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-navy: #0f172a;
    --color-navy-soft: #1e293b;
    --gradient-hero: linear-gradient(135deg, #0f172a 0%, #1e3a5f 45%, #2563eb 100%);
    --gradient-mesh: radial-gradient(ellipse 80% 60% at 20% 0%, rgba(56, 189, 248, 0.25), transparent),
        radial-gradient(ellipse 60% 50% at 90% 20%, rgba(37, 99, 235, 0.2), transparent);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 30px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --font: "Inter", system-ui, -apple-system, sans-serif;
    --header-h: 72px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
}

.container {
    width: min(92%, 1280px);
    margin-inline: auto;
}

/* ---- Header ---- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: var(--transition);
}

.site-header.is-scrolled {
    box-shadow: var(--shadow-md);
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-h);
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.brand-logo {
    height: 36px;
    width: auto;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: var(--transition);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-links a {
    color: #e2e8f0;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-links a:hover,
.nav-links a.is-active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.35rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: var(--transition);
    font-family: inherit;
}

.btn-sm {
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: #fff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
    background: var(--color-success);
    color: #fff;
}

.btn-secondary:hover {
    filter: brightness(1.05);
    transform: translateY(-2px);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none !important;
}

/* ---- Hero ---- */
.hero {
    position: relative;
    padding: clamp(4rem, 10vw, 7rem) 0;
    text-align: center;
    background: var(--gradient-hero);
    color: #fff;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--gradient-mesh);
    pointer-events: none;
}

.hero .container {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 1.25rem;
}

.hero p {
    max-width: 42rem;
    margin-inline: auto;
    font-size: clamp(1rem, 2vw, 1.2rem);
    opacity: 0.92;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
}

.hero-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ---- Search bar ---- */
.search-panel {
    max-width: 56rem;
    margin: 3rem auto 0;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.search-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 0.75rem;
}

.search-grid input,
.search-grid select {
    margin: 0;
}

/* ---- Sections ---- */
.section {
    padding: clamp(3.5rem, 8vw, 5.5rem) 0;
}

.section-alt {
    background: var(--color-surface);
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
    max-width: 40rem;
    margin-inline: auto;
}

.section-title h2 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

.section-title p {
    color: var(--color-muted);
    font-size: 1.05rem;
}

.section-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-primary);
    margin-bottom: 0.75rem;
}

/* ---- Grid & cards ---- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
    border-color: transparent;
}

.card-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eff6ff, #ecfeff);
    color: var(--color-primary);
    border-radius: 14px;
    font-size: 1.35rem;
    margin-bottom: 1.25rem;
}

.card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.65rem;
}

.card p {
    color: var(--color-muted);
    font-size: 0.95rem;
}

.card-featured {
    border: 2px solid transparent;
    background: linear-gradient(var(--color-surface), var(--color-surface)) padding-box,
        linear-gradient(135deg, var(--color-primary), var(--color-accent)) border-box;
}

/* ---- Forms ---- */
.form-container {
    background: var(--color-surface);
    padding: clamp(1.5rem, 4vw, 2.5rem);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
    max-width: 52rem;
    margin-inline: auto;
}

.form-container h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.form-container .form-lead {
    color: var(--color-muted);
    margin-bottom: 1.5rem;
}

form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: -0.5rem;
}

input,
textarea,
select {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    background: var(--color-surface);
    transition: var(--transition);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.checkbox-row label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    cursor: pointer;
}

/* ---- Stats ---- */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
}

.stat-item {
    text-align: center;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.stat-item strong {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.2;
}

.stat-item span {
    font-size: 0.85rem;
    opacity: 0.85;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}

.dashboard-card {
    background: var(--color-surface);
    padding: 1.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    text-align: center;
    transition: var(--transition);
}

.dashboard-card:hover {
    box-shadow: var(--shadow-md);
}

.dashboard-number {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ---- Tables ---- */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
}

table th {
    background: var(--color-navy);
    color: #fff;
    padding: 1rem;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
}

table td {
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
}

/* ---- Badges ---- */
.badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* ---- Footer ---- */
.site-footer {
    background: var(--color-navy);
    color: #e2e8f0;
    padding: 4rem 0 0;
    margin-top: 4rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr repeat(3, 1fr);
    gap: 2.5rem;
    padding-bottom: 2.5rem;
}

.footer-brand p {
    margin: 1rem 0 1.25rem;
    color: #94a3b8;
    font-size: 0.95rem;
    max-width: 22rem;
}

.footer-logo {
    height: 32px;
    opacity: 0.95;
}

.footer-social {
    display: flex;
    gap: 0.75rem;
}

.footer-social a {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: #fff;
    text-decoration: none;
    transition: var(--transition);
}

.footer-social a:hover {
    background: var(--color-primary);
}

.site-footer h4 {
    color: #fff;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.site-footer a {
    display: block;
    color: #94a3b8;
    text-decoration: none;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    transition: var(--transition);
}

.site-footer a:hover {
    color: var(--color-accent);
}

.site-footer p {
    color: #94a3b8;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.site-footer p i {
    width: 1.25rem;
    color: var(--color-accent);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1.25rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.85rem;
    color: #64748b;
}

/* ---- Auth page ---- */
.page-auth {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--gradient-hero);
}

.page-auth .site-header {
    background: transparent;
    border: none;
}

.page-auth main {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 2rem 0;
}

.auth-card {
    max-width: 420px;
    margin-inline: auto;
    width: 100%;
}

.auth-card .form-container {
    border: none;
}

.auth-logo {
    display: block;
    margin: 0 auto 1.5rem;
    height: 44px;
}

/* ---- Utilities ---- */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.25rem;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.filter-bar input,
.filter-bar select {
    flex: 1;
    min-width: 180px;
    margin: 0;
}

.cta-banner {
    text-align: center;
    padding: clamp(2.5rem, 6vw, 4rem);
    background: linear-gradient(135deg, #eff6ff, #ecfeff);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.back-to-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 900;
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    padding: 0.85rem 1.25rem;
    background: var(--color-navy);
    color: #fff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    font-weight: 500;
    animation: toastIn 0.35s ease;
    pointer-events: auto;
}

.toast--success { background: #059669; }
.toast--error { background: #dc2626; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

/* ---- Legacy aliases ---- */
.logo { font-weight: 800; }
.feature-icon { font-size: 2rem; margin-bottom: 1rem; }
footer:not(.site-footer) { background: var(--color-navy); color: #e2e8f0; padding: 3rem 0; margin-top: 4rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; }

/* ---- Responsive ---- */
@media (max-width: 992px) {
    .search-grid {
        grid-template-columns: 1fr 1fr;
    }
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: var(--header-h);
        left: 0;
        right: 0;
        background: var(--color-navy);
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 0.25rem;
        transform: translateY(-120%);
        opacity: 0;
        visibility: hidden;
        transition: var(--transition);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        max-height: calc(100vh - var(--header-h));
        overflow-y: auto;
    }

    .nav-links.is-open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .nav-links a,
    .nav-links .btn {
        width: 100%;
        text-align: center;
    }

    .search-grid {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}

/* ---- Catalog cards ---- */
.catalog-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.catalog-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.catalog-img--round {
    width: 80px;
    height: 80px;
    border-radius: 50%;
}

.catalog-img--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eff6ff, #e0f2fe);
    color: var(--color-primary);
    font-size: 2rem;
}

.catalog-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.catalog-meta {
    list-style: none;
    color: var(--color-muted);
    font-size: 0.9rem;
}

.catalog-meta li {
    margin-bottom: 0.35rem;
}

.catalog-meta i {
    width: 1.1rem;
    color: var(--color-primary);
}

.catalog-actions {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.catalog-loading,
.catalog-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--color-muted);
}

.catalog-card.is-hidden {
    display: none !important;
}

/* ---- Config banner ---- */
.config-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.65rem 1rem;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.85rem;
    border-bottom: 1px solid #fde68a;
}

.config-banner a {
    color: #1d4ed8;
    font-weight: 600;
}

.config-banner button {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: inherit;
}

.config-banner--info {
    background: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

.nav-tools {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-select,
.nav-icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font-family: inherit;
}

.nav-icon-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.whatsapp-float {
    position: fixed;
    bottom: 5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    background: #25d366;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    box-shadow: var(--shadow-lg);
    z-index: 900;
    text-decoration: none;
}

.whatsapp-float:hover {
    transform: scale(1.05);
}

/* ---- Setup page ---- */
.setup-steps {
    margin: 1.5rem 0;
    padding-left: 1.25rem;
}

.setup-step {
    margin-bottom: 1.5rem;
}

.setup-step.is-done strong {
    color: var(--color-success);
}

.setup-status {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.setup-status--ok {
    background: #dcfce7;
    color: #166534;
}

.setup-status--warn {
    background: #fef3c7;
    color: #92400e;
}

/* ---- Dark theme ---- */
[data-theme="dark"] {
    --color-bg: #0f172a;
    --color-surface: #1e293b;
    --color-text: #f1f5f9;
    --color-muted: #94a3b8;
    --color-border: #334155;
    --gradient-hero: linear-gradient(135deg, #020617 0%, #0f172a 50%, #1e3a8a 100%);
}

[data-theme="dark"] .card,
[data-theme="dark"] .form-container,
[data-theme="dark"] .filter-bar,
[data-theme="dark"] .search-panel {
    background: var(--color-surface);
    border-color: var(--color-border);
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: #0f172a;
    color: var(--color-text);
    border-color: var(--color-border);
}

[data-theme="dark"] .catalog-img--placeholder {
    background: #334155;
}

[data-theme="dark"] .cta-banner {
    background: #1e293b;
}

[data-theme="dark"] table td {
    border-color: var(--color-border);
}
