/* ============================================
   BOUTIQUE ELEGANZA — SISTEMA DE GESTIÓN
   Estilo: Luxury Dark / Editorial Fashion
   ============================================ */

:root {
    --primary:    #1a1a2e;
    --primary-l:  #16213e;
    --accent:     #e94560;
    --accent-2:   #f5a623;
    --gold:       #c9a84c;
    --white:      #f8f5f0;
    --white-dim:  rgba(248,245,240,0.7);
    --white-faint:rgba(248,245,240,0.1);
    --success:    #2ecc71;
    --warning:    #f39c12;
    --danger:     #e74c3c;
    --sidebar-w:  260px;
    --topbar-h:   64px;
    --border:     rgba(255,255,255,0.08);
    --shadow:     0 4px 24px rgba(0,0,0,0.35);
    --radius:     12px;
    --radius-sm:  8px;
    --font-head:  'Playfair Display', Georgia, serif;
    --font-body:  'DM Sans', system-ui, sans-serif;
    --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--primary);
    color: var(--white);
    min-height: 100vh;
    display: flex;
    line-height: 1.6;
    font-size: 14px;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--primary-l);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 1000;
    overflow-y: auto;
    transition: transform var(--transition);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

.brand-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.brand-name {
    font-family: var(--font-head);
    font-size: 15px;
    font-weight: 700;
    color: var(--white);
    display: block;
    line-height: 1.2;
}

.brand-sub {
    font-size: 10px;
    color: var(--white-dim);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Sidebar user */
.sidebar-user {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--white-faint);
}

.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px;
    flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 500; display: block; }
.user-role  { font-size: 11px; display: block; margin-top: 2px; }
.role-dueno    { color: var(--gold); }
.role-empleado { color: var(--accent); }

/* Nav */
.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-section { margin-bottom: 4px; }

.nav-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--white-dim);
    padding: 12px 20px 4px;
}

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px;
    color: var(--white-dim);
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
    border-left: 3px solid transparent;
    transition: all var(--transition);
    cursor: pointer;
}

.nav-item:hover {
    color: var(--white);
    background: var(--white-faint);
    border-left-color: var(--accent);
}

.nav-item.active {
    color: var(--white);
    background: rgba(233,69,96,0.12);
    border-left-color: var(--accent);
    font-weight: 500;
}

.nav-icon { font-size: 12px; color: var(--accent); }

.sidebar-footer {
    padding: 12px 0;
    border-top: 1px solid var(--border);
}

