/* =============================================
   VARIABLES Y CONFIGURACIÓN GLOBAL
   ============================================= */
:root {
    /* Colors - Professional Palette */
    --primary-color: #4f46e5;
    /* Indigo 600 */
    --primary-hover: #4338ca;
    /* Indigo 700 */
    --secondary-color: #64748b;
    /* Slate 500 */
    --success-color: #10b981;
    /* Emerald 500 */
    --danger-color: #ef4444;
    /* Red 500 */
    --warning-color: #f59e0b;
    /* Amber 500 */
    --info-color: #3b82f6;
    /* Blue 500 */

    /* Background Colors */
    --bg-dark: #0f172a;
    /* Slate 900 */
    --bg-color: #0f172a;
    --bg-card: #1e293b;
    /* Slate 800 */
    --card-bg: #1e293b;
    --bg-sidebar: #111827;
    /* Gray 900 */
    --sidebar-bg: #111827;

    /* Text Colors */
    --text-primary: #f8fafc;
    /* Slate 50 */
    --text-color: #f8fafc;
    --text-secondary: #cbd5e1;
    /* Slate 300 */
    --text-muted: #94a3b8;
    /* Slate 400 */

    /* Border and Layout */
    --border-color: #334155;
    /* Slate 700 */
    --sidebar-width: 260px;
    --header-height: 70px;
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow: hidden;
}

/* Hidden scrollbar for cash count form */
#cash-count-form::-webkit-scrollbar {
    display: none;
}

/* Hidden scrollbar for all modals */
.modal .form-card::-webkit-scrollbar {
    display: none;
}

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
}

.login-card {
    background-color: var(--bg-card);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.5s ease;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

.login-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* =============================================
   APP LAYOUT
   ============================================= */
.app-layout {
    display: none;
    min-height: 100vh;
}

.app-layout.active {
    display: flex;
}

#apertura-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 50;
    transition: width var(--transition-speed);
    overflow: visible;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    background-color: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
    gap: 1rem;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.sidebar-header i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.sidebar-header span {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.sidebar-menu {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding-left: 0.75rem;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.nav-item:hover {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    color: white;
    border-color: rgba(79, 70, 229, 0.2);
}

/* Collapsed Sidebar Styles removed */

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: rgba(255, 255, 255, 0.03);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1.25rem 1.5rem;
    background: var(--bg-dark);
    max-width: 1600px;
    height: 100vh;
    overflow-y: auto;
    box-sizing: border-box;
}

.module {
    display: none;
}

.module.active,
.module:first-child {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.page-title h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* =============================================
   CARDS & STATS
   ============================================= */
.form-card {
    background-color: var(--bg-card);
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background-color: var(--bg-card);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary-color);
    box-shadow: 0 12px 24px -10px rgba(79, 70, 229, 0.3);
}

.stat-info h3 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.stat-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.stat-icon {
    padding: 0.75rem;
    border-radius: 0.75rem;
    font-size: 1.75rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
}

.stat-icon.blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.stat-icon.green {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.stat-icon.purple {
    background: linear-gradient(135deg, #a78bfa, #8b5cf6);
}

.stat-icon.orange {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* =============================================
   QUICK ACTIONS
   ============================================= */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.quick-action-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-primary);
}

.quick-action-btn i {
    font-size: 2rem;
    color: var(--primary-color);
}

.quick-action-btn span {
    font-size: 0.875rem;
    font-weight: 600;
}

.quick-action-btn:hover {
    background: rgba(79, 70, 229, 0.1);
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.2);
}

.quick-action-btn:hover i {
    transform: scale(1.1);
}

/* =============================================
   SECTION HEADERS
   ============================================= */
.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.section-header i {
    color: var(--primary-color);
    font-size: 1.25rem;
}

.section-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* =============================================
   FORMS
   ============================================= */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: block;
}

.form-control {
    width: 100%;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
    transform: translateY(-1px);
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), #7c3aed);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-block {
    width: 100%;
}

/* =============================================
   BADGES
   ============================================= */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
}

.badge.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    min-width: 300px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
    border-left: 4px solid transparent;
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.info {
    border-left-color: var(--info-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.toast-icon {
    font-size: 1.25rem;
}

.toast.success .toast-icon {
    color: var(--success-color);
}

.toast.error .toast-icon {
    color: var(--danger-color);
}

.toast-content h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.1rem;
}

.toast-content p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* =============================================
   MODALS
   ============================================= */
.modal {
    display: flex;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal .form-card {
    animation: slideUp 0.3s ease;
}

/* =============================================
   TABLE
   ============================================= */
.table-container {
    background-color: var(--bg-card);
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* =============================================
   TABLE
   ============================================= */
.table-container {
    background-color: var(--bg-card);
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: rgba(0, 0, 0, 0.3);
}

th {
    text-align: left;
    padding: 1rem 1.25rem;
    font-size: 0.8125rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

td {
    padding: 1.125rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

tbody tr {
    transition: background 0.2s;
}

tbody tr:hover {
    background: rgba(139, 92, 246, 0.05);
}

/* Role Badges */
.role-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
    text-transform: capitalize;
}

.role-badge.admin {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.role-badge.banking {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.role-badge.commercial {
    background: rgba(167, 139, 250, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(167, 139, 250, 0.3);
}

/* Status Badges */
.status-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.status-badge.active {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.status-badge.inactive {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Stock Numbers */
.stock-value {
    font-weight: 600;
}

.stock-value.high {
    color: #34d399;
}

.stock-value.medium {
    color: #fbbf24;
}

.stock-value.low {
    color: #f87171;
}

/* Action Buttons in Tables */
.table-action-btn {
    padding: 0.5rem;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 0.375rem;
    color: #a78bfa;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.table-action-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    transform: translateY(-1px);
}

/* Primary Action Buttons (NUEVO X) */
.primary-action-btn {
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.primary-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
}

.primary-action-btn i {
    font-size: 1rem;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* =============================================
   PRINT STYLES
   ============================================= */
@media print {
    body {
        background: white;
        color: black;
    }

    .sidebar,
    .dashboard-nav,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin: 0;
        padding: 0;
    }

    .modal {
        position: static;
        background: white;
    }
}