/* App in Sight - Custom Styles */

:root {
    --bs-body-bg: #0d1b2a;
    --bs-body-color: #d1d5db;
    
    /* Override Bootstrap blue colors to green */
    --bs-primary: #10b981;
    --bs-primary-rgb: 16, 185, 129;
    --bs-info: #10b981;
    --bs-info-rgb: 16, 185, 129;
    --bs-link-color: #10b981;
    --bs-link-hover-color: #34d399;
}

/* Override Bootstrap primary button to green */
.btn-primary {
    background-color: #10b981 !important;
    border-color: #10b981 !important;
    color: #fff !important;
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: #059669 !important;
    border-color: #059669 !important;
    color: #fff !important;
}

.btn-primary:disabled {
    background-color: #10b981 !important;
    border-color: #10b981 !important;
    opacity: 0.65;
}

/* Outline primary button */
.btn-outline-primary {
    color: #10b981 !important;
    border-color: #10b981 !important;
}

.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active {
    background-color: #10b981 !important;
    border-color: #10b981 !important;
    color: #fff !important;
}

/* Info button to green */
.btn-info {
    background-color: #10b981 !important;
    border-color: #10b981 !important;
    color: #fff !important;
}

.btn-info:hover, .btn-info:focus, .btn-info:active {
    background-color: #059669 !important;
    border-color: #059669 !important;
    color: #fff !important;
}

.btn-outline-info {
    color: #10b981 !important;
    border-color: #10b981 !important;
}

.btn-outline-info:hover, .btn-outline-info:focus, .btn-outline-info:active {
    background-color: #10b981 !important;
    border-color: #10b981 !important;
    color: #fff !important;
}

/* Text colors */
.text-primary {
    color: #10b981 !important;
}

.text-info {
    color: #10b981 !important;
}

/* Background colors */
.bg-primary {
    background-color: #10b981 !important;
}

.bg-info {
    background-color: #10b981 !important;
}

/* Border colors */
.border-primary {
    border-color: #10b981 !important;
}

.border-info {
    border-color: #10b981 !important;
}

/* Links */
a {
    color: #10b981;
}

a:hover {
    color: #34d399;
}

/* Nav links and tabs */
.nav-link.active {
    color: #10b981 !important;
    border-color: #10b981 !important;
}

.nav-pills .nav-link.active {
    background-color: #10b981 !important;
}

.nav-tabs .nav-link.active {
    border-bottom-color: #10b981 !important;
}

/* Pagination */
.page-link {
    color: #10b981;
}

.page-item.active .page-link {
    background-color: #10b981;
    border-color: #10b981;
}

/* Form focus states */
.form-control:focus, .form-select:focus {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 0.25rem rgba(16, 185, 129, 0.25) !important;
}

.form-check-input:checked {
    background-color: #10b981;
    border-color: #10b981;
}

/* Progress bars */
.progress-bar {
    background-color: #10b981;
}

/* Alerts info */
.alert-info {
    background-color: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
    color: #34d399;
}

.alert-primary {
    background-color: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
    color: #34d399;
}

/* Mascote App in Sight */
.mascote {
    display: inline-block;
    vertical-align: middle;
    object-fit: contain;
}

.mascote-xs {
    width: 20px;
    height: 20px;
}

.mascote-sm {
    width: 28px;
    height: 28px;
}

.mascote-md {
    width: 48px;
    height: 48px;
}

.mascote-lg {
    width: 80px;
    height: 80px;
}

.mascote-xl {
    width: 120px;
    height: 120px;
}

.mascote-navbar {
    width: 28px;
    height: 28px;
    margin-right: 0.5rem;
    filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.5));
}

.mascote-login {
    width: 120px;
    height: 120px;
    filter: drop-shadow(0 0 15px rgba(16, 185, 129, 0.6));
    animation: mascote-pulse 3s ease-in-out infinite;
}

.mascote-card {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.4));
}

.mascote-inline {
    width: 24px;
    height: 24px;
    margin-right: 0.5rem;
}

