:root {
    --primary-color: #6366f1; /* Indigo 500 */
    --primary-hover: #4f46e5; /* Indigo 600 */
    --secondary-color: #8b5cf6; /* Violet 500 */
    --bg-color: #f3f4f6; /* Gray 100 */
    --card-bg: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --sidebar-width: 260px;
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

body {
    background-color: var(--bg-color);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
}

/* Glassmorphism Logic */
.glass-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
}

.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    background: #0f172a; /* Slate 900 */
    color: white;
    z-index: 100;
    padding: 1.5rem;
    transition: all 0.3s ease;
    transform: translateX(0);
}

.main-content {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    transition: all 0.3s ease;
}

/* Mobile Sidebar - Collapsible */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }
    
    /* Mobile menu toggle button */
    .mobile-menu-toggle {
        display: block !important;
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 101;
        background: rgba(255, 255, 255, 0.95);
        border: 1px solid rgba(0, 0, 0, 0.1);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
}

/* Extra small devices - phones */
@media (max-width: 575.98px) {
    body {
        font-size: 0.95rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .page-subtitle {
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .form-control {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    /* Make cards full width on mobile */
    .col-md-3, .col-md-4, .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Small devices - tablets */
@media (min-width: 576px) and (max-width: 767.98px) {
    .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .col-md-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Medium devices - small laptops */
@media (min-width: 768px) and (max-width: 991.98px) {
    .col-xl-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Responsive tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767.98px) {
    .table thead {
        display: none;
    }
    
    .table, .table tbody, .table tr, .table td {
        display: block;
        width: 100%;
    }
    
    .table tr {
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        padding: 0.5rem;
    }
    
    .table td {
        padding: 0.5rem;
        border: none;
        border-bottom: 1px solid #dee2e6;
    }
    
    .table td:before {
        content: attr(data-label);
        font-weight: bold;
        display: block;
        margin-bottom: 0.25rem;
        color: var(--text-muted);
    }
}

/* Responsive navigation */
@media (max-width: 991.98px) {
    .navbar-expand-lg .navbar-nav {
        flex-direction: column;
    }
    
    .dropdown-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        border: none;
    }
}

/* Responsive cards */
.glass-card {
    margin-bottom: 1.5rem;
}

@media (max-width: 767.98px) {
    .glass-card {
        padding: 1.25rem;
        border-radius: 12px;
    }
    
    /* Stack horizontal layouts vertically on mobile */
    .d-flex.flex-row {
        flex-direction: column !important;
    }
    
    .gap-2, .gap-3 {
        gap: 1rem !important;
    }
}

/* Responsive modals */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 1rem;
        max-width: none;
    }
    
    .modal-content {
        border-radius: 12px;
    }
    
    /* Make modal content scrollable on small screens */
    .modal-body {
        max-height: 70vh;
        overflow-y: auto;
    }
}

/* Responsive form elements */
@media (max-width: 767.98px) {
    .form-control-lg {
        padding: 0.6rem 1rem;
        font-size: 1rem;
    }
    
    /* Stack form rows vertically */
    .row .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Responsive buttons and inputs */
@media (max-width: 575.98px) {
    .btn-group, .btn-toolbar {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-group > .btn, .btn-toolbar .btn {
        width: 100%;
    }
}

/* Responsive navigation and headers */
@media (max-width: 767.98px) {
    .page-header {
        margin-bottom: 1.5rem !important;
    }
    
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
    }
    
    .justify-content-between {
        justify-content: flex-start !important;
    }
}

/* Responsive alerts and badges */
@media (max-width: 575.98px) {
    .alert {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .badge {
        padding: 0.3em 0.5em;
        font-size: 0.75rem;
    }
}

/* Responsive progress bars */
@media (max-width: 575.98px) {
    .progress {
        height: 6px;
    }
}

/* Responsive dropdowns */
@media (max-width: 767.98px) {
    .dropdown-menu {
        min-width: auto;
        width: 100%;
    }
}

/* Responsive pagination */
@media (max-width: 575.98px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .page-item {
        margin: 0.25rem;
    }
}

/* Responsive images */
img {
    max-width: 100%;
    height: auto;
}

/* Responsive iframes and embeds */
.embed-responsive, .video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.embed-responsive iframe, .video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Print styles */
@media print {
    .sidebar, .mobile-menu-toggle {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 1rem !important;
    }
    
    .glass-card {
        background: white !important;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    .no-print {
        display: none !important;
    }
}

/* Responsive login/register pages */
@media (max-width: 767.98px) {
    .min-vh-100 {
        padding: 2rem 1rem;
    }
    
    .glass-card {
        padding: 2rem 1.5rem;
    }
}

.nav-link {
    color: #94a3b8;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-link i {
    font-size: 1.2rem;
}

/* Custom Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: 10px;
    padding: 0.6rem 1.2rem;
    font-weight: 500;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
    transition: transform 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px -1px rgba(99, 102, 241, 0.4);
    background: linear-gradient(135deg, var(--primary-hover), var(--secondary-color));
}

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

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

/* Form Controls */
.form-control {
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    padding: 0.7rem 1rem;
}

.form-control:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    border-color: var(--primary-color);
}

/* Page Headers */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-weight: 700;
    letter-spacing: -0.025em;
    font-size: 1.875rem;
    color: #1e293b;
}

.page-subtitle {
    color: var(--text-muted);
}

/* Badges */
.badge {
    padding: 0.5em 0.8em;
    border-radius: 8px;
    font-weight: 600;
}

.bg-success-soft {
    background-color: #dcfce7;
    color: #166534;
}

.bg-warning-soft {
    background-color: #fef9c3;
    color: #854d0e;
}

.bg-danger-soft {
    background-color: #fee2e2;
    color: #991b1b;
}

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

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Modificação: Controle de quebra de texto para balões de chat longos (PDFs, Logs, URLs) */
.message-bubble {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap; /* Preserva as quebras de linha enviadas pela IA/Usuário */
}
