/* ============================================================
   theme.css — Carriers Quotations
   Diseño principal del sistema. Importado desde base.html.
   ============================================================ */

/* ── VARIABLES ── */
:root {
    --sidebar-bg: #1a1f2e;
    --sidebar-hover: #252c3f;
    --sidebar-active: #2d3550;
    --sidebar-text: #8b92a9;
    --sidebar-text-active: #ffffff;
    --sidebar-section: #555e7a;
    --sidebar-width: 220px;
    --accent: #3b6ef8;
    --accent-hover: #2d5ce8;
    --body-bg: #f4f6fb;
    --card-bg: #ffffff;
    --text-primary: #1a1f2e;
    --text-secondary: #6b7280;
    --border: #e5e9f0;
    --danger: #ef4444;
    --danger-hover: #dc2626;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--body-bg);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
}

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-icon {
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 18px; font-weight: 700;
    flex-shrink: 0;
}

.brand-text { color: #fff; font-size: 13px; font-weight: 600; line-height: 1.3; }

.sidebar-section {
    padding: 20px 20px 8px;
    font-size: 10px; font-weight: 600;
    letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--sidebar-section);
}

.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px; font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.sidebar-nav a:hover { background: var(--sidebar-hover); color: var(--sidebar-text-active); }
.sidebar-nav a.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
    border-left: 3px solid var(--accent);
}
.sidebar-nav a i { font-size: 16px; width: 18px; text-align: center; }

/* ── LAYOUT ── */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1; display: flex; flex-direction: column;
    min-height: 100vh;
}

/* ── TOPBAR ── */
.topbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 32px; height: 60px;
    display: flex; align-items: center; justify-content: flex-end;
    gap: 12px; position: sticky; top: 0; z-index: 50;
}

.user-badge {
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; padding: 6px 10px;
    border-radius: 8px; transition: background 0.15s;
}
.user-badge:hover { background: var(--body-bg); }

.user-avatar {
    width: 34px; height: 34px;
    background: #e8ecf5; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); font-size: 18px;
}
.user-info { line-height: 1.2; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-email { font-size: 11px; color: var(--text-secondary); }

/* ── PAGE CONTENT ── */
.page-content { padding: 32px; flex: 1; }

/* ── PAGE HEADER ── */
.page-header {
    display: flex; align-items: center;
    justify-content: space-between; margin-bottom: 24px;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text-primary); margin: 0; }

/* ── BACK LINK ── */
.back-link {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 20px; color: var(--text-secondary);
    text-decoration: none; margin-bottom: 20px;
    transition: color 0.15s;
}
.back-link:hover { color: var(--text-primary); }

/* ── BREADCRUMB ── */
.breadcrumb-cq {
    font-size: 13px; color: #9ca3af; margin-bottom: 24px;
}
.breadcrumb-cq a { color: #9ca3af; text-decoration: none; }
.breadcrumb-cq a:hover { color: var(--text-primary); }
.breadcrumb-cq .sep { margin: 0 6px; }
.breadcrumb-cq .current { color: var(--text-primary); }

/* ── CARD ── */
.content-card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
}

/* ── FILTER BAR ── */
.filter-bar { padding: 20px 24px; border-bottom: 1px solid var(--border); }

