:root {
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --surface-glass: rgba(30, 41, 59, 0.7);
    --primary-color: #10b981;
    --primary-hover: #059669;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-glow: rgba(16, 185, 129, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
    line-height: 1.6;
}

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-up { animation: fadeInUp 0.8s forwards; opacity: 0; }
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }

/* Loader */
.loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s;
}

.loader {
    width: 50px;
    height: 50px;
    border: 3px solid var(--surface-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Navbar */
.navbar {
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    background: linear-gradient(135deg, var(--primary-color), #065f46);
    color: white;
    font-weight: 800;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo-text span { color: var(--primary-color); }

.nav-menu {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-link {
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 5px 15px;
    border-radius: 20px;
    margin-left: 10px;
}

/* Hero Section */
.hero {
    padding: 80px 20px;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-bottom: 40px;
}

.search-bar {
    background: var(--surface-color);
    padding: 8px;
    border-radius: 16px;
    display: flex;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.search-bar input {
    flex: 1;
    background: none;
    border: none;
    color: white;
    padding: 12px 20px;
    outline: none;
    font-size: 1rem;
}

.search-bar select {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-main);
    padding: 0 15px;
    border-radius: 12px;
    outline: none;
    transition: var(--transition);
}

.search-bar select:hover {
    background: rgba(255, 255, 255, 0.15);
}

.search-bar select option {
    background: var(--surface-color);
    color: white;
    padding: 10px;
}

/* Buttons */
.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); }

.btn-delete {
    background: rgba(255, 71, 87, 0.1);
    color: #ff4757;
    border: 1px solid rgba(255, 71, 87, 0.2);
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-delete:hover {
    background: #ff4757;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

.full-width { width: 100%; margin-top: 10px; }

/* Containers */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.product-card {
    background: var(--surface-color);
    border-radius: 20px;
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    border-color: var(--primary-color);
}

.product-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.product-info {
    padding: 20px;
}

.product-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.product-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.product-seller {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* CRM Layout */
.crm-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 30px;
    min-height: 600px;
}

.crm-sidebar {
    background: var(--surface-color);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-item {
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.sidebar-item:hover, .sidebar-item.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary-color);
}

.crm-main {
    background: var(--surface-color);
    border-radius: 20px;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.stat-card {
    background: var(--bg-color);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-card .label { color: var(--text-muted); font-size: 0.9rem; }
.stat-card .value { display: block; font-size: 2rem; font-weight: 800; color: var(--primary-color); margin-top: 5px; }

/* Delivery Cards */
.delivery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.delivery-card {
    background: var(--surface-color);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-left: 4px solid var(--primary-color);
}

.delivery-card h4 { margin-bottom: 8px; font-size: 1.2rem; }
.delivery-card .address { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 12px; }
.delivery-card .status-tag { 
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.7rem;
    border-radius: 4px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary-color);
    margin-bottom: 15px;
}

.empty-state {
    text-align: center;
    padding: 60px 0;
    color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 15px; display: block; opacity: 0.3; }

/* Table */
.table-container { overflow-x: auto; margin-top: 20px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 16px; color: var(--text-muted); font-size: 0.9rem; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
td { padding: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.03); }

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
}
.badge.premium { background: var(--primary-color); color: white; }
.badge.active { background: rgba(16, 185, 129, 0.2); color: var(--primary-color); }

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); color: white; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    overflow-y: auto;
    padding: 20px 0;
}

.modal-content {
    background: var(--surface-color);
    margin: 5% auto;
    padding: 40px;
    border-radius: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-muted);
}

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; color: var(--text-muted); font-size: 0.9rem; }
.form-group input, .form-group textarea {
    width: 100%;
    background: var(--bg-color);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 16px;
    border-radius: 10px;
    outline: none;
}

.form-group input:focus { border-color: var(--primary-color); }

/* Utility */
.hidden { display: none !important; }
.view-section { transition: opacity 0.4s ease; }

.input-field {
    width: 100%;
    background: var(--bg-color);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 16px;
    border-radius: 10px;
    outline: none;
    transition: var(--transition);
}
.input-field:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--accent-glow); }

.card {
    background: var(--surface-color);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-lg);
}

