@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;600;800&family=Roboto:wght@300;400;500;700&display=swap');

:root {
    /* Variables ARGENTINA PREMIUM THEME */
    --bg-dark: #f0f4f8;      /* Fondo celeste grisáceo muy claro */
    --bg-panel: #ffffff;    /* Blanco puro para paneles */
    --bg-card: #f8fafc;     /* Blanco humo para cards */
    --border: #d1d9e6;      /* Bordes suaves */
    --text-main: #1e293b;   /* Azul oscuro profundo para texto */
    --text-muted: #64748b;  /* Gris azulado para texto secundario */
    --success: #00a650;     /* Verde profesional */
    --warning: #f6b40e;     /* Oro Sol de Mayo */
    --danger: #ef4444;  
    --brand: #74ACDF;       /* Celeste Argentina oficial */
    --brand-dark: #003082;  /* Azul marino para contraste */
    --font: 'Plus Jakarta Sans', sans-serif;

    /* Variables Estilo Vendedor (E-commerce) */
    --ml-bg: #f5f7fa;
    --ml-header: #ffffff;
    --ml-text: #1e293b;
    --ml-blue: #74ACDF;
    --ml-green: #00a650;
    --ml-font: 'Roboto', sans-serif;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 25px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font); overflow: hidden; background-color: var(--bg-dark); color: var(--text-main); }

/* ==========================================
   ADMIN DASHBOARD AVANZADO
   ========================================== */
#admin-view {
    display: grid;
    grid-template-areas: 
        "header header"
        "main side";
    grid-template-columns: 1fr 380px;
    grid-template-rows: auto 1fr;
    height: 100vh;
    padding: 15px;
    gap: 15px;
}

.dashboard-header { grid-area: header; }
.dashboard-main { grid-area: main; display: flex; flex-direction: column; gap: 15px; overflow-y: auto; padding-right: 5px; }
.dashboard-side { grid-area: side; display: flex; flex-direction: column; gap: 15px; overflow-y: auto; padding-right: 5px; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.kpi-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.kpi-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 16px; padding: 20px; box-shadow: var(--shadow-sm); transition: transform 0.3s ease; }
.kpi-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: var(--brand); }
.kpi-card span { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; letter-spacing: 0.8px; }
.kpi-card h3 { font-size: 1.5rem; margin-top: 8px; font-weight: 800; color: var(--brand-dark); }

.dashboard-section { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 20px; padding: 20px; box-shadow: var(--shadow-sm); }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-header h3 { font-size: 0.9rem; font-weight: 700; color: var(--text-main); text-transform: uppercase; letter-spacing: 1px; }