.logout-btn:hover {
    color: var(--danger) !important;
    border-left-color: var(--danger) !important;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-bar {
    height: var(--topbar-h);
    background: var(--primary-l);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky; top: 0; z-index: 100;
}

.sidebar-toggle {
    background: none; border: none;
    color: var(--white-dim);
    font-size: 20px; cursor: pointer;
    padding: 4px;
    display: none;
    transition: color var(--transition);
}
.sidebar-toggle:hover { color: var(--white); }

.page-title h1 {
    font-family: var(--font-head);
    font-size: 20px; font-weight: 600;
    color: var(--white);
}

.top-bar-right { margin-left: auto; }
.date-display  { font-size: 12px; color: var(--white-dim); }

.content-wrap { padding: 28px; }

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 12px 20px;
    margin: 16px 28px 0;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
}
.alert-success { background: rgba(46,204,113,0.15); border: 1px solid rgba(46,204,113,0.3); color: #2ecc71; }
.alert-error   { background: rgba(231,76,60,0.15);  border: 1px solid rgba(231,76,60,0.3);  color: #e74c3c; }
.alert-warning { background: rgba(243,156,18,0.15); border: 1px solid rgba(243,156,18,0.3); color: #f39c12; }

/* ============================================
   CARDS & STATS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--primary-l);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), border-color var(--transition);
}
.stat-card:hover { transform: translateY(-3px); border-color: var(--accent); }

.stat-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--gold));
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--white-dim);
    margin-bottom: 8px;
}

.stat-value {
    font-family: var(--font-head);
    font-size: 28px;
    font-weight: 700;
    color: var(--white);
    line-height: 1.1;
}

.stat-icon {
    position: absolute; right: 18px; top: 18px;
    font-size: 28px; opacity: 0.15;
}

.stat-change {
    font-size: 11px;
    margin-top: 6px;
    color: var(--success);
}
.stat-change.down { color: var(--danger); }

/* Card genérica */
.card {
    background: var(--primary-l);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-family: var(--font-head);
    font-size: 17px;
    font-weight: 600;
    color: var(--white);
}

/* ============================================
   TABLES
   ============================================ */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--white-dim);
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
tbody tr:hover { background: var(--white-faint); }
tbody tr:last-child { border-bottom: none; }

tbody td {
    padding: 12px 14px;
    color: var(--white-dim);
    vertical-align: middle;
}

tbody td strong { color: var(--white); }

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
}
.badge-success { background: rgba(46,204,113,0.15); color: #2ecc71; }
.badge-danger  { background: rgba(231,76,60,0.15);  color: #e74c3c; }
.badge-warning { background: rgba(243,156,18,0.15); color: #f39c12; }
.badge-info    { background: rgba(52,152,219,0.15); color: #3498db; }
.badge-gold    { background: rgba(201,168,76,0.15); color: var(--gold); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px;
    border: none; border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 13px; font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #c73852; transform: translateY(-1px); }

.btn-secondary { background: var(--white-faint); color: var(--white); border: 1px solid var(--border); }
.btn-secondary:hover { background: rgba(255,255,255,0.15); }

.btn-success   { background: rgba(46,204,113,0.2); color: #2ecc71; border: 1px solid rgba(46,204,113,0.3); }
.btn-success:hover { background: rgba(46,204,113,0.35); }

.btn-danger    { background: rgba(231,76,60,0.2); color: #e74c3c; border: 1px solid rgba(231,76,60,0.3); }
.btn-danger:hover { background: rgba(231,76,60,0.35); }

.btn-gold      { background: linear-gradient(135deg, var(--gold), #a8832a); color: var(--primary); font-weight: 600; }
.btn-gold:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }

/* ============================================
   FORMS
   ============================================ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--white-dim);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--white);
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 13px;
    transition: border-color var(--transition), background var(--transition);
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(233,69,96,0.06);
}

select option { background: var(--primary); color: var(--white); }
textarea { resize: vertical; min-height: 80px; }

.search-bar {
    display: flex; gap: 10px; align-items: center;
    margin-bottom: 20px;
}
.search-bar input { max-width: 320px; }

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(233,69,96,0.15) 0%, transparent 70%);
    top: -200px; right: -200px;
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(201,168,76,0.1) 0%, transparent 70%);
    bottom: -100px; left: -100px;
    pointer-events: none;
}

.login-box {
    background: var(--primary-l);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%; max-width: 420px;
    position: relative; z-index: 1;
    box-shadow: var(--shadow);
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo .logo-icon {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
    margin: 0 auto 16px;
}

.login-logo h1 {
    font-family: var(--font-head);
    font-size: 26px;
    font-weight: 700;
    color: var(--white);
}

.login-logo p {
    font-size: 12px;
    color: var(--white-dim);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 4px;
}

.login-box .form-group { margin-bottom: 18px; }

.login-btn {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--accent), #c73852);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    margin-top: 8px;
}
.login-btn:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 8px 24px rgba(233,69,96,0.4); }

.login-error {
    background: rgba(231,76,60,0.15);
    border: 1px solid rgba(231,76,60,0.3);
    color: #e74c3c;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 18px;
    text-align: center;
}

/* ============================================
   DASHBOARD SPECIFIC
   ============================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.recent-sales-table td:first-child { font-weight: 600; color: var(--accent); }

.stock-bar {
    display: flex; align-items: center; gap: 10px;
}
.stock-bar-bg {
    flex: 1; height: 6px;
    background: var(--white-faint);
    border-radius: 3px; overflow: hidden;
}
.stock-bar-fill {
    height: 100%; border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), var(--gold));
    transition: width 0.6s ease;
}
.stock-bar-fill.low { background: var(--danger); }

/* ============================================
   VENTAS / POS
   ============================================ */
.pos-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}

.product-search-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    max-height: 440px;
    overflow-y: auto;
    padding-right: 4px;
}

.product-card-mini {
    background: var(--white-faint);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}
.product-card-mini:hover {
    border-color: var(--accent);
    background: rgba(233,69,96,0.08);
    transform: translateY(-2px);
}

.product-card-mini .p-name {
    font-size: 12px; font-weight: 600; color: var(--white);
    margin-bottom: 4px; line-height: 1.3;
}
.product-card-mini .p-price { font-size: 14px; color: var(--accent); font-weight: 700; }
.product-card-mini .p-stock { font-size: 11px; color: var(--white-dim); margin-top: 4px; }

.cart-container {
    background: var(--primary-l);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: sticky; top: calc(var(--topbar-h) + 20px);
}

.cart-title {
    font-family: var(--font-head);
    font-size: 16px; font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.cart-items { max-height: 300px; overflow-y: auto; margin-bottom: 16px; }

.cart-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}
.cart-item:last-child { border-bottom: none; }

.cart-item-name { flex: 1; color: var(--white); font-weight: 500; }
.cart-item-qty  { display: flex; align-items: center; gap: 6px; }
.cart-item-qty input {
    width: 44px; padding: 4px 6px;
    text-align: center; font-size: 12px;
}
.cart-item-price { color: var(--accent); font-weight: 600; min-width: 60px; text-align: right; }
.cart-remove { cursor: pointer; color: var(--danger); font-size: 14px; padding: 2px 6px; }

.cart-total {
    border-top: 1px solid var(--border);
    padding-top: 14px;
    font-size: 13px;
}
.cart-total-line {
    display: flex; justify-content: space-between;
    margin-bottom: 6px;
    color: var(--white-dim);
}
.cart-total-final {
    display: flex; justify-content: space-between;
    font-family: var(--font-head);
    font-size: 20px; font-weight: 700;
    color: var(--white);
    margin-top: 10px; padding-top: 10px;
    border-top: 2px solid var(--accent);
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 2000;
    align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal {
    background: var(--primary-l);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    width: 100%; max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    animation: modalIn 0.25s ease;
}
.modal-lg { max-width: 740px; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.modal-title { font-family: var(--font-head); font-size: 20px; font-weight: 600; }
.modal-close {
    background: none; border: none; color: var(--white-dim);
    font-size: 22px; cursor: pointer;
    transition: color var(--transition);
}
.modal-close:hover { color: var(--accent); }

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin-top: 24px;
}
.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
}
.pagination a { color: var(--white-dim); border: 1px solid var(--border); }
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination span { background: var(--accent); color: #fff; border: 1px solid var(--accent); }

/* ============================================
   INVENTORY SPECIFIC
   ============================================ */
.inv-filters {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
    margin-bottom: 20px;
}
.inv-filters select, .inv-filters input { min-width: 160px; }

.stock-qty { font-weight: 700; }
.stock-qty.critical { color: var(--danger); }
.stock-qty.low      { color: var(--warning); }
.stock-qty.ok       { color: var(--success); }

/* ============================================
   REPORTES
   ============================================ */
.report-tabs {
    display: flex; gap: 6px; flex-wrap: wrap;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}
.report-tab {
    padding: 10px 20px;
    border: none; background: none;
    color: var(--white-dim);
    font-family: var(--font-body); font-size: 13px; font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    margin-bottom: -1px;
}
.report-tab:hover { color: var(--white); }
.report-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.report-sum-card {
    background: var(--white-faint);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}
.report-sum-card .val {
    font-family: var(--font-head);
    font-size: 22px; font-weight: 700;
    color: var(--accent);
}
.report-sum-card .lbl { font-size: 11px; color: var(--white-dim); text-transform: uppercase; letter-spacing: 0.08em; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .pos-grid       { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .content-wrap { padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-box  { padding: 32px 24px; }
}