.btn-map {
    background: #4285F4;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
}
.btn-map:hover { background: #357ae8; }

/* Ticket Generator */
.ticket-builder {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

.ticket-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ticket-receipt {
    background: #fff;
    color: #333;
    padding: 30px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
    position: relative;
}

.ticket-receipt::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 10px;
    background: linear-gradient(-45deg, #fff 5px, transparent 0), linear-gradient(45deg, #fff 5px, transparent 0);
    background-size: 10px 10px;
}

.ticket-header { text-align: center; border-bottom: 2px dashed #eee; padding-bottom: 15px; margin-bottom: 15px; }
.ticket-header h3 { color: var(--primary-color); letter-spacing: 2px; }
.ticket-footer { text-align: center; border-top: 2px dashed #eee; padding-top: 15px; margin-top: 20px; font-size: 0.8rem; }

/* Category Pills */
.pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
    font-size: 0.85rem;
    font-weight: 600;
}

.pill:hover, .pill.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px var(--accent-glow);
}

/* Responsive Admin */
@media (max-width: 768px) {
    .ticket-builder { grid-template-columns: 1fr; }
}

/* Star Rating System */
.star-rating {
    display: flex;
    gap: 12px;
    font-size: 1.8rem;
    color: rgba(255, 255, 255, 0.25);
    margin: 10px 0;
}

.star-rating i {
    cursor: pointer;
    transition: var(--transition);
}

.star-rating i.active {
    color: #f1c40f;
    text-shadow: 0 0 15px rgba(241, 196, 15, 0.5);
}

.star-rating i:hover {
    transform: scale(1.2);
    color: #f1c40f;
}

/* Tracking Stepper */
.tracking-stepper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    margin-bottom: 10px;
    position: relative;
    padding: 0;
}

.tracking-stepper::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255,255,255,0.1);
    z-index: 1;
    transform: translateY(-50%);
}

.stepper-step {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg-color);
    border: 2px solid rgba(255,255,255,0.2);
    z-index: 2;
    position: relative;
    transition: all 0.3s ease;
}

.stepper-step.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--accent-glow);
    transform: scale(1.3);
}

.stepper-step.completed {
    background: #00ff88;
    border-color: #00ff88;
}

.stepper-label {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.5rem;
    white-space: nowrap;
    opacity: 0.5;
    font-weight: 600;
    text-transform: uppercase;
}

.stepper-step.active .stepper-label {
    opacity: 1;
    color: var(--primary-color);
    font-weight: 800;
}

/* Editable Cells */
.editable-cell {
    position: relative;
    padding: 10px !important;
    border-radius: 6px;
    transition: var(--transition);
    cursor: text;
}
.editable-cell:hover {
    background: rgba(255, 255, 255, 0.05);
    outline: 1px dashed rgba(16, 185, 129, 0.4);
}
.editable-cell:focus {
    background: rgba(255, 255, 255, 0.08);
    outline: 1px solid var(--primary-color);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.1);
    color: white;
}
.editable-cell:empty::before {
    content: "Haz clic para editar...";
    color: var(--text-muted);
    opacity: 0.5;
}

/* Animated Banner */
.promo-banner-wrapper { transition: all 0.5s ease; }
.promo-banner {
    width: 100%;
    height: 50px;
    background: linear-gradient(90deg, #10b981, #059669, #10b981);
    background-size: 200% 100%;
    animation: gradientMove 8s ease infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    overflow: hidden;
    position: relative;
    z-index: 1001;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.promo-banner-content {
    display: flex;
    align-items: center;
    gap: 15px;
    animation: fadeInOutPromo 0.6s ease-out;
}

@keyframes fadeInOutPromo {
    0% { opacity: 0; transform: translateY(15px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Mini Toggle for Tables */
.switch-mini {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
}
.switch-mini input { opacity: 0; width: 0; height: 0; }
.slider-mini {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255,255,255,0.1); transition: .4s; border-radius: 20px;
}
.slider-mini:before {
  position: absolute; content: " \; height: 14px; width: 14px; left: 3px; bottom: 3px;
 background-color: white; transition: .4s; border-radius: 50%;
}
input:checked + .slider-mini { background-color: var(--primary-color); }
input:checked + .slider-mini:before { transform: translateX(14px); }