/* TABLAS DASHBOARD (DETALLADA) */
.table-wrapper { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th { background: #f1f5f9; padding: 12px 15px; font-size: 0.7rem; text-transform: uppercase; color: var(--text-muted); text-align: left; font-weight: 800; }
td { padding: 12px 15px; border-bottom: 1px solid #f1f5f9; font-size: 0.85rem; color: var(--text-main); }
tr:hover { background: rgba(116, 172, 223, 0.05); cursor: pointer; }

/* ALERTAS */
.alert-item { background: rgba(239, 68, 68, 0.05); border-left: 3px solid var(--danger); padding: 8px 12px; margin-bottom: 8px; border-radius: 4px; display: flex; align-items: center; gap: 8px; }
.alert-item.warning { border-left-color: var(--warning); background: rgba(245, 158, 11, 0.05); }
.alert-title { font-size: 0.75rem; font-weight: 700; }

.prediction-badge { background: rgba(0, 242, 234, 0.1); color: var(--brand); font-size: 0.6rem; padding: 2px 6px; border-radius: 10px; border: 1px solid var(--brand); }

/* RANKINGS */
.ranking-list { display: flex; flex-direction: column; gap: 10px; }
.ranking-item { display: flex; align-items: center; gap: 10px; }
.rank-num { width: 22px; height: 22px; background: var(--bg-card); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 800; color: var(--brand); }
.rank-info { flex: 1; }
.rank-name { font-size: 0.8rem; font-weight: 600; margin-bottom: 3px; }
.rank-bar-container { height: 5px; background: var(--bg-card); border-radius: 3px; overflow: hidden; }
.rank-bar { height: 100%; background: var(--brand); }
.rank-val { font-size: 0.75rem; font-weight: 700; color: var(--brand); min-width: 45px; text-align: right; }

/* ==========================================
   VISTA VENDEDOR (RESTAURADA TOTALMENTE)
   ========================================== */
.ml-seller-view { display: none; width: 100%; height: 100vh; background-color: var(--bg-dark); color: var(--text-main); font-family: var(--font); overflow-y: auto; }
.ml-header { background-color: var(--bg-panel); padding: 15px 0; border-bottom: 1px solid var(--border); box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
.ml-header-container { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; padding: 0 20px; gap: 40px; }
.ml-brand { font-size: 1.6rem; font-weight: 800; color: var(--brand); letter-spacing: -1px; }
.ml-search-bar { flex: 1; display: flex; background: var(--bg-card); border-radius: 8px; border: 1px solid var(--border); height: 40px; overflow: hidden; }
.ml-search-bar input { flex: 1; border: none; padding: 0 15px; outline: none; background: transparent; color: white; }
.ml-search-bar button { background: transparent; border: none; padding: 0 15px; cursor: pointer; color: var(--text-muted); }

.ml-nav { background: var(--bg-panel); border-bottom: 1px solid var(--border); }
.ml-nav-container { max-width: 1200px; margin: 0 auto; display: flex; gap: 30px; padding: 0 20px; }
.ml-nav-container a { padding: 15px 0; text-decoration: none; color: var(--text-muted); font-size: 0.85rem; border-bottom: 3px solid transparent; font-weight: 600; transition: 0.3s; }
.ml-nav-container a:hover { color: var(--brand); }
.ml-nav-container a.active { border-bottom-color: var(--brand); color: var(--brand); }

.ml-main-container { max-width: 1200px; margin: 30px auto; padding: 0 20px; }

/* GRID PRODUCTOS ML */
.ml-product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.ml-card { background: #fff; border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,0.1); overflow: hidden; transition: 0.2s; cursor: pointer; display: flex; flex-direction: column; position: relative; }
.ml-card:hover { box-shadow: 0 8px 16px rgba(0,0,0,0.1); }

.ml-card-img { width: 100%; height: 220px; background: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; border-bottom: 1px solid #eee; }
.ml-card-img img { max-width: 100%; max-height: 100%; object-fit: contain; }

.ml-card-info { padding: 15px; flex: 1; display: flex; flex-direction: column; }
.ml-price { font-size: 1.5rem; color: #333; font-weight: 600; letter-spacing: -0.5px; }
.ml-profit { font-size: 0.95rem; color: var(--ml-green); font-weight: 700; margin: 4px 0; display: flex; align-items: center; gap: 5px; }
.ml-profit::before { content: '●'; font-size: 0.6rem; }
.ml-extra { font-size: 0.75rem; color: var(--ml-blue); font-weight: 500; margin-bottom: 8px; }
.ml-title { font-size: 0.9rem; color: #666; font-weight: 400; line-height: 1.4; margin-bottom: 20px; }

.btn { padding: 10px 18px; border-radius: 10px; font-weight: 700; cursor: pointer; transition: 0.3s; border: 1px solid transparent; font-size: 0.85rem; display: inline-flex; align-items: center; gap: 8px; }
.btn-primary { background: var(--brand); color: white; box-shadow: 0 4px 12px rgba(116, 172, 223, 0.3); }
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-2px); }
.btn-outline { background: #fff; color: var(--brand-dark); border-color: var(--brand); }
.btn-outline:hover { background: rgba(116, 172, 223, 0.1); }
.btn-sm { padding: 6px 12px; font-size: 0.75rem; }

/* MODALES Y OVERLAYS */
.modal-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(255, 255, 255, 0.4); 
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px);
    display: none; 
    justify-content: center; 
    align-items: center; 
    z-index: 20000; 
    transition: all 0.3s ease;
}

.modal-box { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 24px; padding: 30px; max-width: 700px; width: 90%; color: var(--text-main); box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); border: 1px solid rgba(255,255,255,0.5); }

.btn-switch-view { position: fixed; bottom: 25px; right: 25px; background: var(--brand-dark); color: white; border: none; padding: 14px 25px; border-radius: 50px; font-weight: 800; cursor: pointer; z-index: 10000; box-shadow: 0 8px 20px rgba(0,0,0,0.2); transition: 0.3s; }
.btn-switch-view:hover { transform: scale(1.05); background: var(--brand); }

.badge { padding: 6px 12px; border-radius: 8px; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; border: 1px solid transparent; }
.badge-success { background: rgba(0, 166, 80, 0.1); color: #00a650; border-color: rgba(0, 166, 80, 0.2); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: #ef4444; border-color: rgba(239, 68, 68, 0.2); }
.badge-warning { background: rgba(246, 180, 14, 0.1); color: #f6b40e; border-color: rgba(246, 180, 14, 0.2); }

/* MIS ÓRDENES Y COMISIONES (VENDEDOR) */
.ml-sale-item { background: #fff; padding: 15px; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow-sm); }
.ml-sale-item h4 { font-size: 1rem; color: var(--text-main); margin-bottom: 4px; }
.ml-sale-item p { font-size: 0.85rem; color: var(--text-muted); }

.ml-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.ml-stat-card { background: #fff; padding: 25px; border-radius: 16px; text-align: center; box-shadow: var(--shadow-sm); border: 1px solid var(--border); transition: 0.3s; }
.ml-stat-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); }
.ml-stat-card h3 { font-size: 2rem; color: var(--brand-dark); margin-bottom: 8px; font-weight: 800; }
.ml-stat-card p { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; letter-spacing: 1px; }
.ml-stat-card.featured { border-top: 5px solid var(--brand); }
.ml-stat-card.success { border-top: 5px solid var(--success); }

/* TOASTS */
.toast-container { position: fixed; bottom: 20px; left: 20px; z-index: 100000; display: flex; flex-direction: column; gap: 10px; }
.toast { background: white; color: var(--text-main); padding: 15px 25px; border-radius: 12px; box-shadow: var(--shadow-md); border-left: 5px solid var(--brand); font-weight: 700; min-width: 250px; animation: slideIn 0.3s ease-out; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

@keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* FEEDBACK VISUAL Y CARGA */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

.btn-success-flash { animation: flashSuccess 0.8s ease-out; }
.btn-error-flash { animation: flashError 0.8s ease-out; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes flashSuccess {
    0% { background-color: var(--success); box-shadow: 0 0 15px var(--success); }
    100% { }
}

@keyframes flashError {
    0% { background-color: var(--danger); box-shadow: 0 0 15px var(--danger); }
    100% { }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}
.pulse { animation: pulse 2s infinite ease-in-out; }
