/**
 * BitNet Facturas - Dashboard Custom Styles
 * Estilos personalizados sobre Bootstrap 5
 */

/* ==================== VARIABLES CSS ==================== */
:root {
    /* Colores principales */
    --primary: #0066cc;
    --primary-dark: #0052a3;
    --secondary: #6c757d;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    
    /* Sidebar */
    --bg-sidebar: #1a1a2e;
    --bg-sidebar-hover: #16213e;
    --text-sidebar: #e2e8f0;
    --text-muted-sidebar: #94a3b8;
    
    /* Layout */
    --bg-body: #f0f4f8;
    --sidebar-width: 260px;
    --topbar-height: 60px;
    
    /* Sombras */
    --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --card-shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.12);
}

/* ==================== LAYOUT GENERAL ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-body);
    color: #333;
    overflow-x: hidden;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--bg-sidebar);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--bg-sidebar-hover);
    border-radius: 3px;
}

/* Logo */
.sidebar-logo {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo-icon {
    width: 86px;
    height: 86px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo-img {
    width: 86px;
    height: 86px;
    object-fit: contain;
}

.sidebar-logo-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-sidebar);
}

/* Usuario */
.sidebar-user {
    padding: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-sidebar);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-account-link {
    font-size: 0.8rem;
    color: var(--text-muted-sidebar);
    text-decoration: none;
    display: flex;
    align-items: center;
    margin-top: 0.25rem;
    transition: color 0.2s ease;
}

.sidebar-user-account-link:hover {
    color: var(--primary);
    text-decoration: none;
}

.sidebar-user-account-link i {
    font-size: 0.85rem;
}

/* Navegación */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-nav-section {
    margin-bottom: 1.5rem;
}

.sidebar-nav-title {
    padding: 0.5rem 1.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted-sidebar);
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--text-sidebar);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav-link:hover {
    background-color: var(--bg-sidebar-hover);
    color: white;
}

.sidebar-nav-link.active {
    background-color: var(--primary);
    color: white;
    border-left-color: white;
    font-weight: 500;
}

.sidebar-nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-nav-sublink {
    padding-left: 2.75rem;
    font-size: 0.875rem;
    opacity: 0.85;
}

.sidebar-nav-sublink.active {
    opacity: 1;
}

.sidebar-nav-link-badge {
    margin-left: auto;
    background-color: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: 600;
}

/* Logout */
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem;
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-sidebar);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-logout-btn:hover {
    background-color: var(--danger);
    border-color: var(--danger);
    color: white;
}

/* ==================== TOPBAR ==================== */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background-color: white;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 999;
    transition: left 0.3s ease;
}

.topbar-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.topbar-alert-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #666;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.topbar-alert-btn:hover {
    background-color: var(--bg-body);
    color: var(--primary);
}

.topbar-alert-badge {
    position: absolute;
    top: 0;
    right: 0;
    background-color: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.topbar-user-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.topbar-user-section:hover {
    background-color: var(--bg-body);
}

.topbar-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.topbar-user-section:hover .topbar-user-avatar {
    transform: scale(1.05);
}

.topbar-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
}

.topbar-user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    line-height: 1.2;
}

.topbar-account-link {
    font-size: 0.8rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.topbar-account-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Hamburger Menu (Mobile) */
.topbar-hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #333;
    cursor: pointer;
    padding: 0.5rem;
}

/* ==================== CONTENIDO PRINCIPAL ==================== */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 2rem;
    min-height: calc(100vh - var(--topbar-height));
    transition: margin-left 0.3s ease;
}

/* ==================== CARDS ESTADÍSTICOS ==================== */
.stat-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    border-left: 4px solid var(--primary);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}

.stat-card.success {
    border-left-color: var(--success);
}

.stat-card.warning {
    border-left-color: var(--warning);
}

.stat-card.danger {
    border-left-color: var(--danger);
}

.stat-card.info {
    border-left-color: var(--info);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.stat-card-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
}

.stat-card-icon {
    font-size: 1.5rem;
    color: var(--primary);
    opacity: 0.3;
}

.stat-card.success .stat-card-icon {
    color: var(--success);
}

.stat-card.warning .stat-card-icon {
    color: var(--warning);
}

.stat-card.danger .stat-card-icon {
    color: var(--danger);
}

.stat-card.info .stat-card-icon {
    color: var(--info);
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.25rem;
}

.stat-card-description {
    font-size: 0.85rem;
    color: #999;
}

/* ==================== TABLAS ==================== */
.table-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
}

.table-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.table-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.table-responsive {
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
}