@keyframes mascote-pulse {
    0%, 100% { 
        transform: scale(1);
        filter: drop-shadow(0 0 15px rgba(16, 185, 129, 0.6));
    }
    50% { 
        transform: scale(1.05);
        filter: drop-shadow(0 0 25px rgba(16, 185, 129, 0.8));
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: linear-gradient(180deg, #0a1525 0%, #0d1b2a 30%, #142840 70%, #1a365d 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

.navbar {
    box-shadow: 0 2px 8px rgba(0,0,0,.4);
    background: linear-gradient(90deg, #081220 0%, #0a1628 50%, #0d1b30 100%) !important;
    border-bottom: 1px solid rgba(20, 40, 64, 0.5);
}

.card {
    background: linear-gradient(145deg, #131f30 0%, #162538 50%, #1a2c42 100%);
    border: 1px solid rgba(40, 70, 110, 0.4);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5), 0 4px 8px rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
    border-color: rgba(50, 90, 140, 0.5);
}

/* Layout 5 colunas para cards de RPA em telas grandes */
@media (min-width: 1400px) {
    .col-xxl-5-cols {
        flex: 0 0 20%;
        max-width: 20%;
    }
}

/* Cards de RPA - Destaque especial com sombra intensa */
.rpa-card {
    background: linear-gradient(145deg, #0f1a28 0%, #142333 50%, #182a40 100%) !important;
    border: 1px solid rgba(45, 80, 130, 0.4) !important;
    box-shadow: 
        0 8px 16px rgba(0, 0, 0, 0.5),
        0 4px 8px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
}

.rpa-card:hover {
    border-color: #10b981 !important;
    box-shadow: 
        0 12px 24px rgba(0, 0, 0, 0.6),
        0 8px 16px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(16, 185, 129, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    transform: translateY(-4px);
}

.table-dark {
    --bs-table-bg: #0f1a28;
    --bs-table-striped-bg: #142333;
    --bs-table-hover-bg: #1a2c42;
}

.badge-online {
    background-color: #28a745;
}

.badge-offline {
    background-color: #dc3545;
}

.badge-silent {
    background-color: #ffc107;
    color: #000;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.text-truncate {
    max-width: 300px;
}

.modal-content {
    background: linear-gradient(145deg, #0f1a28 0%, #142538 100%);
    border-color: rgba(45, 80, 130, 0.4);
}

.form-control, .form-select {
    background-color: #0d1520;
    border-color: rgba(45, 80, 130, 0.4);
    color: #d1d5db;
}

.form-control:focus, .form-select:focus {
    background-color: #0f1925;
    border-color: #10b981;
    color: #d1d5db;
}

.badge-DEBUG { background-color: #6c757d; }
.badge-INFO { background-color: #10b981; }
.badge-WARN { background-color: #ffc107; color: #000; }
.badge-ERROR { background-color: #dc3545; }

/* Auto-refresh indicator */
.auto-refresh-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* RPA Screenshot Preview */
.rpa-screenshot-preview {
    border-top: 1px solid #30363d;
    padding-top: 0.75rem;
}

.screenshot-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #0a1420;
    border: 2px dashed rgba(45, 80, 130, 0.4);
    border-radius: 6px;
    padding: 1rem;
    min-height: 100px;
    max-height: 100px;
    overflow: hidden;
}

.screenshot-placeholder i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.screenshot-placeholder small {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Screenshot image when available (backend will add this later) */
.rpa-screenshot-preview img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #404854;
    transition: transform 0.2s;
}

.rpa-screenshot-preview img:hover {
    transform: scale(1.02);
    cursor: pointer;
}

/* Card Economia - Destaque Principal */
.card-economia {
    background: linear-gradient(135deg, #064e3b 0%, #047857 50%, #059669 100%) !important;
    border: 2px solid #10b981 !important;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3), 0 4px 6px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.card-economia::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.card-economia:hover {
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.5), 0 8px 12px rgba(0, 0, 0, 0.5);
    transform: translateY(-4px);
}

.card-economia .card-body {
    position: relative;
    z-index: 1;
}

.card-economia .card-title {
    color: #ecfdf5;
    font-weight: 600;
    font-size: 0.95rem;
}

.economia-valor {
    color: #d1fae5 !important;
    font-weight: 700;
    font-size: 1.75rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Footer fixo */
.footer-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, #081220 0%, #0a1628 50%, #0d1b30 100%);
    border-top: 1px solid rgba(30, 60, 100, 0.3);
    padding: 0.5rem 0;
    text-align: center;
    font-size: 0.8rem;
    color: #6b7280;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.footer-fixed a {
    color: #10b981;
    text-decoration: none;
}

.footer-fixed a:hover {
    color: #34d399;
    text-decoration: underline;
}

.footer-logo {
    height: 24px;
    width: auto;
    vertical-align: middle;
    margin-right: 4px;
}

/* Espaço para o footer não sobrepor conteúdo */
body {
    padding-bottom: 50px;
}

/* Global Loading Overlay */
.global-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 21, 37, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.global-loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    position: relative;
}

.loading-spinner::before,
.loading-spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}

.loading-spinner::before {
    width: 100%;
    height: 100%;
    border: 3px solid rgba(16, 185, 129, 0.2);
}

.loading-spinner::after {
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top-color: #10b981;
    animation: loading-spin 0.8s ease-in-out infinite;
}

@keyframes loading-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 16px;
    color: #d1d5db;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.loading-dots::after {
    content: '';
    animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* ========================================
   MODO MINIATURA - Dashboard TV Display
   Visual: Robô com Balão de Logs
   ======================================== */

/* Container em modo miniatura */
.miniature-mode .rpa-card-wrapper {
    flex: 0 0 auto !important;
    max-width: none !important;
    width: auto !important;
}

/* Esconder card original no modo miniatura */
.miniature-mode .rpa-card {
    display: none !important;
}

/* Container do robô miniatura */
.robot-miniature {
    position: relative;
    width: 200px;
    height: 320px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.robot-miniature:hover {
    transform: scale(1.05);
    z-index: 10;
}

/* Wrapper da imagem do robô */
.robot-miniature .robot-image-wrapper {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    width: 140px;
    height: 190px;
}

/* Imagem do robô */
.robot-miniature .robot-image {
    width: 140px;
    height: 190px;
    display: block;
    filter: hue-rotate(140deg) saturate(0.7);
    object-fit: contain;
}

/* Indicador de status nos olhos do robô */
.robot-miniature .robot-eyes-overlay {
    position: absolute;
    top: 32%;
    left: 57%;
    transform: translateX(-50%);
    width: 42px;
    height: 18px;
    display: flex;
    justify-content: space-between;
    z-index: 2;
    pointer-events: none;
}

.robot-miniature .robot-eye {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor, 0 0 20px currentColor;
    animation: eyeGlow 2s ease-in-out infinite;
}

.robot-miniature[data-status="online"] .robot-eye {
    background: #00ff00;
    color: #00ff00;
}

.robot-miniature[data-status="offline"] .robot-eye {
    background: #ff4444;
    color: #ff4444;
    animation: eyeGlowRed 1.5s ease-in-out infinite;
}

@keyframes eyeGlow {
    0%, 100% { opacity: 0.8; box-shadow: 0 0 8px currentColor; }
    50% { opacity: 1; box-shadow: 0 0 15px currentColor, 0 0 25px currentColor; }
}

@keyframes eyeGlowRed {
    0%, 100% { opacity: 0.7; box-shadow: 0 0 8px currentColor; }
    50% { opacity: 1; box-shadow: 0 0 12px currentColor, 0 0 20px currentColor; }
}

/* Badge de status abaixo do robô */
.robot-miniature .robot-status-badge {
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    padding: 4px 12px;
    border-radius: 10px;
    z-index: 4;
    font-weight: 600;
}

/* Balão de fala com logs */
.robot-miniature .speech-balloon {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 180px;
    height: 140px;
    background: linear-gradient(145deg, #2a5a7a 0%, #1a3a4a 100%);
    border-radius: 15px;
    padding: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 3;
}

/* Ponteiro do balão */
.robot-miniature .speech-balloon::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 16px solid #1a3a4a;
}

/* Header do balão com nome/ID */
.robot-miniature .balloon-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    margin-bottom: 5px;
}

.robot-miniature .balloon-header .robot-name {
    font-size: 11px;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.robot-miniature .balloon-header .robot-id {
    font-size: 9px;
    color: rgba(255,255,255,0.7);
    background: rgba(0,0,0,0.2);
    padding: 1px 5px;
    border-radius: 3px;
}

/* Console de logs dentro do balão */
.robot-miniature .balloon-console {
    height: 95px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 9px;
    line-height: 1.3;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 6px;
    padding: 5px;
    color: #00ff00;
}

.robot-miniature .balloon-console::-webkit-scrollbar {
    width: 4px;
}

.robot-miniature .balloon-console::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
    border-radius: 2px;
}

.robot-miniature .balloon-console::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
}

.robot-miniature .balloon-console .log-line {
    margin-bottom: 2px;
    word-break: break-word;
}

.robot-miniature .balloon-console .log-error {
    color: #ff4444;
}

.robot-miniature .balloon-console .log-warn {
    color: #ffaa00;
}

.robot-miniature .balloon-console .log-info {
    color: #00ff00;
}

.robot-miniature .balloon-console .log-time {
    color: #888;
    margin-right: 3px;
}

/* Layout flexbox para miniaturas */
.miniature-mode.row {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    gap: 15px !important;
    padding: 10px !important;
}

/* Modal expandido - screenshot maior */
#expanded-rpa-body .screenshot-container img {
    max-height: 300px;
    width: 100%;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid rgba(45, 80, 130, 0.4);
}

/* Console no modal expandido */
#expanded-rpa-body .expanded-console {
    height: 150px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    padding: 10px;
    background: #0a0a0a;
    border-radius: 6px;
    color: #00ff00;
}

/* Economia no modal expandido */
#expanded-rpa-body .economia-section {
    background: linear-gradient(135deg, #064e3b 0%, #047857 100%);
    border-radius: 8px;
    padding: 12px;
}

/* Responsivo para modo miniatura */
@media (max-width: 768px) {
    .robot-miniature {
        width: 160px;
        height: 280px;
    }
    
    .robot-miniature .robot-image {
        width: 110px;
    }
    
    .robot-miniature .speech-balloon {
        width: 150px;
        height: 120px;
    }
    
    .robot-miniature .balloon-console {
        height: 75px;
        font-size: 8px;
    }
}

/* Ajuste para o wrapper ter position relative */
.miniature-mode .rpa-card-wrapper {
    position: relative;
}

/* Responsiveness */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .btn {
        font-size: 0.875rem;
    }
    
    .screenshot-placeholder {
        min-height: 80px;
        max-height: 80px;
    }
    
    .rpa-screenshot-preview img {
        height: 80px;
    }
    
    .loading-spinner {
        width: 40px;
        height: 40px;
    }
    
    .loading-text {
        font-size: 0.875rem;
    }
    
    /* Miniaturas menores em mobile */
    .miniature-mode .rpa-card {
        min-width: 120px;
        max-width: 140px;
    }
    
    .miniature-mode .rpa-card .card-title {
        font-size: 0.7rem !important;
    }
}

/* ==========================================
   Alerta de Erro - Robô Piscando Vermelho
   ========================================== */

@keyframes error-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(255, 0, 0, 0.8));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(255, 0, 0, 1)) brightness(1.1);
    }
}

