/* ============================================
   IURISCON — Estilos globales
   ============================================ */

:root {
    --sidebar-width: 260px;
    --topbar-height: 58px;
    --primary-dark: #0f3460;
    --primary-medium: #16213e;
    --primary-light: #1a1a2e;
}

/* ---------- General ---------- */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f4f6f9;
    color: #333;
}

/* ---------- Sidebar ---------- */
.sidebar {
    min-height: 100vh;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    transition: all 0.3s ease;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-link {
    color: rgba(255, 255, 255, 0.7) !important;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    margin-bottom: 2px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff !important;
}

.sidebar-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff !important;
    font-weight: 600;
}

/* ---------- Page content ---------- */
#page-content-wrapper {
    margin-left: var(--sidebar-width);
    transition: all 0.3s ease;
    min-height: 100vh;
}

#page-content-wrapper.expanded {
    margin-left: 0;
}

/* ---------- Cards ---------- */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.stat-card {
    border-left: 4px solid;
}

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

/* ---------- Tables ---------- */
.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    border-bottom: 2px solid #dee2e6;
}

.table td {
    vertical-align: middle;
}

/* ---------- Badges ---------- */
.badge-status {
    padding: 0.4em 0.8em;
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: 6px;
}

/* ---------- Utilities ---------- */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

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

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

    #page-content-wrapper {
        margin-left: 0;
    }
}

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

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

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

/* ============================================
   DARK MODE
   ============================================ */
[data-theme="dark"] {
    --bs-body-bg: #1a1d23;
    --bs-body-color: #e0e0e0;
}

[data-theme="dark"] body {
    background-color: #1a1d23;
    color: #e0e0e0;
}

[data-theme="dark"] .navbar-light,
[data-theme="dark"] .bg-white {
    background-color: #22262e !important;
    color: #e0e0e0;
}

[data-theme="dark"] .navbar-light .navbar-text,
[data-theme="dark"] .navbar-light .text-dark,
[data-theme="dark"] .text-dark {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .card {
    background-color: #22262e;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .card-header.bg-white,
[data-theme="dark"] .card-footer.bg-white {
    background-color: #282c34 !important;
    border-color: #3a3f47;
}

[data-theme="dark"] .table {
    color: #e0e0e0;
}

[data-theme="dark"] .table th {
    color: #a0a0a0;
    border-color: #3a3f47;
}

[data-theme="dark"] .table td {
    border-color: #3a3f47;
}

[data-theme="dark"] .table-light {
    background-color: #282c34;
    color: #e0e0e0;
}

[data-theme="dark"] .table-hover tbody tr:hover {
    background-color: #2d323a;
    color: #e0e0e0;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #2d323a;
    border-color: #3a3f47;
    color: #e0e0e0;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: #343a42;
    border-color: #4a90d9;
    color: #fff;
}

[data-theme="dark"] .input-group-text {
    background-color: #2d323a;
    border-color: #3a3f47;
    color: #a0a0a0;
}

[data-theme="dark"] .bg-light {
    background-color: #282c34 !important;
}

[data-theme="dark"] .text-muted {
    color: #8a8f98 !important;
}

[data-theme="dark"] .border-bottom,
[data-theme="dark"] .border-top {
    border-color: #3a3f47 !important;
}

[data-theme="dark"] .modal-content {
    background-color: #22262e;
    color: #e0e0e0;
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: #3a3f47;
}

[data-theme="dark"] .dropdown-menu {
    background-color: #22262e;
    border-color: #3a3f47;
}

[data-theme="dark"] .dropdown-item {
    color: #e0e0e0;
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: #2d323a;
    color: #fff;
}

[data-theme="dark"] .list-group-item {
    background-color: #22262e;
    border-color: #3a3f47;
    color: #e0e0e0;
}

[data-theme="dark"] .alert-info {
    background-color: #1a3a4a;
    border-color: #2a5a6a;
    color: #8ecae6;
}

[data-theme="dark"] .alert-warning {
    background-color: #3a3520;
    border-color: #5a5530;
    color: #ffd166;
}

[data-theme="dark"] .stat-card {
    background-color: #22262e;
}

[data-theme="dark"] .doc-editor {
    background-color: #282c34;
    color: #e0e0e0;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .chat-container {
    background-color: #1a1d23;
}

[data-theme="dark"] .chat-message.user {
    background-color: #2a3a4a;
}

[data-theme="dark"] .chat-message.assistant {
    background-color: #22262e;
}

[data-theme="dark"] .spinner-overlay {
    background: rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .accordion-arrow {
    color: #a0a0a0;
}

/* Toggle button */
.theme-toggle {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    background: transparent;
    color: #6c757d;
    font-size: 0.9rem;
    transition: all 0.2s;
}

[data-theme="dark"] .theme-toggle {
    border-color: #3a3f47;
    color: #ffd166;
}

.theme-toggle:hover {
    opacity: 0.8;
}

/* SweetAlert2 customizations */
.swal-wide {
    max-width: 600px !important;
    font-size: 0.9rem;
}
.swal-wide .swal2-html-container {
    text-align: left !important;
    max-height: 400px;
    overflow-y: auto;
}
[data-theme="dark"] .swal2-popup {
    background: #22262e;
    color: #e0e0e0;
}
[data-theme="dark"] .swal2-title,
[data-theme="dark"] .swal2-html-container {
    color: #e0e0e0;
}
