/* ============================================
   vis/css/obr.css (completo)
   ============================================ */
/**
 * =============================================
 * OBR.CSS ENTERPRISE v1.0.0
 * =============================================
 * Estilos específicos para el módulo de Pedidos de Obras
 * Design: Fluent Design + Material Design Fusion
 * Complementa a estilos.css sin duplicar
 * 
 * @version 1.0.0 Enterprise
 * @author Chief Enterprise Architect
 * =============================================
 */

/* =========================================================================
   VARIABLES Y TEMAS
   ========================================================================= */
:root {
    --obr-primary: #667eea;
    --obr-secondary: #764ba2;
    --obr-success: #48c774;
    --obr-warning: #ffd83d;
    --obr-danger: #f14668;
    --obr-info: #3e8ed0;
    --obr-light: #f5f7fa;
    --obr-dark: #363636;

    --obr-card-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --obr-hover-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --obr-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================================================
   ANIMACIONES FLUIDAS
   ========================================================================= */
@keyframes obr-fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes obr-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

@keyframes obr-shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* =========================================================================
   CARD COMPONENTS - FLUENT DESIGN
   ========================================================================= */
.obr-card {
    position: relative;
    background: white;
    border: none;
    transition: var(--obr-transition);
    animation: obr-fadeInUp 0.5s ease-out;
}

.obr-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--obr-hover-shadow) !important;
}

.obr-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(
        90deg,
        var(--obr-primary),
        var(--obr-secondary)
    );
    border-radius: 4px 4px 0 0;
    opacity: 0;
    transition: var(--obr-transition);
}

.obr-card:hover::before {
    opacity: 1;
}

/* =========================================================================
   FORMULARIOS - MATERIAL DESIGN
   ========================================================================= */
.obr-form-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.obr-input,
.obr-select,
.obr-textarea {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: var(--obr-transition);
    background: white;
    width: 100%;
}