@keyframes eyes-error-pulse {
    0%, 100% {
        background: radial-gradient(circle, #ff0000 40%, #aa0000 100%);
        box-shadow: 0 0 8px 3px rgba(255, 0, 0, 0.8);
    }
    50% {
        background: radial-gradient(circle, #ff4444 40%, #ff0000 100%);
        box-shadow: 0 0 15px 6px rgba(255, 0, 0, 1);
    }
}

.robot-miniature.error-alert {
    animation: error-pulse 1s ease-in-out infinite;
}

.robot-miniature.error-alert .robot-eye {
    animation: eyes-error-pulse 1s ease-in-out infinite !important;
}

.robot-miniature.error-alert .speech-balloon {
    border-color: rgba(255, 0, 0, 0.6) !important;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.4);
}

/* ==========================================
   Celebração de Economia - Robô Brilhando Verde
   ========================================== */

@keyframes economia-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(0, 255, 100, 0.8));
    }
    50% {
        filter: drop-shadow(0 0 25px rgba(0, 255, 100, 1)) brightness(1.15);
    }
}

@keyframes eyes-economia-pulse {
    0%, 100% {
        background: radial-gradient(circle, #00ff64 40%, #00aa44 100%);
        box-shadow: 0 0 8px 3px rgba(0, 255, 100, 0.8);
    }
    50% {
        background: radial-gradient(circle, #44ff88 40%, #00ff64 100%);
        box-shadow: 0 0 18px 8px rgba(0, 255, 100, 1);
    }
}

.robot-miniature.economia-celebration {
    animation: economia-pulse 0.8s ease-in-out infinite;
}

.robot-miniature.economia-celebration .robot-eye {
    animation: eyes-economia-pulse 0.8s ease-in-out infinite !important;
}

.robot-miniature.economia-celebration .speech-balloon {
    border-color: rgba(0, 255, 100, 0.6) !important;
    box-shadow: 0 0 15px rgba(0, 255, 100, 0.5);
}

.robot-miniature.economia-celebration .robot-economia {
    animation: economia-pulse 0.8s ease-in-out infinite;
    font-weight: bold;
}

/* ==========================================
   Alerta de Agendamento Atrasado - Robô Brilhando Amarelo
   ========================================== */

@keyframes schedule-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(255, 200, 0, 0.8));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(255, 200, 0, 1)) brightness(1.1);
    }
}

