/* Reset y variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #B85C14;
    --secondary-color: #C4621A;
    --accent-color: #D2691E;
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-light: #6b6b6b;
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --bg-tertiary: #f5f5f5;
    --border-color: #e5e5e5;
    --success-color: #48bb78;
    --warning-color: #ed8936;
    --error-color: #d32f2f;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Tipografía */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Contenedor principal */
.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Header */
.main-header {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.main-nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: var(--transition);
}

.main-nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.user-menu {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-left: 1.5rem;
    border-left: 2px solid rgba(255, 255, 255, 0.3);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-icon {
    font-size: 1.1rem;
}

.user-name {
    color: white;
    font-weight: 500;
    font-size: 0.95rem;
}

.logout-btn {
    background-color: rgba(255, 255, 255, 0.15);
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-weight: 500;
    transition: var(--transition);
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Contenido principal */
.main-content {
    flex: 1;
    padding: 2rem 0;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Cards */
.welcome-card,
.feature-card {
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.welcome-card {
    padding: 2rem;
    margin-bottom: 2rem;
}

.welcome-card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.card-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.card-body {
    color: var(--text-secondary);
}

.card-body p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

/* Grid de características */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

/* Cuando hay una sola card, centrarla y darle más tamaño */
.features-grid:has(.feature-card:only-child) {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin: 2rem auto;
}

.feature-card {
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: var(--transition);
}

.feature-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.feature-card:active {
    transform: translateY(0);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Sección de contenido */
.content-section {
    margin-bottom: 2rem;
}

/* Botones */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    box-shadow: var(--shadow-md);
}

/* Página de error */
.error-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.error-content {
    text-align: center;
    padding: 3rem;
}

.error-code {
    font-size: 8rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 1rem;
}

.error-content h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.error-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* Footer */
.main-footer {
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 0;
    margin-top: auto;
}

.footer-content {
    text-align: center;
}

.footer-content p {
    margin: 0.25rem 0;
}

.footer-info {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Mensajes de error */
.error-message {
    background-color: #fee;
    color: var(--error-color);
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid var(--error-color);
    margin: 1rem 0;
}

/* Estilos para Net Suite - Módulo de Filtros */
.filters-card {
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.filters-header {
    background-color: var(--bg-tertiary);
    padding: 1rem 1.5rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.filters-title-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-toggle-filters {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    transition: var(--transition);
    border-radius: 4px;
}

.btn-toggle-filters:hover {
    background-color: rgba(184, 92, 20, 0.1);
}

.toggle-icon {
    font-size: 0.875rem;
    transition: transform 0.3s ease;
    display: inline-block;
}

.filters-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

.filters-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.filters-body {
    padding: 1.5rem;
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.filters-body.collapsed {
    max-height: 0;
    padding: 0 1.5rem;
    opacity: 0;
    overflow: hidden;
}

#filtersContainer {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filter-row {
    display: grid;
    grid-template-columns: 2fr 2fr 2fr auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.filter-group {
    display: flex;
    align-items: center;
}

.filter-column,
.filter-condition {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
}

.filter-column:focus,
.filter-condition:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(210, 105, 30, 0.1);
}

.filter-value {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
}

.filter-value:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(210, 105, 30, 0.1);
}

.btn-remove-filter {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--error-color);
    background-color: var(--bg-primary);
    color: var(--error-color);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    padding: 0;
}

.btn-remove-filter:hover {
    background-color: var(--error-color);
    color: white;
    transform: scale(1.1);
}

/* Estilos para Net Suite - Tabla */
.table-card {
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.table-card .card-header {
    background-color: var(--bg-tertiary);
    padding: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.table-card .card-body {
    padding: 1.5rem;
}

.table-wrapper {
    overflow-x: hidden; /* Sin scroll horizontal */
    width: 100%;
    max-width: 100%;
}

/* Asegurar que la tabla use todo el ancho disponible */
.dataTables_wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden; /* Sin scroll horizontal */
}

.dataTables_scroll {
    overflow-x: hidden !important; /* Forzar sin scroll horizontal */
}

/* Estilos para DataTables */
.data-table {
    width: 100% !important;
    max-width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    table-layout: auto;
}

/* Ocultar scroll horizontal en todos los elementos de DataTables */
.dataTables_scrollHead,
.dataTables_scrollBody,
.dataTables_scrollFoot {
    overflow-x: hidden !important;
}

.data-table thead {
    background-color: #4a4a4a;
    color: white;
}

.data-table thead th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #3a3a3a;
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background-color: var(--bg-secondary);
}

.data-table tbody td {
    padding: 0.75rem;
    vertical-align: top;
}

.data-table tbody td.text-right {
    text-align: right;
}

/* Controles de DataTables */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-controls .dataTables_length,
.table-controls .dataTables_filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-controls .dataTables_length label,
.table-controls .dataTables_filter label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-weight: 500;
    color: var(--text-secondary);
}

.table-controls select,
.table-controls input[type="search"] {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.table-controls input[type="search"] {
    min-width: 200px;
}

.table-controls input[type="search"]:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(210, 105, 30, 0.1);
}

/* Footer de DataTables */
.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.table-footer .dataTables_info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.table-footer .dataTables_paginate {
    display: flex;
    gap: 0.25rem;
}

.table-footer .dataTables_paginate .paginate_button {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.table-footer .dataTables_paginate .paginate_button:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
}

.table-footer .dataTables_paginate .paginate_button.current {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.table-footer .dataTables_paginate .paginate_button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading spinner */
.dataTables_processing {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    font-weight: 500;
    color: var(--primary-color);
}

/* Responsive para tablas y filtros */
@media (max-width: 768px) {
    .filters-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filters-actions {
        width: 100%;
        justify-content: stretch;
    }
    
    .filters-actions .btn {
        flex: 1;
    }
    
    .filter-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .btn-remove-filter {
        width: 100%;
        height: auto;
        padding: 0.5rem;
        border-radius: 4px;
    }
    
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table {
        font-size: 0.85rem;
    }
    
    .data-table thead th,
    .data-table tbody td {
        padding: 0.5rem;
    }
    
    .table-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .table-controls .dataTables_length,
    .table-controls .dataTables_filter {
        width: 100%;
    }
    
    .table-controls input[type="search"] {
        width: 100%;
        min-width: auto;
    }
    
    .table-footer {
        flex-direction: column;
        align-items: center;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .main-nav a {
        display: block;
        text-align: center;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .error-code {
        font-size: 5rem;
    }
}

/* Estilos para páginas de autenticación */
.auth-page {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-container {
    width: 100%;
    max-width: 450px;
}

.auth-card {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    border: 1px solid var(--border-color);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h2 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.auth-form {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(210, 105, 30, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-light);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.btn-block {
    width: 100%;
    display: block;
    text-align: center;
}

.btn-microsoft {
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #d1d1d1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
}

.btn-microsoft:hover {
    background-color: #f5f5f5;
    border-color: #a1a1a1;
}

.btn-microsoft svg {
    width: 21px;
    height: 21px;
}

.auth-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    background: var(--bg-primary);
    padding: 0 1rem;
    color: var(--text-light);
    position: relative;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.auth-footer p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-error {
    background-color: #fee;
    color: var(--error-color);
    border-color: var(--error-color);
}

.alert-success {
    background-color: #efe;
    color: var(--success-color);
    border-color: var(--success-color);
}

@media (max-width: 768px) {
    .auth-card {
        padding: 2rem 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

