/**
 * 🎨 ESTILOS - FAMILLE LG WEB
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: white;
}

/* ============================================================
   HEADER
   ============================================================ */

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

header .tagline {
    font-size: 1rem;
    opacity: 0.95;
    margin-bottom: 15px;
}

.status {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.status-indicator {
    font-size: 0.8rem;
    margin-right: 5px;
}

.status-indicator.status-connected {
    color: #4caf50;
}

.status-indicator.status-error {
    color: #f44336;
}

.status-indicator.status-warning {
    color: #ff9800;
}

.status-indicator.status-loading {
    color: #2196f3;
}

/* ============================================================
   NAVBAR
   ============================================================ */

.navbar {
    background: #f5f5f5;
    padding: 15px 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    border-bottom: 3px solid #667eea;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.nav-btn {
    padding: 10px 20px;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.nav-btn:active {
    transform: translateY(0);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

main {
    flex: 1;
    padding: 40px 20px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* ============================================================
   LOADING
   ============================================================ */

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.loading i {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 20px;
}

.loading p {
    font-size: 1.2rem;
    color: #666;
}

/* ============================================================
   DASHBOARD
   ============================================================ */

.dashboard {
    animation: fadeIn 0.3s ease-in;
}

.dashboard h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    padding: 25px;
    border-radius: 12px;
    color: white;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.stat-card.compras {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-card.ventas {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-card.ganancia {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-card.utilidad {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.stat-subtext {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* ============================================================
   TABLAS
   ============================================================ */

.tabla-responsive {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
}

table tbody tr:hover {
    background: #f9f9f9;
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================================
   CAJAS DE INFORMACIÓN
   ============================================================ */

.info-box {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    border-left: 4px solid #4caf50;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.1);
}

.info-box p {
    margin-bottom: 8px;
    color: #2e7d32;
}

.info-box p:last-child {
    margin-bottom: 0;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* ============================================================
   CAJAS DE ERROR
   ============================================================ */

.error-box {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-left: 4px solid #f44336;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.1);
}

.error-box h3 {
    color: #c62828;
    margin-bottom: 10px;
}

.error-box p {
    color: #d32f2f;
    margin-bottom: 15px;
}

.error-box button {
    background: #f44336;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
}

.error-box button:hover {
    background: #d32f2f;
}

/* ============================================================
   FOOTER
   ============================================================ */

footer {
    background: #f5f5f5;
    padding: 30px 20px;
    text-align: center;
    border-top: 1px solid #ddd;
    color: #666;
    font-size: 0.9rem;
    margin-top: auto;
}

footer p {
    margin-bottom: 8px;
}

footer p:last-child {
    margin-bottom: 0;
    opacity: 0.7;
}

/* ============================================================
   RESPONSIVO
   ============================================================ */

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .navbar {
        gap: 5px;
    }

    .nav-btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    table {
        font-size: 0.9rem;
    }

    table th, table td {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 20px 10px;
    }

    header h1 {
        font-size: 1.4rem;
    }

    main {
        padding: 20px 10px;
    }

    .navbar {
        flex-direction: column;
    }

    .nav-btn {
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   ANIMACIONES
   ============================================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.fa-spin {
    animation: spin 1s linear infinite;
}
