/* main.css - Estilos globales para la aplicación Poder Judicial */

/* Variables globales */
:root {
    --primary-color: #3f51b5;
    --primary-dark: #303f9f;
    --primary-light: #7986cb;
    --secondary-color: #ff4081;
    --secondary-light: #ff79b0;
    --secondary-dark: #c60055;
    --success-color: #4caf50;
    --info-color: #2196f3;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --light-color: #f8fafc;
    --dark-color: #212529;
    --body-bg: #f0f2f5;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
    --transition-speed: 0.3s;
    --sidebar-transition: all 0.3s ease;
    --border-radius: 0.375rem;
    --box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --white: #ffffff;
}

/* Estilos generales */
body {
    background-color: var(--body-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Roboto', 'Segoe UI', sans-serif;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    color: var(--gray-800);
    line-height: 1.5;
}

main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    transition: var(--sidebar-transition);
}

/* Cuando no hay sidebar (usuario no autenticado) */
body:not(:has(.sidebar)) main,
body.no-auth main {
    margin-left: 0;
}

.body-collapsed main {
    margin-left: var(--sidebar-collapsed-width);
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition-speed);
}

a:hover {
    color: var(--primary-dark);
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    white-space: nowrap;
    color: var(--white);
}

.navbar-brand i {
    margin-right: 10px;
    font-size: 1.5rem;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--primary-color);
    color: white;
    z-index: 1000;
    transition: var(--sidebar-transition);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.body-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 1rem;
    background-color: var(--primary-dark);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    justify-content: space-between;
}

.sidebar-header .navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    overflow: hidden;
    white-space: nowrap;
}

.body-collapsed .sidebar-header .navbar-brand span {
    display: none;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.25rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transition: var(--sidebar-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-menu {
    padding: 20px 0;
    list-style: none;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}

.sidebar-menu li {
    margin: 5px 0;
    position: relative;
}

.sidebar-menu a, .sidebar-menu .dropdown-toggle, .sidebar-menu .submenu a {
    font-size: 0.9rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: var(--sidebar-transition);
    border-radius: 0.25rem;
    margin: 0 0.5rem;
    gap: 10px;
    position: relative;
    text-align: left;
}

.sidebar-menu a i {
    font-size: 1.0rem;
    min-width: 30px;
    display: flex;
    justify-content: center;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-menu a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background-color: var(--secondary-color);
}

.sidebar-menu .dropdown-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: var(--sidebar-transition);
    border-radius: 0.25rem;
    margin: 0 0.5rem;
    gap: 10px;
    position: relative;
    text-align: left;
}

.sidebar-menu .dropdown-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-menu .dropdown-toggle::after {
    content: '\f105'; /* FontAwesome angle-right */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.85rem;
    transition: transform 0.3s;
    margin-left: auto;
}

.sidebar-menu li.submenu-open > .dropdown-toggle::after {
    transform: rotate(90deg);
}

.sidebar-menu .submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 1rem;
    list-style: none;
}

.sidebar-menu li.submenu-open > .submenu {
    max-height: 1000px;
}

