/**
 * Arabian Club Imports - Design System
 * Dark Luxury + Perfumaria Árabe + Editorial Premium
 */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&display=swap');

/* ========== RESET / NORMALIZE BÁSICO ========== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }

/* ========== CSS CUSTOM PROPERTIES — LIGHT LUXURY ========== */
:root {
    /* Paleta Arabian Club — fundos claros */
    --ds-bg: #FAFAFA;
    --ds-bg-elevated: #FFFFFF;
    --ds-bg-hover: #F9F9F9;
    --ds-card: #FFFFFF;
    --ds-card-hover: #FFFFFF;
    --ds-card-shadow: 0 1px 3px rgba(0,0,0,0.08);
    --ds-card-shadow-lg: 0 4px 16px rgba(0,0,0,0.1);

    /* Dourado — acentos apenas */
    --ds-gold: #D4AF37;
    --ds-gold-light: #F6E27A;
    --ds-gold-dark: #A57C1B;
    --ds-gold-gradient: linear-gradient(135deg, #F6E27A 0%, #D4AF37 50%, #A57C1B 100%);
    --ds-gold-glow: 0 0 20px rgba(212, 175, 55, 0.15);

    /* Accent = Dourado */
    --ds-accent: #D4AF37;
    --ds-accent-hover: #F6E27A;
    --ds-accent-dark: #A57C1B;
    --ds-accent-bg: rgba(212, 175, 55, 0.10);

    /* Roxo Vinho — detalhes pequenos */
    --ds-wine: #3A0F1E;
    --ds-wine-light: #5A1F34;
    --ds-wine-bg: rgba(58, 15, 30, 0.08);

    /* Texto */
    --ds-text: #1A1A1A;
    --ds-text-muted: #666666;
    --ds-text-dim: #999999;
    --ds-text-gold: #D4AF37;

    /* Bordas */
    --ds-border: #E5E5E5;
    --ds-border-light: #EEEEEE;
    --ds-border-gold: rgba(212, 175, 55, 0.35);

    /* Status */
    --ds-success: #34C759;
    --ds-success-bg: rgba(52, 199, 89, 0.12);
    --ds-danger: #FF3B30;
    --ds-danger-bg: rgba(255, 59, 48, 0.12);
    --ds-warning: #FF9500;
    --ds-warning-bg: rgba(255, 149, 0, 0.12);
    --ds-info: #007AFF;
    --ds-info-bg: rgba(0, 122, 255, 0.12);

    /* Medidas */
    --ds-radius: 12px;
    --ds-radius-btn: 10px;
    --ds-radius-sm: 8px;
    --ds-padding: 16px;
    --ds-gap: 12px;
    --ds-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    /* Tipografia */
    --ds-font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --ds-font-display: 'Playfair Display', 'Georgia', serif;
    --ds-font-perfume-name: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Compatibilidade g-* e styles.css */
    --g-bg: var(--ds-bg);
    --g-card: var(--ds-card);
    --g-card-shadow: var(--ds-card-shadow);
    --g-accent: var(--ds-accent);
    --g-accent-dark: var(--ds-accent-dark);
    --g-text: var(--ds-text);
    --g-text-muted: var(--ds-text-muted);
    --g-border: var(--ds-border);
    --g-radius: var(--ds-radius);
    --g-radius-btn: var(--ds-radius-btn);
    --g-transition: var(--ds-transition);
    --g-padding: var(--ds-padding);
    --g-gap: var(--ds-gap);
    --gold: #D4AF37;
    --gold-light: #F6E27A;
    --gold-dark: #A57C1B;
    --amber-light: #C8A76A;
    --pearl-white: #F5F5F5;
}

/* ========== BODY BASE LIGHT ========== */
body {
    background: var(--ds-bg);
    color: var(--ds-text);
    font-family: var(--ds-font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== CONTAINER PRINCIPAL PADRONIZADO ========== */
.container-main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

/* ========== LAYOUT BASE ========== */
.g-layout {
    font-family: var(--ds-font);
    background: var(--ds-bg);
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}

.g-main-wrap {
    display: flex;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
    min-height: calc(100vh - 60px);
}

.g-content {
    flex: 1;
    padding: var(--ds-padding);
    padding-bottom: 80px;
}

/* ========== BADGES ========== */
.g-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.3px;
}
.g-badge--success { background: var(--ds-success-bg); color: var(--ds-success); }
.g-badge--danger { background: var(--ds-danger-bg); color: var(--ds-danger); }
.g-badge--warning { background: var(--ds-warning-bg); color: var(--ds-warning); }
.g-badge--info { background: var(--ds-info-bg); color: var(--ds-info); }
.g-badge--gold { background: var(--ds-accent-bg); color: var(--ds-gold); }
.g-badge--wine { background: var(--ds-wine-bg); color: #D4A0B0; }

/* ========== SKELETONS ========== */
.g-skeleton {
    background: linear-gradient(90deg, #F0F0F0 25%, #E5E5E5 50%, #F0F0F0 75%);
    background-size: 200% 100%;
    animation: g-shimmer 1.5s infinite;
    border-radius: var(--ds-radius);
}
@keyframes g-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ========== TOASTS ========== */
.g-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    padding: 12px 24px;
    background: #FFFFFF;
    color: var(--ds-gold);
    border: 1px solid var(--ds-border-gold);
    border-radius: var(--ds-radius);
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    transition: transform 0.3s ease;
    pointer-events: none;
    box-shadow: var(--ds-card-shadow-lg);
}
.g-toast.visible { transform: translateX(-50%) translateY(0); }

/* ========== INPUTS ========== */
.g-input {
    width: 100%;
    min-height: 48px;
    padding: 14px 16px;
    font-size: 16px;
    font-family: var(--ds-font);
    border: 1px solid #E5E5E5;
    border-radius: var(--ds-radius-btn);
    background: #FFFFFF;
    color: var(--ds-text);
    transition: var(--ds-transition);
}
.g-input:focus {
    outline: none;
    border-color: var(--ds-gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}
.g-input::placeholder { color: var(--ds-text-dim); }

/* ========== SELECTS ========== */
.g-select {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    font-size: 15px;
    font-family: var(--ds-font);
    border: 1px solid #E5E5E5;
    border-radius: var(--ds-radius-btn);
    background: #FFFFFF;
    color: var(--ds-text);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666666'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* ========== TABELAS ========== */
.g-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.g-table-wrap table { width: 100%; border-collapse: collapse; font-size: 14px; background: #FFFFFF; }
.g-table-wrap th { background: #F9F9F9; color: var(--ds-gold); font-weight: 600; text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--ds-border); }
.g-table-wrap td { padding: 10px 12px; border-bottom: 1px solid var(--ds-border); color: var(--ds-text); background: #FFFFFF; }
.g-table-wrap tr:nth-child(even) td { background: #F9F9F9; }
.g-table-wrap tr:hover td { background: #F5F5F5; }

/* ========== CARDS DARK LUXURY ========== */
.g-card {
    background: var(--ds-card);
    border-radius: var(--ds-radius);
    padding: var(--ds-padding);
    box-shadow: var(--ds-card-shadow);
    margin-bottom: var(--ds-gap);
    border: 1px solid var(--ds-border);
    transition: var(--ds-transition);
}
.g-card:hover {
    background: var(--ds-card-hover);
    border-color: var(--ds-border-light);
}
.g-card--gold-border { border: 1px solid var(--ds-border-gold); }
.g-card--gold-border:hover {
    border-color: var(--ds-gold);
    box-shadow: var(--ds-gold-glow);
}

/* ========== FORMULÁRIOS ========== */
.g-form-group { margin-bottom: 16px; }
.g-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ds-text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.g-form-group .g-hint { font-size: 12px; color: var(--ds-text-dim); margin-top: 4px; }

/* ========== BOTÕES DARK LUXURY ========== */
.g-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 20px;
    font-family: var(--ds-font);
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--ds-radius-btn);
    cursor: pointer;
    transition: var(--ds-transition);
    text-decoration: none;
}
.g-btn--primary {
    background: var(--ds-gold-gradient);
    color: #0B0B0B;
    font-weight: 700;
}
.g-btn--primary:hover {
    box-shadow: var(--ds-gold-glow);
    transform: translateY(-1px);
}
.g-btn--secondary {
    background: transparent;
    color: var(--ds-gold);
    border: 1px solid var(--ds-border-gold);
}
.g-btn--secondary:hover {
    background: var(--ds-accent-bg);
    border-color: var(--ds-gold);
}
.g-btn--ghost {
    background: transparent;
    color: var(--ds-text-muted);
}
.g-btn--ghost:hover {
    background: var(--ds-bg-hover);
    color: var(--ds-text);
}
.g-btn--danger {
    background: var(--ds-danger-bg);
    color: var(--ds-danger);
}
.g-btn--danger:hover { background: rgba(255,59,48,0.2); }
.g-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.g-btn--full { width: 100%; }

/* ========== EMPTY STATES ========== */
.g-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--ds-text-dim);
}
.g-empty p { margin-bottom: 12px; }
.g-empty svg { opacity: 0.3; margin-bottom: 16px; }

/* ========== PAGE HEADER ========== */
.g-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
}
.g-page-header h2 {
    font-size: 20px;
    font-family: var(--ds-font-display);
    color: var(--ds-text);
    margin: 0 0 4px;
}
.g-page-header p { font-size: 14px; color: var(--ds-text-muted); margin: 0; }
.g-page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ========== MODAL ========== */
.g-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.g-modal-overlay.hidden { display: none; }
.g-modal {
    background: #FFFFFF;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    padding: 24px;
    max-width: 480px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--ds-card-shadow-lg);
}
.g-modal h3 {
    font-size: 18px;
    font-family: var(--ds-font-display);
    color: var(--ds-text);
    margin: 0 0 16px;
}
.g-modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }

/* ========== STATUS BORDER-LEFT ========== */
.g-card--status-pendente { border-left: 4px solid var(--ds-warning); }
.g-card--status-encomendado { border-left: 4px solid var(--ds-info); }
.g-card--status-entregue { border-left: 4px solid var(--ds-success); }
.g-card--status-cancelado { border-left: 4px solid var(--ds-text-dim); }
.g-card--status-pago { border-left: 4px solid var(--ds-success); }

/* ========== METRIC CARDS DARK ========== */
.g-metric-card {
    background: var(--ds-card);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    padding: 16px;
    text-align: center;
    transition: var(--ds-transition);
}
.g-metric-card:hover {
    border-color: var(--ds-border-gold);
    box-shadow: var(--ds-gold-glow);
}
.g-metric-card a { text-decoration: none; color: inherit; display: block; }
.g-metric-icon { font-size: 1.5rem; margin-bottom: 8px; }
.g-metric-value { font-size: 1.5rem; font-weight: 700; color: var(--ds-gold); }
.g-metric-card .metric-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--ds-gold);
    font-family: var(--ds-font-display);
}
.g-metric-label {
    font-size: 12px;
    color: var(--ds-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}
.g-stock-gender {
    font-size: 0.8125rem;
    color: var(--ds-text-muted);
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--ds-card);
    border-radius: var(--ds-radius);
    box-shadow: var(--ds-card-shadow);
}
.g-stock-gender strong { color: var(--ds-text); }

/* ========== ACCORDION DARK ========== */
.g-section { margin-bottom: var(--ds-gap); }
.g-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 16px;
    background: var(--ds-card);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ds-text);
    text-align: left;
    transition: var(--ds-transition);
    min-height: 44px;
}
.g-accordion-header:hover {
    background: var(--ds-card-hover);
    border-color: var(--ds-border-gold);
}
.g-accordion-header.active {
    border-color: var(--ds-gold);
    background: var(--ds-bg-hover);
}
.g-accordion-header::after {
    content: '';
    width: 12px;
    height: 12px;
    border-right: 2px solid var(--ds-text-muted);
    border-bottom: 2px solid var(--ds-text-muted);
    transform: rotate(45deg);
    transition: var(--ds-transition);
}
.g-accordion-header[aria-expanded="true"]::after { transform: rotate(-135deg); }
.g-accordion-header-inner { display: flex; align-items: center; gap: 10px; }
.g-accordion-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}
.g-accordion-body.open { max-height: 800px; }
.g-accordion-inner {
    padding: 8px 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ========== ACTION BUTTONS ========== */
.g-action-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--ds-card);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-btn);
    text-decoration: none;
    color: var(--ds-text);
    font-weight: 500;
    font-size: 0.875rem;
    transition: var(--ds-transition);
    min-height: 44px;
}
.g-action-btn:hover { background: var(--ds-accent-bg); border-color: var(--ds-gold); }
.g-action-btn::after { content: '›'; color: var(--ds-gold); font-size: 1.25rem; font-weight: 400; }
.g-action-btn.highlight { background: var(--ds-accent-bg); border-color: var(--ds-border-gold); }
.g-action-btn.highlight:hover { border-color: var(--ds-gold); }

