/* ISP Dashboard - Estilos Principales */

:root {
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 60px;
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --dark-color: #212529;
    --light-color: #f8f9fa;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f6fa;
    min-height: 100vh;
}

/* Wrapper */
.wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar Base */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh !important;
    max-height: 100vh !important;
    position: fixed !important;
    top: 0;
    left: 0;
    z-index: 2000;
    background: #1a1c2c;
    color: #fff;
    transition: width 0.3s ease;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

/* Scroll Wrapper - contiene todo */
.sidebar-content {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    max-height: 100vh !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

/* Sidebar Header - fijo arriba */
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: #1a1c2c;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
}

.sidebar-header h3 {
    font-size: 1.3rem;
    margin-bottom: 5px;
    white-space: nowrap;
}

.sidebar-header h3 i {
    margin-right: 10px;
    color: var(--primary-color);
}

.sidebar.collapsed .sidebar-header h3 span,
.sidebar.collapsed .sidebar-header small {
    display: none;
}

/* Sidebar Navigation - AQUÍ está el scroll */
.sidebar-nav {
    list-style: none !important;
    padding: 15px 0 !important;
    margin: 0 !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) rgba(0, 0, 0, 0.3);
}

.sidebar-nav::-webkit-scrollbar {
    width: 8px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background-color: rgba(0, 0, 0, 0.3);
}

.sidebar-nav li {
    margin: 2px 10px;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sidebar-nav li a i {
    font-size: 1.2rem;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.sidebar-nav li a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-nav li.active a {
    background: var(--primary-color);
    color: #fff;
}

.sidebar-nav .nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 15px 15px;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-nav li a span {
    display: none;
}

/* Sidebar Footer - fijo abajo */
.sidebar-footer {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: #151725;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
}

.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-footer .user-info i {
    font-size: 2rem;
}

.sidebar-footer .user-info strong {
    display: block;
    font-size: 0.9rem;
}

.sidebar-footer .user-info small {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
}

.sidebar.collapsed .sidebar-footer .user-info div {
    display: none;
}

/* Main Content */
#content {
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed+#content {
    width: calc(100% - var(--sidebar-collapsed-width));
    margin-left: var(--sidebar-collapsed-width);
}

/* Navbar */
.navbar {
    padding: 10px 20px;
}

#sidebarCollapse {
    border: none;
    padding: 8px 12px;
}

/* Main Content Area */
.main-content {
    padding: 20px;
    flex: 1;
}

/* Cards */
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: none;
    transition: transform 0.2s ease;
}

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

.stat-card .stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
}

.stat-card .stat-icon.bg-primary {
    background: linear-gradient(45deg, #0d6efd, #4d9fff);
}

.stat-card .stat-icon.bg-success {
    background: linear-gradient(45deg, #198754, #28a745);
}

.stat-card .stat-icon.bg-warning {
    background: linear-gradient(45deg, #ffc107, #ffca2c);
}

.stat-card .stat-icon.bg-danger {
    background: linear-gradient(45deg, #dc3545, #e35d6a);
}

.stat-card .stat-icon.bg-info {
    background: linear-gradient(45deg, #0dcaf0, #39d5f4);
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark-color);
}

.stat-card .stat-label {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

/* Tables */
.table-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.table-card .card-header {
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 15px 20px;
}

.table-card .card-header h5 {
    margin: 0;
    font-weight: 600;
}

.table-card .card-body {
    padding: 0;
}

.table-card .table {
    margin: 0;
}

.table-card .table th {
    background: #f8f9fa;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    padding: 12px 15px;
}

.table-card .table td {
    padding: 12px 15px;
    vertical-align: middle;
}

/* Status Indicators */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.status-indicator.online {
    background-color: var(--success-color);
}

.status-indicator.offline {
    background-color: var(--danger-color);
}

.status-indicator.warning {
    background-color: var(--warning-color);
}

/* Signal Strength */
.signal-bar {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
}

.signal-bar span {
    width: 4px;
    background: #ddd;
    border-radius: 1px;
}

.signal-bar span:nth-child(1) {
    height: 4px;
}

.signal-bar span:nth-child(2) {
    height: 8px;
}

.signal-bar span:nth-child(3) {
    height: 12px;
}

.signal-bar span:nth-child(4) {
    height: 16px;
}

.signal-bar.excellent span {
    background: var(--success-color);
}

.signal-bar.good span:nth-child(-n+3) {
    background: var(--success-color);
}

.signal-bar.fair span:nth-child(-n+2) {
    background: var(--warning-color);
}

.signal-bar.poor span:nth-child(1) {
    background: var(--danger-color);
}

/* Forms */
.form-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 25px;
}

.form-label {
    font-weight: 500;
    color: var(--dark-color);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* Buttons */
.btn {
    border-radius: 6px;
    padding: 8px 16px;
    font-weight: 500;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.85rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Terminal */
.terminal-container {
    background: #1e1e1e;
    border-radius: 10px;
    overflow: hidden;
}

.terminal-header {
    background: #2d2d2d;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.terminal-header .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.terminal-header .dot.red {
    background: #ff5f56;
}

.terminal-header .dot.yellow {
    background: #ffbd2e;
}

.terminal-header .dot.green {
    background: #27c93f;
}

.terminal-header .title {
    margin-left: 10px;
    color: #999;
    font-size: 0.85rem;
}

.terminal-body {
    padding: 15px;
    min-height: 400px;
    max-height: 500px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    color: #00ff00;
}

.terminal-body .output {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.terminal-input {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: #252525;
    border-top: 1px solid #333;
}

.terminal-input .prompt {
    color: #00ff00;
    margin-right: 10px;
}

.terminal-input input {
    flex: 1;
    background: transparent;
    border: none;
    color: #00ff00;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    outline: none;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }

    .sidebar.active {
        margin-left: 0;
    }

    #content {
        width: 100%;
        margin-left: 0;
    }

    .stat-card {
        margin-bottom: 15px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Loading Spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1c2c 0%, #2d3148 100%);
}

.login-card {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-card .logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-card .logo i {
    font-size: 3rem;
    color: var(--primary-color);
}

.login-card .logo h2 {
    margin-top: 10px;
    color: var(--dark-color);
}

/* Tooltips para tabla */
.table [data-bs-toggle="tooltip"] {
    cursor: help;
}

/* Power level colors */
.power-excellent {
    color: var(--success-color);
    font-weight: 600;
}

.power-good {
    color: #28a745;
}

.power-fair {
    color: var(--warning-color);
}

.power-poor {
    color: var(--danger-color);
    font-weight: 600;
}

/* Quick actions */
.quick-actions {
    display: flex;
    gap: 5px;
}

.quick-actions .btn {
    padding: 4px 8px;
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header h4 {
    margin: 0;
    font-weight: 600;
}

/* Breadcrumb */
.breadcrumb-container {
    background: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--secondary-color);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h5 {
    margin-bottom: 10px;
}