.filter-bar .form-label {
    font-size: 12px; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 6px;
}
.filter-bar .form-control {
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 13px; padding: 8px 12px;
    color: var(--text-primary); background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-bar .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,110,248,0.1);
    outline: none;
}
.filter-bar .form-control::placeholder { color: #b0b8cc; }

/* ── TABLE ── */
.data-table { width: 100%; border-collapse: collapse; }

.data-table thead th {
    padding: 12px 24px;
    font-size: 12px; font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border); background: #fff;
}
.data-table tbody tr {
    border-bottom: 1px solid var(--border); transition: background 0.1s;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: #f8f9fd; }
.data-table tbody td {
    padding: 14px 24px; font-size: 13.5px;
    color: var(--text-primary); vertical-align: middle;
}
.data-table tbody td.text-muted-cell { color: var(--text-secondary); }

/* ── ACTION BUTTONS (tabla) ── */
.action-btn {
    background: none; border: none;
    padding: 6px 7px; border-radius: 6px;
    cursor: pointer; font-size: 17px; line-height: 1;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
    display: inline-flex; align-items: center; justify-content: center;
}
.action-btn.view   { color: #6b7280; }
.action-btn.edit   { color: #6b7280; }
.action-btn.delete { color: var(--danger); }
.action-btn.view:hover   { background: #eef2ff; color: var(--accent); }
.action-btn.edit:hover   { background: #fef9ec; color: #d97706; }
.action-btn.delete:hover { background: #fff1f1; color: var(--danger); }

/* ── BOTONES ── */
.btn-primary-custom {
    background: var(--accent); color: #fff; border: none;
    border-radius: 8px; padding: 9px 18px;
    font-size: 13.5px; font-weight: 500; cursor: pointer;
    text-decoration: none; display: inline-flex;
    align-items: center; gap: 6px; transition: background 0.15s;
}
.btn-primary-custom:hover { background: var(--accent-hover); color: #fff; }

.btn-secondary-custom {
    background: #fff; color: var(--text-primary);
    border: 1px solid var(--border); border-radius: 8px;
    padding: 9px 18px; font-size: 13.5px; font-weight: 500;
    cursor: pointer; text-decoration: none;
    display: inline-flex; align-items: center; gap: 6px;
    transition: background 0.15s, border-color 0.15s;
}
.btn-secondary-custom:hover {
    background: var(--body-bg); border-color: #cdd2dd; color: var(--text-primary);
}

.btn-danger-custom {
    background: var(--danger); color: #fff; border: none;
    border-radius: 8px; padding: 9px 18px;
    font-size: 13.5px; font-weight: 500; cursor: pointer;
    text-decoration: none; display: inline-flex;
    align-items: center; gap: 6px; transition: background 0.15s;
}
.btn-danger-custom:hover { background: var(--danger-hover); color: #fff; }

/* ── FORM (página completa, no modal) ── */
.form-section-card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 24px;
}
.form-section-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px; font-weight: 600; color: var(--text-primary);
}
.form-section-body { padding: 24px; }

.form-required-note {
    font-size: 13px; color: var(--text-secondary);
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
}
.form-required-note .required-star { color: var(--danger); }

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
@media (max-width: 768px) { .form-grid { grid-template-columns: 1fr; } }
@media (max-width: 1024px) { .form-grid { grid-template-columns: repeat(2, 1fr); } }

.form-field label {
    display: block; font-size: 12px; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 6px;
}
.form-field label .required-star { color: var(--danger); margin-left: 2px; }

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    border: 1px solid var(--border); border-radius: 8px;
    padding: 9px 13px; font-size: 13.5px;
    color: var(--text-primary); background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s; outline: none;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,110,248,0.1);
}
.form-field input::placeholder { color: #b0b8cc; }
.form-field .errorlist {
    list-style: none; padding: 0; margin: 5px 0 0;
    font-size: 12px; color: var(--danger);
}
.form-field input.is-invalid { border-color: var(--danger); }

.form-actions {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* ── DETAIL ── */
.detail-section-card {
    background: var(--card-bg);
    border-radius: 12px; border: 1px solid var(--border);
    overflow: hidden; margin-bottom: 24px;
}
.detail-section-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px; font-weight: 600; color: var(--text-primary);
}
.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
}
.detail-field {
    padding: 20px 24px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.detail-field:nth-child(3n) { border-right: none; }
.detail-field label {
    font-size: 11px; font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.06em;
    display: block; margin-bottom: 5px;
}
.detail-field .field-value { font-size: 14px; color: var(--text-primary); font-weight: 500; }
.detail-field .field-value.empty {
    color: #b0b8cc; font-style: italic; font-weight: 400;
}

/* ── MODAL (Bootstrap override para el diseño del sistema) ── */
.modal-cq .modal-content {
    border: none; border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.12);
}
.modal-cq .modal-header {
    border-bottom: none; padding: 28px 28px 0;
}
.modal-cq .modal-body { padding: 16px 28px; }
.modal-cq .modal-footer {
    border-top: none; padding: 0 28px 28px;
    display: flex; justify-content: center; gap: 12px;
}
.modal-cq .modal-title {
    font-size: 18px; font-weight: 700; color: var(--text-primary);
}
.modal-cq .modal-body p {
    font-size: 14px; color: var(--text-secondary);
    text-align: center; margin: 0;
}
.modal-cq .modal-icon {
    width: 52px; height: 52px;
    border-radius: 50%; display: flex;
    align-items: center; justify-content: center;
    font-size: 22px; margin: 0 auto 16px;
}
.modal-cq .modal-icon.danger { background: #fff1f1; color: var(--danger); }
.modal-cq .modal-icon.warning { background: #fffbeb; color: #d97706; }

/* ── EMPTY STATE ── */
.empty-state { padding: 60px 24px; text-align: center; color: var(--text-secondary); }
.empty-state i { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; margin: 0; }

/* ── ALERTS ── */
.alert-custom {
    border-radius: 8px; padding: 12px 16px;
    font-size: 13px; margin-bottom: 20px; border: none;
}
.alert-success { background: #ecfdf5; color: #065f46; border-left: 3px solid #10b981; }
.alert-error   { background: #fff1f1; color: #991b1b; border-left: 3px solid var(--danger); }
.alert-warning { background: #fffbeb; color: #92400e; border-left: 3px solid #f59e0b; }

/* ── PAGINATION ── */
.pagination-cq {
    display: flex; justify-content: center;
    gap: 4px; padding: 20px 0;
}
.pagination-cq .page-link {
    border: 1px solid var(--border); border-radius: 6px;
    padding: 6px 12px; font-size: 13px;
    color: var(--text-secondary); background: #fff;
    text-decoration: none; transition: all 0.15s;
}
.pagination-cq .page-link:hover { background: var(--body-bg); color: var(--text-primary); }
.pagination-cq .page-item.active .page-link {
    background: var(--accent); color: #fff; border-color: var(--accent);
}
.pagination-cq .page-item.disabled .page-link { opacity: 0.4; pointer-events: none; }

.btn_filtrar {
    background: #3b6ef8 !important;
    border: 1px solid #3b6ef8 !important;
    color: white !important;
    border-radius: 8px !important;
    padding: 8px 20px !important;
}

.form-check-input.toggle-switch {
    width: 2rem;
    height: 1rem;
    cursor: pointer;
}

.form-check-input.toggle-switch:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.form-check-input.toggle-switch:focus {
    box-shadow: 0 0 0 0.2rem rgba(59,110,248,.25);
}

/* ── FORM SECTION — nota campos obligatorios ── */
.form-required-note {
    padding: 12px 24px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ── FORM SECTION — bordes compuestos (cards apiladas) ── */
.form-section-card-top {
    border-radius: 12px 12px 0 0;
    border-bottom: none;
    margin-bottom: 0;
}
.form-section-card-middle {
    border-radius: 0;
    border-bottom: none;
    margin-bottom: 0;
}
.form-section-card-bottom {
    border-radius: 0 0 12px 12px;
}

/* ── FORMSET — tabla con scroll horizontal ── */
.formset-table-wrapper {
    overflow-x: auto;
}

/* ── FORMSET — fila de botón agregar ── */
.formset-add-row {
    padding: 12px 24px;
    border-top: 1px solid var(--border);
}

/* ── FORMSET — errores no-form ── */
.formset-errors {
    margin: 0 0 0;
}

/* ── DETAIL — modo solo lectura ── */
.detail-readonly-note {
    padding: 16px 24px;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

/* ── FORM — texto de ayuda de campo ── */
.field-help {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
    margin-top: 4px;
}

.user-badge {
    cursor: pointer;
}

.user-avatar-img {
    width: 32px;
    height: 32px;
    object-fit: cover;
}

.user-chevron {
    font-size: 11px;
    color: #9ca3af;
    margin-left: 4px;
}

.overlay-spinner {
    position: fixed;
}

.table-fixed-layout {
    table-layout: fixed;
    width: 100%;
}

.btn-formset-add {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-fixed-layout td {
    overflow: hidden;
}

.stacked-list {
    overflow-y: scroll;
    height: 500px;
}