.sidebar-menu .submenu a {
    padding-left: 2.5rem;
    position: relative;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.sidebar-menu .submenu a::before {
    content: '';
    position: absolute;
    left: 1.5rem;
    top: 50%;
    width: 5px;
    height: 5px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transform: translateY(-50%);
}

.body-collapsed .sidebar-menu a span {
    display: none;
}

.body-collapsed .sidebar-menu .submenu {
    position: absolute;
    left: 100%;
    top: 0;
    width: 200px;
    background-color: var(--primary-dark);
    border-radius: 0 4px 4px 0;
    max-height: 0;
    overflow: hidden;
    z-index: 1000;
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, max-height 0s;
}

.body-collapsed .sidebar-menu li:hover > .submenu {
    max-height: 1000px;
    pointer-events: all;
    opacity: 1;
}

.body-collapsed .sidebar-menu .dropdown-toggle::after {
    display: none;
}

.body-collapsed .sidebar-menu .submenu a {
    padding-left: 1rem;
    text-align: left;
    justify-content: flex-start;
}

.body-collapsed .sidebar-menu .submenu a::before {
    display: none;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background-color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.user-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0;
}

.user-info span.fw-bold {
    white-space: normal;
    word-break: break-word;
}

.body-collapsed .user-info {
    display: none;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Mobile topbar */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background-color: var(--primary-color);
    color: white;
    z-index: 1050;
    padding: 0 1rem;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mobile-toggle {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Cards */
.card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
    border: 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    padding: 1rem 1.5rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background-color: rgba(0, 0, 0, 0.03);
    border-top: 1px solid rgba(0, 0, 0, 0.125);
    padding: 1rem 1.5rem;
}

/* Tables */
.table {
    width: 100%;
    margin-bottom: 1rem;
    color: var(--gray-800);
    border-collapse: collapse;
}

.table th {
    font-weight: 600;
    vertical-align: bottom;
    border-bottom: 2px solid var(--gray-300);
    padding: 0.75rem;
    text-align: left;
}

.table td {
    padding: 0.75rem;
    vertical-align: middle;
    border-top: 1px solid var(--gray-300);
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Forms */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 0.25rem rgba(63, 81, 181, 0.25);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Shadows */
.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.shadow {
    box-shadow: var(--box-shadow) !important;
}

.shadow-lg {
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
}

/* Document preview */
.documento-preview {
    padding: 1.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    background-color: var(--white);
    margin-bottom: 1.5rem;
}

/* Evaluation criteria */
.criterio-item {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    background-color: var(--gray-100);
}

.resultado-evaluacion {
    font-size: 1.25rem;
    font-weight: 600;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-top: 1.5rem;
    background-color: var(--success-color);
    color: white;
}

/* Chat styles */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    background-color: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.message {
    margin-bottom: 1.5rem;
    max-width: 80%;
    padding: 1rem;
    border-radius: 1rem;
}

.message-user {
    background-color: var(--primary-light);
    color: white;
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 0;
}

.message-bot {
    background-color: var(--gray-200);
    align-self: flex-start;
    border-bottom-left-radius: 0;
}

.chat-input {
    padding: 1rem;
    border-top: 1px solid var(--gray-300);
    background-color: var(--white);
}

/* Document sidebar */
.doc-sidebar {
    position: sticky;
    top: 2rem;
    height: calc(100vh - 4rem);
    overflow-y: auto;
    padding: 1rem;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

.doc-content {
    background-color: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

/* Stats cards */
.stat-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card.primary {
    border-left: 4px solid var(--primary-color);
}

.stat-card.success {
    border-left: 4px solid var(--success-color);
}

.stat-card.info {
    border-left: 4px solid var(--info-color);
}

.stat-card.warning {
    border-left: 4px solid var(--warning-color);
}

.stat-card.danger {
    border-left: 4px solid var(--danger-color);
}

.stat-card .icon {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 3rem;
    opacity: 0.15;
    transition: all 0.3s ease;
}

.stat-card:hover .icon {
    transform: scale(1.2);
    opacity: 0.25;
}

.stat-card .stat-label {
    font-size: 0.9rem;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
}

@media (max-width: 992px) {
    main {
        margin-left: 0;
        padding: 1rem;
        padding-top: calc(var(--header-height) + 10px);
    }
    
    .body-collapsed main {
        margin-left: 0;
    }
    
    body.no-auth main {
        padding-top: 1rem; /* Sin topbar móvil, no necesitamos espacio adicional arriba */
    }
    
    .mobile-topbar {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
        z-index: 1060;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: none;
    }
}

@media (max-width: 768px) {
    .message {
        max-width: 90%;
    }
    
    .stat-card {
        margin-bottom: 1rem;
    }
}

/* Breadcrumbs */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    list-style: none;
    background-color: var(--gray-100);
    border-radius: var(--border-radius);
}

.breadcrumb-item + .breadcrumb-item {
    padding-left: 0.5rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    display: inline-block;
    padding-right: 0.5rem;
    color: var(--gray-600);
    content: "/";
}

.breadcrumb-item.active {
    color: var(--gray-600);
}

/* Colors */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.rounded {
    border-radius: var(--border-radius) !important;
}

/* Pagination */
.pagination {
    justify-content: center;
    margin-top: 2rem;
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.page-link {
    color: var(--primary-color);
}

.page-link:hover {
    color: var(--primary-dark);
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
}

.alert-primary {
    color: var(--primary-dark);
    background-color: rgba(63, 81, 181, 0.1);
    border-color: rgba(63, 81, 181, 0.3);
}

.alert-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}

.alert-info {
    color: #055160;
    background-color: #cff4fc;
    border-color: #b6effb;
}

.alert-warning {
    color: #664d03;
    background-color: #fff3cd;
    border-color: #ffecb5;
}

.alert-danger {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

/* Dashboard grid */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.quick-access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.quick-access-item {
    background-color: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    cursor: pointer;
}

.quick-access-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.quick-access-item i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

.quick-access-item:hover i {
    transform: scale(1.1);
}

.quick-access-item h5 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
} 