/* ========== MIGRAÇÃO ========== */
.g-migration-desc { font-size: 12px; color: var(--ds-text-muted); margin-bottom: 8px; }
.g-migration-btn {
    padding: 12px 16px;
    background: var(--ds-accent-bg);
    color: var(--ds-gold);
    border: 1px solid var(--ds-border-gold);
    border-radius: var(--ds-radius-btn);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    min-height: 44px;
    transition: var(--ds-transition);
}
.g-migration-btn:hover { background: rgba(212,175,55,0.2); }
.g-migration-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.g-migration-result { font-size: 0.8125rem; margin-top: 10px; color: var(--ds-text); }
.g-migration-result.error { color: var(--ds-danger); }
.g-migration-result.success { color: var(--ds-success, #2e7d32); }

/* ========== BOTTOM NAV ========== */
.g-bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid var(--ds-border);
    padding: 8px 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 200;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.g-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    min-width: 44px;
    min-height: 44px;
    color: var(--ds-text-dim);
    text-decoration: none;
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--ds-radius-btn);
    transition: var(--ds-transition);
}
.g-bottom-nav-item:hover, .g-bottom-nav-item.active { color: var(--ds-gold); }
.g-bottom-nav-item svg { width: 22px; height: 22px; margin-bottom: 4px; }

