/* Variables CSS */
:root {
    --primary-color: #4A90E2;
    --primary-light: #7FB3E8;
    --primary-dark: #2E5C8A;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #5BC0DE;
    --dark-color: #2C3E50;
    --light-color: #ECF0F1;
    --bg-color: #F5F7FA;
    --text-color: #2C3E50;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    /* Prevenir zoom en inputs en iOS */
    -webkit-text-size-adjust: 100%;
    /* Scroll suave */
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--text-color);
    padding: 0;
    box-shadow: 0 2px 15px rgba(74, 144, 226, 0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    padding: 15px 0;
    color: white;
}

.nav-brand i {
    color: white;
}

.nav-toggle {
    display: none;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.nav-toggle:focus {
    outline: none;
    box-shadow: none;
}

.nav-toggle:active {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 5px;
    align-items: center;
}

.nav-menu li a {
    color: white;
    text-decoration: none;
    padding: 20px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    font-weight: 500;
    position: relative;
    border-radius: 4px;
}

.nav-menu li a:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.nav-menu li a.active {
    background: rgba(255,255,255,0.3);
    border-bottom: 3px solid white;
}

.nav-menu li a:active {
    background: rgba(255,255,255,0.4);
    transform: translateY(0);
}

.nav-user {
    position: relative;
}

.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    min-width: 200px;
    list-style: none;
}

.nav-user:hover .user-dropdown {
    display: block;
}

.user-dropdown li a {
    color: var(--dark-color);
    padding: 12px 20px;
}

.user-dropdown li a:hover {
    background: var(--light-color);
}

