/* ============================================
   Forprocer - Estilos Principales
   Diseno profesional con azules/grises corporativos
   ============================================ */

/* Variables CSS */
:root {
    /* Colores corporativos Forprocer (teal/turquesa) */
    --primary-900: #1d4e4e;
    --primary-800: #2a6b6b;
    --primary-700: #319795;
    --primary-600: #38b2ac;
    --primary-500: #4fd1c5;
    --primary-100: #e6fffa;

    --gray-900: #1a202c;
    --gray-800: #2d3748;
    --gray-700: #4a5568;
    --gray-600: #718096;
    --gray-500: #a0aec0;
    --gray-400: #cbd5e0;
    --gray-300: #e2e8f0;
    --gray-200: #edf2f7;
    --gray-100: #f7fafc;
    --gray-50: #fafbfc;

    --success: #38a169;
    --success-light: #c6f6d5;
    --warning: #d69e2e;
    --warning-light: #fefcbf;
    --danger: #e53e3e;
    --danger-light: #fed7d7;

    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --border-radius: 6px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* Reset basico */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-family);
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--gray-800);
    background-color: var(--gray-100);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 64px;
    background: white;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 3px solid var(--primary-600);
}

.navbar-brand a {
    display: flex;
    align-items: center;
}

.navbar-logo {
    height: 36px;
    width: auto;
}

.navbar-menu {
    display: flex;
    gap: 0.5rem;
}

.nav-link {
    color: var(--gray-600);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--primary-700);
    background: var(--primary-100);
}

.nav-link.active {
    color: var(--primary-800);
    background: var(--primary-100);
}

.navbar-end {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Footer */
.footer {
    padding: 1rem;
    text-align: center;
    color: var(--gray-600);
    font-size: 0.8125rem;
    border-top: 1px solid var(--gray-300);
    background: white;
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-800);
}

.btn-outline {
    background: white;
    border: 1px solid var(--gray-400);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-100);
    border-color: var(--gray-500);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #c53030;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-icon {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--gray-500);
    border-radius: 4px;
}

.btn-icon:hover {
    color: var(--danger);
    background: var(--gray-100);
}

/* Formularios */
.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-400);
    border-radius: var(--border-radius);
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
}

.form-control:read-only {
    background: var(--gray-100);
    color: var(--gray-600);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234a5568' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    color: var(--gray-700);
    font-size: 0.8125rem;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
}

/* Tablas */
.table-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table td.loading,
.data-table td.empty {
    text-align: center;
    color: var(--gray-500);
    padding: 2rem;
}

.data-table .actions {
    display: flex;
    gap: 0.5rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    text-transform: uppercase;
}

.badge.success {
    background: var(--success-light);
    color: var(--success);
}

.badge.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge.pending {
    background: var(--gray-200);
    color: var(--gray-600);
}

.badge.inactive {
    background: var(--gray-200);
    color: var(--gray-600);
}

/* Alertas */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-success {
    background: var(--success-light);
    color: #276749;
    border: 1px solid #9ae6b4;
}

.alert-warning {
    background: var(--warning-light);
    color: #975a16;
    border: 1px solid #faf089;
}

.alert-error, .alert-danger {
    background: var(--danger-light);
    color: #c53030;
    border: 1px solid #feb2b2;
}

.alert-info {
    background: var(--primary-100);
    color: var(--primary-800);
    border: 1px solid #90cdf4;
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
}

.alert-close:hover {
    opacity: 1;
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 1rem;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

/* Filtros */
.filters-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    flex: 1;
    min-width: 150px;
    max-width: 250px;
}

/* Paginacion */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.pagination button {
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--gray-400);
    background: white;
    border-radius: var(--border-radius);
    cursor: pointer;
}

.pagination button:hover:not(:disabled) {
    background: var(--gray-100);
}

.pagination button.active {
    background: var(--primary-700);
    color: white;
    border-color: var(--primary-700);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-content.modal-sm {
    max-width: 400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
    line-height: 1;
}

.modal-close:hover {
    color: var(--gray-700);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* Detail Views */
.detail-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.detail-section {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.detail-section:last-child {
    border-bottom: none;
}

.detail-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

.detail-item .label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-500);
    text-transform: uppercase;
}

.detail-item .value {
    font-size: 0.9375rem;
    color: var(--gray-800);
}

.detail-item.highlight {
    background: var(--gray-100);
    padding: 0.5rem;
    border-radius: var(--border-radius);
}

.detail-item.total {
    background: var(--primary-100);
    padding: 0.75rem;
    border-radius: var(--border-radius);
}

.detail-item.result.positive .value {
    color: var(--success);
    font-weight: 600;
}

.detail-item.result.negative .value {
    color: var(--danger);
    font-weight: 600;
}

.detail-actions {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    justify-content: flex-end;
}

/* Config Page */
.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.config-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.config-header h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-700);
}

.config-list {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
}

.config-item:last-child {
    border-bottom: none;
}

.config-item:hover {
    background: var(--gray-50);
}

.config-list .empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--gray-500);
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
    }

    .navbar-menu {
        display: none;
    }

    .main-content {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .filters-bar {
        flex-direction: column;
    }

    .filter-group {
        max-width: none;
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Utilities */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