/* ========== SIDEBAR (desktop) ========== */
.g-sidebar {
    display: none;
    width: 240px;
    min-width: 240px;
    background: #FFFFFF;
    border-right: 1px solid var(--ds-border);
    padding: var(--ds-padding);
    flex-shrink: 0;
    transition: var(--ds-transition);
}
.g-sidebar.collapsed { width: 64px; min-width: 64px; }
.g-sidebar.collapsed .g-sidebar-label { display: none; }
.g-sidebar-toggle {
    display: none;
    width: 100%;
    padding: 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--ds-text-muted);
    font-size: 1.25rem;
    margin-bottom: 12px;
}
.g-sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.g-sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--ds-radius-btn);
    color: var(--ds-text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: var(--ds-transition);
    min-height: 44px;
}
.g-sidebar-link:hover { background: var(--ds-bg-hover); color: var(--ds-text); }
.g-sidebar-link.active { background: var(--ds-accent-bg); color: var(--ds-gold); font-weight: 600; }
.g-sidebar-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* ========== UTILITÁRIOS ========== */
.g-logout { text-align: center; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--ds-border); }
.g-logout a { color: var(--ds-text-muted); font-size: 0.875rem; text-decoration: none; }
.g-logout a:hover { color: var(--ds-gold); }
.g-version-banner {
    display: none;
    position: fixed;
    bottom: 70px;
    left: 16px;
    right: 16px;
    background: var(--ds-gold);
    color: #0B0B0B;
    padding: 12px 16px;
    border-radius: var(--ds-radius);
    text-align: center;
    z-index: 150;
}
.g-version-banner a { color: #0B0B0B; text-decoration: underline; }
.g-divider-gold {
    height: 1px;
    background: var(--ds-gold-gradient);
    opacity: 0.3;
    margin: 24px 0;
}

/* ========== HEADER ========== */
.header {
    background: #FFFFFF;
    border-bottom: 1px solid var(--ds-border);
}
.company-name {
    color: var(--ds-text);
    font-family: var(--ds-font-display);
}
.tagline {
    color: var(--ds-gold);
}

/* ========== LOADING SPINNER GOLD ========== */
.loading-spinner {
    border: 3px solid var(--ds-border);
    border-top: 3px solid var(--ds-gold);
}
.loading-container { color: var(--ds-text-muted); }
.loading-container p { color: var(--ds-text-dim); }

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #FAFAFA; }
::-webkit-scrollbar-thumb { background: #CCCCCC; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ds-gold-dark); }

/* ========== DASHBOARD ========== */
.g-dashboard { margin-bottom: 24px; }
.g-dashboard h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--ds-text);
    margin: 0 0 16px 0;
}
.g-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--ds-gap);
}

/* ========== MEDIA QUERIES ========== */
@media (min-width: 768px) {
    .g-metrics { grid-template-columns: repeat(4, 1fr); }
    .g-bottom-nav { display: none; }
    .g-content { padding-bottom: 24px; }
}
@media (min-width: 1024px) {
    .g-sidebar { display: block; }
    .g-sidebar-toggle { display: block; }
}