.custom-table thead {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.custom-table thead th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.custom-table tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

.custom-table tbody tr:hover {
    background-color: #f8f9fa;
}

.custom-table tbody td {
    padding: 1rem;
    font-size: 0.9rem;
    color: #666;
}

/* Badges de estado */
.badge-status {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-status.pendiente {
    background-color: #fff3cd;
    color: #856404;
}

.badge-status.procesando {
    background-color: #d1ecf1;
    color: #0c5460;
}

.badge-status.procesado {
    background-color: #d4edda;
    color: #155724;
}

.badge-status.error {
    background-color: #f8d7da;
    color: #721c24;
}

/* ==================== ÁREA DE UPLOAD ==================== */
.upload-area {
    border: 2px dashed var(--primary);
    border-radius: 8px;
    background-color: #f0f8ff;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover,
.upload-area.dragover {
    background-color: #e6f3ff;
    border-color: var(--primary-dark);
    transform: scale(1.01);
}

.upload-area-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.upload-area-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.upload-area-description {
    font-size: 0.9rem;
    color: #666;
}

.upload-area input[type="file"] {
    display: none;
}

/* ==================== FORMULARIOS ==================== */
.form-label {
    font-weight: 500;
    color: #333;
    margin-bottom: 0.5rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 102, 204, 0.25);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    padding: 0.65rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #003d7a);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ==================== LOGIN PAGE ==================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-sidebar) 0%, var(--primary-dark) 100%);
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo-icon {
    width: 150px;
    height: 150px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.login-logo-img {
    width: 100px;
    height: 100px;
    object-fit: contain;    border-radius: 50%;}

.login-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: #333;
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    font-size: 0.95rem;
    color: #666;
    text-align: center;
    margin-bottom: 2rem;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form .btn-primary {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* ==================== CAMBIO DE CONTRASEÑA ==================== */
.change-password-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    padding: 1rem;
}

.change-password-card {
    width: 100%;
    max-width: 480px;
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: var(--card-shadow);
}

/* ==================== PAGINACIÓN ==================== */
.pagination {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.pagination .page-item .page-link {
    color: var(--primary);
    border-color: #dee2e6;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
}

.pagination .page-item .page-link:hover {
    background-color: var(--bg-body);
}

/* ==================== ALERTAS ==================== */
.alert-item {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--card-shadow);
    border-left: 4px solid var(--info);
    transition: all 0.2s ease;
    cursor: pointer;
}

.alert-item:hover {
    box-shadow: var(--card-shadow-hover);
}

.alert-item.unread {
    background-color: #f0f8ff;
    font-weight: 500;
}

.alert-item.warning {
    border-left-color: var(--warning);
}

.alert-item.error {
    border-left-color: var(--danger);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .topbar {
        left: 0;
    }
    
    .topbar-hamburger {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }
    
    .topbar-title {
        font-size: 1.25rem;
    }
    
    .stat-card-value {
        font-size: 1.5rem;
    }
    
    .table-card {
        padding: 1rem;
    }
    
    .custom-table thead th,
    .custom-table tbody td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .upload-area-icon {
        font-size: 2.5rem;
    }
}

@media (max-width: 576px) {
    .topbar {
        padding: 0 1rem;
    }
    
    .topbar-actions {
        gap: 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .login-card,
    .change-password-card {
        padding: 2rem 1.5rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
}

/* ==================== UTILIDADES ==================== */
.text-primary {
    color: var(--primary) !important;
}

.bg-primary {
    background-color: var(--primary) !important;
}

.border-primary {
    border-color: var(--primary) !important;
}

.shadow-card {
    box-shadow: var(--card-shadow);
}

.cursor-pointer {
    cursor: pointer;
}

/* ==================== LOADING SPINNER ==================== */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-border-custom {
    width: 3rem;
    height: 3rem;
    border: 0.3rem solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== MODAL MI CUENTA ==================== */
#accountModal .modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

#accountModal .modal-header {
    padding: 1.5rem 1.5rem 1rem 1.5rem;
}

#accountModal .modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
}

#accountModal .modal-body {
    padding: 1.5rem;
}

.account-info-section {
    background-color: var(--bg-body);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.account-info-item {
    margin-bottom: 1.25rem;
}

.account-info-item:last-child {
    margin-bottom: 0;
}

.account-info-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted-sidebar);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    display: block;
}

.account-info-value {
    font-size: 1rem;
    font-weight: 500;
    color: #333;
}

#cancelSubscriptionBtn {
    font-weight: 600;
    padding: 0.75rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

#cancelSubscriptionBtn:hover {
    background-color: #bb2d3b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

#cancelSubscriptionBtn:disabled {
    background-color: #6c757d;
    border-color: #6c757d;
    transform: none;
}