.obr-input:focus,
.obr-select:focus,
.obr-textarea:focus {
    border-color: var(--obr-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.obr-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #4a5568;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Floating Label Effect */
.floating-label-group {
    position: relative;
}

.floating-label-group .obr-label {
    position: absolute;
    top: -0.5rem;
    left: 0.75rem;
    background: white;
    padding: 0 0.5rem;
    font-size: 0.75rem;
    color: var(--obr-primary);
    z-index: 1;
}

/* =========================================================================
   BOTONES CON EFECTOS FLUIDOS
   ========================================================================= */
.obr-btn-submit {
    position: relative;
    overflow: hidden;
    background: linear-gradient(
        135deg,
        var(--obr-primary),
        var(--obr-secondary)
    );
    border: none;
    color: white;
    font-weight: 600;
    letter-spacing: 0.05em;
    transition: var(--obr-transition);
}

.obr-btn-submit:hover {
    transform: scale(1.05);
    box-shadow: var(--obr-hover-shadow);
}

.obr-btn-submit::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(30deg);
    animation: obr-shimmer 3s infinite;
    pointer-events: none;
}

.obr-btn-cancel {
    background: #f8f9fa;
    color: #4a5568;
    border: 2px solid #e2e8f0;
    transition: var(--obr-transition);
}

.obr-btn-cancel:hover {
    background: #e2e8f0;
    border-color: #cbd5e0;
    transform: translateY(-2px);
}

/* =========================================================================
   TABLA DE DETALLE - MODERNA
   ========================================================================= */
.obr-detalle-table {
    border-collapse: separate;
    border-spacing: 0 0.5rem;
}

.obr-detalle-table thead th {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #2d3748;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: none;
    padding: 1rem;
}

.obr-detalle-table tbody tr {
    background: white;
    border-radius: 8px;
    transition: var(--obr-transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.obr-detalle-table tbody tr:hover {
    transform: scale(1.01);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    background: #fafbff;
}

.obr-detalle-table tbody td {
    padding: 1rem;
    border: none;
    vertical-align: middle;
}

.obr-detalle-table tbody td.editable {
    cursor: pointer;
    position: relative;
}

.obr-detalle-table tbody td.editable:hover::after {
    content: '✎';
    position: absolute;
    right: 5px;
    top: 5px;
    color: var(--obr-primary);
    font-size: 14px;
}

/* =========================================================================
   CALENDARIO - EVENTOS PERSONALIZADOS
   ========================================================================= */
.obr-calendar-event {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.obr-calendar-cliente {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.obr-calendar-producto {
    font-size: 0.75rem;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.obr-calendar-resumen {
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 2px;
}

/* =========================================================================
   MODAL DE PRODUCTOS
   ========================================================================= */
#modalProducto .modal-content {
    animation: obr-fadeInUp 0.3s ease-out;
}

#modalProducto .bg-gradient-primary {
    background: linear-gradient(
        135deg,
        var(--obr-primary),
        var(--obr-secondary)
    );
}

#modalProducto .bg-gradient-warning {
    background: linear-gradient(135deg, #f7971e, #ffd200);
}

/* =========================================================================
   BADGES Y ETIQUETAS
   ========================================================================= */
.obr-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.obr-badge-pendiente {
    background: #fef3c7;
    color: #92400e;
}

.obr-badge-aprobado {
    background: #d1fae5;
    color: #065f46;
}

.obr-badge-cancelado {
    background: #fee2e2;
    color: #991b1b;
}

/* =========================================================================
   FILE UPLOAD PERSONALIZADO
   ========================================================================= */
.obr-file-upload {
    position: relative;
    display: inline-block;
    width: 100%;
}

.obr-file-upload .custom-file-label {
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 0.75rem;
    background: #f8fafc;
    transition: var(--obr-transition);
}

.obr-file-upload .custom-file-label::after {
    background: var(--obr-primary);
    color: white;
    border-radius: 6px;
    height: calc(100% - 4px);
    top: 2px;
    right: 2px;
}

.obr-file-upload:hover .custom-file-label {
    border-color: var(--obr-primary);
    background: #f0f5ff;
}

/* =========================================================================
   RESPONSIVE DESIGN
   ========================================================================= */
@media (max-width: 768px) {
    .obr-card {
        margin-bottom: 1rem;
    }

    .obr-detalle-table {
        font-size: 0.85rem;
    }

    .obr-detalle-table tbody td {
        padding: 0.5rem;
    }

    .obr-btn-submit,
    .obr-btn-cancel {
        width: 100%;
        margin: 0.5rem 0;
    }
}

/* =========================================================================
   LOADING STATES
   ========================================================================= */
.obr-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.obr-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin-top: -15px;
    margin-left: -15px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--obr-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* =========================================================================
   PRINT STYLES
   ========================================================================= */
@media print {
    .obr-card {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }

    .obr-btn-submit,
    .obr-btn-cancel,
    .btn-eliminar-producto {
        display: none !important;
    }
}

/* =========================================================================
   ENTERPRISE PEDIDOS 2.1 - CALENDARIO Y FORMULARIO
   ========================================================================= */
:root {
    --obr-surface: #ffffff;
    --obr-page: #f4f7fb;
    --obr-line: #d8e0ea;
    --obr-text: #172033;
    --obr-muted: #65758b;
    --obr-blue: #2563eb;
    --obr-blue-soft: #eaf1ff;
    --obr-teal: #0f766e;
    --obr-amber: #b7791f;
    --obr-red: #b42318;
    --obr-shadow-soft: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.obr-module {
    --obr-surface: #ffffff;
    --obr-page: #f4f7fb;
    --obr-line: #d8e0ea;
    --obr-text: #172033;
    --obr-muted: #65758b;
    --obr-blue: #2563eb;
    --obr-blue-soft: #eaf1ff;
    --obr-teal: #0f766e;
    --obr-amber: #b7791f;
    --obr-red: #b42318;
    --obr-shadow-soft: 0 12px 32px rgba(15, 23, 42, 0.08);
    background: var(--obr-page);
}

.obr-calendar-page {
    min-height: calc(100vh - 120px);
}

.obr-calendar-hero {
    padding: 22px 0 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
    border-bottom: 1px solid var(--obr-line);
}

.obr-eyebrow {
    color: var(--obr-muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.obr-page-heading {
    color: var(--obr-text);
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.15;
    margin: 6px 0 8px;
}

.obr-page-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--obr-muted);
    font-size: 0.9rem;
}

.obr-page-meta span {
    background: #eef4fb;
    border: 1px solid #dbe7f3;
    border-radius: 999px;
    padding: 4px 10px;
}

.obr-btn-primary,
.obr-btn-soft {
    border-radius: 8px;
    font-weight: 700;
    min-height: 38px;
}

.obr-btn-primary {
    background: var(--obr-blue);
    border-color: var(--obr-blue);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.obr-btn-soft {
    background: #ffffff;
    border: 1px solid var(--obr-line);
    color: var(--obr-text);
}

.obr-calendar-shell {
    padding: 16px 0 28px;
}

.obr-filter-panel,
.obr-calendar-card {
    background: var(--obr-surface);
    border: 1px solid var(--obr-line);
    border-radius: 8px;
    box-shadow: var(--obr-shadow-soft);
}

.obr-filter-panel {
    padding: 16px;
    margin-bottom: 14px;
}

.obr-filter-label {
    color: var(--obr-text);
    display: block;
    font-size: 0.78rem;
    font-weight: 800;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.obr-filter-control,
.obr-form .form-control,
.obr-input,
.obr-select,
.obr-textarea {
    border: 1px solid var(--obr-line);
    border-radius: 8px !important;
    min-height: 42px;
}

.obr-filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.obr-calendar-card {
    overflow: visible;
    position: relative;
}

.obr-calendar-card.is-loading::after {
    align-items: center;
    background: rgba(255, 255, 255, 0.74);
    border-radius: 8px;
    color: var(--obr-blue);
    content: 'Actualizando calendario...';
    display: flex;
    font-weight: 800;
    inset: 0;
    justify-content: center;
    position: absolute;
    z-index: 20;
}

.obr-calendar-toolbar {
    align-items: center;
    border-bottom: 1px solid var(--obr-line);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
}

.obr-calendar-toolbar h2 {
    color: var(--obr-text);
    font-size: 1rem;
    font-weight: 800;
    margin: 0;
}

.obr-calendar-toolbar span {
    color: var(--obr-muted);
    font-size: 0.88rem;
}

.obr-calendar-surface {
    min-height: 720px;
    padding: 10px 12px 16px;
}

.obr-calendar-legend {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.obr-legend-item {
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--obr-line);
    border-radius: 999px;
    color: var(--obr-text) !important;
    display: inline-flex;
    font-weight: 700;
    gap: 6px;
    padding: 5px 10px;
}

.obr-dot {
    border-radius: 999px;
    display: inline-block;
    height: 9px;
    width: 9px;
}

.obr-dot-p {
    background: var(--obr-amber);
}
.obr-dot-a {
    background: var(--obr-teal);
}
.obr-dot-c {
    background: var(--obr-red);
}

.obr-calendar-page .fc {
    color: var(--obr-text);
    font-family: 'Roboto', 'Source Sans Pro', Arial, sans-serif;
}

.obr-calendar-page .fc .fc-toolbar-title {
    color: var(--obr-text);
    font-size: 1.12rem;
    font-weight: 800;
    text-transform: capitalize;
}

.obr-calendar-page .fc .fc-button {
    background: #ffffff;
    border: 1px solid var(--obr-line);
    border-radius: 8px;
    color: var(--obr-text);
    font-weight: 800;
    min-height: 34px;
    text-transform: capitalize;
}

.obr-calendar-page .fc .fc-button-primary:not(:disabled).fc-button-active,
.obr-calendar-page .fc .fc-button-primary:not(:disabled):active,
.obr-calendar-page .fc .fc-button:hover {
    background: var(--obr-blue);
    border-color: var(--obr-blue);
    color: #ffffff;
}

.obr-calendar-page .fc-theme-standard td,
.obr-calendar-page .fc-theme-standard th,
.obr-calendar-page .fc-scrollgrid {
    border-color: #e5ebf3;
}

.obr-calendar-page .fc-col-header-cell {
    background: #f8fafc;
}

.obr-calendar-page .fc-col-header-cell-cushion,
.obr-calendar-page .fc-timegrid-slot-label-cushion {
    color: var(--obr-muted);
    font-weight: 800;
}

.obr-fc-event {
    background: #ffffff !important;
    border: 1px solid var(--obr-line) !important;
    border-left: 4px solid var(--obr-event-accent) !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.1);
    color: var(--obr-text) !important;
    cursor: pointer;
    overflow: hidden;
    transition:
        box-shadow 0.18s ease,
        transform 0.18s ease;
}

.obr-fc-event:hover,
.obr-fc-event:focus {
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.18);
    transform: translateY(-1px);
}

.obr-fc-event.is-approved {
    background: #f0fdfa !important;
}
.obr-fc-event.is-pending {
    background: #fffbeb !important;
}
.obr-fc-event.is-cancelled {
    background: #fff1f2 !important;
}

.obr-calendar-event {
    gap: 2px;
    min-width: 0;
    padding: 4px 6px;
}

.obr-calendar-event-title {
    align-items: center;
    color: var(--obr-text);
    display: flex;
    font-size: 0.82rem;
    font-weight: 800;
    gap: 6px;
    line-height: 1.15;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.obr-calendar-event-title span {
    border-radius: 999px;
    flex: 0 0 auto;
    height: 8px;
    width: 8px;
}

.obr-calendar-event-product,
.obr-calendar-event-metrics {
    color: var(--obr-muted);
    font-size: 0.72rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.obr-calendar-event-metrics {
    color: var(--obr-text);
}

.obr-calendar-tooltip {
    background: #ffffff;
    border: 1px solid var(--obr-line);
    border-radius: 8px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
    color: var(--obr-text);
    left: 0;
    max-width: min(460px, calc(100vw - 28px));
    opacity: 0;
    padding: 16px;
    pointer-events: none;
    position: fixed;
    top: 0;
    transform: translateY(6px);
    transition:
        opacity 0.12s ease,
        transform 0.12s ease;
    width: 460px;
    z-index: 2050;
}

.obr-calendar-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.obr-tooltip-head {
    align-items: flex-start;
    border-bottom: 1px solid var(--obr-line);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding-bottom: 10px;
}

.obr-tooltip-kicker,
.obr-tooltip-section span,
.obr-tooltip-grid span {
    color: var(--obr-muted);
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.obr-tooltip-head h3 {
    color: var(--obr-text);
    font-size: 1.08rem;
    font-weight: 900;
    line-height: 1.25;
    margin: 2px 0 0;
}

.obr-tooltip-status {
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 900;
    padding: 5px 9px;
    white-space: nowrap;
}

.obr-tooltip-status.is-approved {
    background: #ccfbf1;
    color: #115e59;
}
.obr-tooltip-status.is-pending {
    background: #fef3c7;
    color: #92400e;
}
.obr-tooltip-status.is-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.obr-tooltip-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px 0;
}

.obr-tooltip-grid strong {
    color: var(--obr-text);
    display: block;
    font-size: 0.9rem;
    margin-top: 2px;
}

.obr-tooltip-section {
    border-top: 1px solid #edf2f7;
    padding: 10px 0 0;
}

.obr-tooltip-section p,
.obr-tooltip-note {
    color: var(--obr-text);
    font-size: 0.9rem;
    line-height: 1.35;
    margin: 3px 0 0;
}

.obr-tooltip-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 10px;
}

.obr-tooltip-foot span {
    background: #f8fafc;
    border: 1px solid var(--obr-line);
    border-radius: 999px;
    color: var(--obr-muted);
    font-size: 0.76rem;
    font-weight: 800;
    padding: 4px 8px;
}

.obr-tooltip-note {
    background: #f8fafc;
    border-left: 3px solid var(--obr-blue);
    border-radius: 6px;
    margin-top: 10px;
    padding: 8px 10px;
}

.obr-form .obr-card,
.obr-form .card,
#modalProducto .modal-content {
    border-radius: 8px !important;
}

.obr-form .obr-card:hover {
    box-shadow: var(--obr-shadow-soft) !important;
    transform: none;
}

.obr-form .card-header {
    border-bottom: 1px solid var(--obr-line) !important;
    padding: 16px 18px !important;
}

.obr-form .card-title {
    color: var(--obr-text);
    font-size: 1rem;
    font-weight: 800;
}

.obr-support-grid {
    align-items: stretch;
    border-top: 1px solid var(--obr-line);
    margin-top: 12px;
    padding-top: 16px;
}

.obr-trace-card {
    background: #f8fafc;
    border: 1px solid var(--obr-line);
    border-radius: 8px;
    color: var(--obr-muted);
    display: flex;
    flex-direction: column;
    height: calc(100% - 1rem);
    justify-content: center;
    margin-bottom: 1rem;
    padding: 12px 14px;
}

.obr-trace-card span {
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.obr-trace-card strong {
    color: var(--obr-text);
    font-size: 1rem;
}

.obr-trace-card small {
    color: var(--obr-muted);
    font-weight: 600;
}

.obr-form.was-validated .form-control:invalid,
.obr-form .form-control.is-invalid {
    border-color: var(--obr-red) !important;
    box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.08) !important;
}

.obr-form .form-control.is-valid {
    border-color: var(--obr-teal) !important;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.08) !important;
}

.obr-select2-invalid .select2-selection,
.obr-select2-invalid .select2-selection--single {
    border-color: var(--obr-red) !important;
}

.obr-file-upload .custom-file-label {
    border-radius: 8px !important;
    height: 42px;
    line-height: 1.55;
}

.obr-cpe-group {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.obr-cpe-btn {
    border-radius: 8px !important;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
}

.obr-detalle-table thead th {
    background: #f8fafc;
}

.obr-total-row td {
    background: var(--obr-blue-soft);
}

@media (max-width: 991.98px) {
    .obr-filter-actions,
    .obr-calendar-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .obr-calendar-legend {
        justify-content: flex-start;
    }
}

@media (max-width: 575.98px) {
    .obr-page-heading {
        font-size: 1.45rem;
    }

    .obr-cpe-group {
        grid-template-columns: 1fr;
    }

    .obr-tooltip-grid {
        grid-template-columns: 1fr;
    }
}