@keyframes eyes-schedule-pulse {
    0%, 100% {
        background: radial-gradient(circle, #ffcc00 40%, #cc9900 100%);
        box-shadow: 0 0 8px 3px rgba(255, 200, 0, 0.8);
    }
    50% {
        background: radial-gradient(circle, #ffdd44 40%, #ffcc00 100%);
        box-shadow: 0 0 15px 6px rgba(255, 200, 0, 1);
    }
}

.robot-miniature.schedule-alert {
    animation: schedule-pulse 1s ease-in-out infinite;
}

.robot-miniature.schedule-alert .robot-eye {
    animation: eyes-schedule-pulse 1s ease-in-out infinite !important;
}

.robot-miniature.schedule-alert .speech-balloon {
    border-color: rgba(255, 200, 0, 0.6) !important;
    box-shadow: 0 0 10px rgba(255, 200, 0, 0.4);
}

/* ==========================================
   Sidebar Menu - Menu Lateral Retrátil
   ========================================== */

:root {
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 60px;
    --sidebar-bg: #1a2332;
    --sidebar-border: rgba(255, 255, 255, 0.1);
    --sidebar-transition: 0.3s ease;
}

.sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - 56px);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    z-index: 1040;
    transition: width var(--sidebar-transition), transform var(--sidebar-transition);
    overflow-x: hidden;
    overflow-y: auto;
}

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