/* Trial Banner */
.trial-banner {
    background: linear-gradient(135deg, var(--warning-color), #ff9800);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    font-weight: 500;
}

.btn-upgrade {
    background: white;
    color: var(--warning-color);
    padding: 6px 15px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: bold;
    transition: var(--transition);
}

.btn-upgrade:hover {
    transform: scale(1.05);
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 20px;
}

/* Auth Pages */
.auth-page {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 450px;
}

.auth-box {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.auth-header h1 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.auth-header p {
    color: #666;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.auth-form input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.auth-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #e0e0e0;
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.features-list {
    margin-top: 20px;
}

.features-list p {
    margin: 8px 0;
    color: #666;
    font-size: 0.9rem;
}

.features-list i {
    color: var(--success-color);
    margin-right: 8px;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    text-decoration: none;
    font-weight: 500;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: #333;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-large {
    padding: 15px 30px;
    font-size: 1.1rem;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.85rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.stat-card i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.stat-card h3 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--dark-color);
}

/* Quick Actions */
.quick-actions {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 30px;
}

.quick-actions h2 {
    margin-bottom: 20px;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* Tables */
table {
    width: 100%;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

table thead {
    background: var(--dark-color);
    color: white;
}

table th, table td {
    padding: 15px;
    text-align: left;
}

table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: var(--transition);
}

table tbody tr:hover {
    background: var(--light-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header .close {
    font-size: 2rem;
    cursor: pointer;
    color: #999;
}

.modal-header .close:hover {
    color: var(--danger-color);
}

.modal-content form {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Responsive Design Mejorado */

/* Tablets y pantallas medianas (768px - 1024px) */
@media (max-width: 1024px) {
    .main-content {
        padding: 0 15px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .action-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    table {
        font-size: 0.9rem;
    }
    
    table th, table td {
        padding: 10px 8px;
    }
}

/* Móviles y tablets pequeñas (max 768px) */
@media (max-width: 768px) {
    /* Navegación móvil */
    .nav-toggle {
        display: block;
    }
    
    .nav-container {
        padding: 0 15px;
    }
    
    .nav-brand {
        font-size: 1.2rem;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--dark-color);
        flex-direction: column;
        padding: 0;
        box-shadow: 0 4px 10px rgba(0,0,0,0.3);
        gap: 0;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-menu li {
        width: 100%;
    }
    
    .nav-menu li a {
        padding: 15px 20px;
        width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .nav-user .user-dropdown {
        position: static;
        box-shadow: none;
        background: rgba(0,0,0,0.2);
        border-radius: 0;
    }
    
    .nav-user:hover .user-dropdown,
    .nav-user.active .user-dropdown {
        display: block;
    }
    
    /* Grids a una columna */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .pricing-grid {
        grid-template-columns: 1fr;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .reportes-grid {
        grid-template-columns: 1fr;
    }
    
    /* Formularios */
    .auth-box {
        padding: 25px 20px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Evita zoom en iOS */
    }
    
    /* Botones más grandes en móvil */
    .btn {
        padding: 12px 20px;
        font-size: 1rem;
        width: 100%;
        justify-content: center;
    }
    
    .btn-small {
        width: auto;
        padding: 8px 12px;
    }
    
    /* Tablas responsive */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
        font-size: 0.85rem;
    }
    
    /* Cards más compactos */
    .stat-card {
        padding: 20px 15px;
    }
    
    .stat-card i {
        font-size: 2rem;
    }
    
    .stat-value {
        font-size: 1.8rem;
    }
    
    /* Modal en móvil */
    .modal-content {
        width: 95%;
        max-height: 90vh;
        margin: 20px;
    }
    
    /* Trial banner */
    .trial-banner {
        flex-direction: column;
        text-align: center;
        gap: 10px;
        padding: 15px;
    }
}

/* Móviles pequeños (max 480px) */
@media (max-width: 480px) {
    /* Tipografía más pequeña */
    body {
        font-size: 14px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    /* Navegación */
    .nav-brand {
        font-size: 1.2rem;
    }
    
    /* Auth pages */
    .auth-box {
        padding: 20px 15px;
    }
    
    .auth-header h1 {
        font-size: 1.5rem;
    }
    
    .auth-header i {
        font-size: 2.5rem;
    }
    
    /* Stats cards */
    .stat-card {
        padding: 15px;
    }
    
    .stat-card i {
        font-size: 1.8rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-card h3 {
        font-size: 0.8rem;
    }
    
    /* Botones */
    .btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    /* Tablas muy compactas */
    table {
        font-size: 0.75rem;
    }
    
    table th, table td {
        padding: 8px 5px;
    }
    
    /* Quick actions */
    .quick-actions {
        padding: 20px 15px;
    }
    
    .quick-actions h2 {
        font-size: 1.2rem;
    }
    
    /* Modales */
    .modal-content {
        padding: 15px;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    /* Inputs más grandes para móvil */
    input, select, textarea {
        min-height: 44px; /* Tamaño mínimo táctil */
    }
}

/* Landscape en móviles */
@media (max-width: 768px) and (orientation: landscape) {
    .auth-page {
        padding: 10px;
    }
    
    .auth-box {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-content {
        max-height: 85vh;
    }
}

/* Tablets en landscape */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .action-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Pantallas grandes (1440px+) */
@media (min-width: 1440px) {
    .main-content {
        max-width: 1600px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .action-buttons {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Footer */
.footer {
    background: var(--dark-color);
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 50px;
}

.footer-content p {
    margin: 5px 0;
}


/* Estilos adicionales para componentes específicos */

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-primary {
    background: #cce5ff;
    color: #004085;
}

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: #666;
}

/* Tooltips */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85rem;
    white-space: nowrap;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin: 20px 0;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition);
}

.pagination button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Cards adicionales */
.info-card {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
}

.info-card h3 {
    margin-bottom: 15px;
    color: var(--dark-color);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.85rem;
    font-weight: bold;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 20px;
}

.tab {
    padding: 12px 24px;
    cursor: pointer;
    border: none;
    background: none;
    color: #666;
    font-size: 1rem;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
}

.tab:hover {
    color: var(--primary-color);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 200px;
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    z-index: 1000;
    right: 0;
    top: 100%;
    margin-top: 5px;
}

.dropdown-content a {
    color: var(--dark-color);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: var(--transition);
}

.dropdown-content a:hover {
    background-color: var(--light-color);
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    color: #999;
}

/* Responsive mejoras adicionales */
@media (max-width: 1024px) {
    .ventas-grid {
        grid-template-columns: 1fr;
    }
    
    .reportes-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .auth-box {
        padding: 20px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-card i {
        font-size: 2rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    table {
        font-size: 0.85rem;
    }
    
    table th, table td {
        padding: 10px 8px;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .trial-banner,
    .footer,
    .btn,
    button {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .main-content {
        margin: 0;
        padding: 0;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease;
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Focus states para accesibilidad */
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Excepciones para botones de navegación */
.nav-toggle:focus,
.nav-toggle:active {
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

button:focus:not(:focus-visible) {
    outline: none;
}

button::-moz-focus-inner {
    border: 0;
}

/* Disabled states */
button:disabled,
input:disabled,
select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Selection */
::selection {
    background: var(--primary-color);
    color: white;
}

::-moz-selection {
    background: var(--primary-color);
    color: white;
}