.sidebar-nav {
    padding: 1rem 0;
    list-style: none;
    margin: 0;
}

.sidebar-nav-item {
    margin: 2px 8px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #adb5bd;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav-link:hover {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.sidebar-nav-link.active {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border-left: 3px solid #10b981;
    margin-left: -3px;
}

.sidebar-nav-link i {
    font-size: 1.25rem;
    min-width: 28px;
    text-align: center;
    margin-right: 0.75rem;
    transition: margin var(--sidebar-transition);
}

.sidebar-nav-link span {
    opacity: 1;
    transition: opacity var(--sidebar-transition);
}

.sidebar.collapsed .sidebar-nav-link span {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-nav-link i {
    margin-right: 0;
}

.sidebar.collapsed .sidebar-nav-link {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar-toggle {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background: rgba(16, 185, 129, 0.3);
    transform: translateX(-50%) scale(1.05);
}

.sidebar-toggle i {
    transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

.sidebar-divider {
    height: 1px;
    background: var(--sidebar-border);
    margin: 0.5rem 1rem;
}

.sidebar-section-title {
    padding: 0.5rem 1rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    font-weight: 600;
    margin-top: 0.5rem;
}

.sidebar.collapsed .sidebar-section-title {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

/* Main content adjustment */
.main-content-with-sidebar {
    margin-left: var(--sidebar-width);
    transition: margin-left var(--sidebar-transition);
    min-height: calc(100vh - 56px);
}

.sidebar.collapsed ~ .main-content-with-sidebar,
.main-content-with-sidebar.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width);
}

/* Top navbar adjustment for sidebar layout */
.navbar-with-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1050;
}

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .sidebar-nav-link {
    position: relative;
}

.sidebar.collapsed .sidebar-nav-link::after {
    content: attr(data-title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #1f2937;
    color: #fff;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    margin-left: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 1060;
}

.sidebar.collapsed .sidebar-nav-link:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Mobile responsiveness */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .sidebar.collapsed {
        width: var(--sidebar-width);
    }
    
    .main-content-with-sidebar {
        margin-left: 0;
    }
    
    .main-content-with-sidebar.sidebar-collapsed {
        margin-left: 0;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1039;
    }
    
    .sidebar.mobile-open ~ .sidebar-overlay {
        display: block;
    }
    
    .mobile-menu-toggle {
        display: flex !important;
    }
}

@media (min-width: 992px) {
    .mobile-menu-toggle {
        display: none !important;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
}
