/* ==========================================================================
   FERROLAMINAS - DASHBOARD DE INVENTARIOS & METRICAS (EXECUTIVE SUITE)
   ========================================================================== */

/* Bootstrap 5 Modal integration with Supervisores PWA (Mobile & Desktop) */
.modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 1060 !important;
  width: 100vw !important;
  height: 100vh !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  outline: 0 !important;
  background: transparent !important;
  display: none !important;
}

.modal.show,
.modal.fade.show {
  display: block !important;
  opacity: 1 !important;
}

.modal.fade {
  display: none !important;
  opacity: 0;
  transition: opacity 0.15s linear;
}

.modal-dialog {
  position: relative !important;
  z-index: 1065 !important;
  width: calc(100% - 1rem) !important;
  max-width: 96% !important;
  margin: 0.5rem auto !important;
  pointer-events: auto !important;
}

@media (min-width: 576px) {
  .modal-dialog {
    width: 95% !important;
    max-width: 540px !important;
    margin: 1.75rem auto !important;
  }
}
@media (min-width: 768px) {
  .modal-dialog {
    width: 90% !important;
    max-width: 720px !important;
  }
}
@media (min-width: 992px) {
  .modal-dialog {
    width: 85% !important;
    max-width: 960px !important;
  }
  .modal-lg { max-width: 900px !important; }
}
@media (min-width: 1200px) {
  .modal-dialog {
    width: 80% !important;
    max-width: 1140px !important;
  }
  .modal-xl { max-width: 1200px !important; }
}

.modal-content {
  position: relative !important;
  z-index: 1070 !important;
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  max-height: calc(100vh - 1rem) !important;
  color: #1e293b;
  pointer-events: auto !important;
  background-color: #fff !important;
  background-clip: padding-box;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 16px !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  outline: 0;
  overflow: hidden !important;
}

.modal-backdrop {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 1050 !important;
  width: 100vw !important;
  height: 100vh !important;
  background-color: #0f172a !important;
}

.modal-backdrop.fade {
  opacity: 0 !important;
}

.modal-backdrop.show {
  opacity: 0.6 !important;
}

.modal-header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
}

.modal-body {
  position: relative !important;
  flex: 1 1 auto !important;
  padding: 1rem 1.25rem;
  max-height: calc(100vh - 150px) !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  flex-shrink: 0;
  align-items: center;
  justify-content: flex-end;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid #f1f5f9;
  gap: 0.5rem;
}

.btn-close {
  box-sizing: content-box;
  width: 1em;
  height: 1em;
  padding: .25em .25em;
  color: #000;
  background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
  border: 0;
  border-radius: .375rem;
  opacity: .5;
  cursor: pointer;
}

.btn-close:hover {
  opacity: .85;
}

.btn-close-white {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* Red theme buttons matching Ferroláminas executive screenshots */
.btn-ferro-red {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
  color: #ffffff !important;
  border: none !important;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.btn-ferro-red:hover {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.35);
}

/* Custom scrollbars */
.modal-body::-webkit-scrollbar,
#containerTablaModal::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.modal-body::-webkit-scrollbar-track,
#containerTablaModal::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track {
  background: #f1f5f9;
}
.modal-body::-webkit-scrollbar-thumb,
#containerTablaModal::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* Original Template Styles */


    .progress-bar {
        transition: width 1s ease-in-out;
    }

    .table thead th {
        font-weight: 700;
        font-size: 0.75rem;
        text-transform: uppercase;
        color: #636e72;
        padding: 1.25rem 1rem;
        border-bottom: 2px solid #f1f3f5;
    }

    .table tbody td {
        padding: 1.2rem 1rem;
        font-size: 0.95rem;
    }

    .badge-percent {
        font-weight: 700;
        padding: 0.5rem 0.8rem;
        border-radius: 8px;
        min-width: 65px;
        text-align: center;
        display: inline-block;
    }

    .effectiveness-high {
        background: #ebfbee;
        color: #40c057;
    }

    .effectiveness-mid {
        background: #fff4e6;
        color: #fd7e14;
    }

    .effectiveness-low {
        background: #fff5f5;
        color: #fa5252;
    }

    .sync-spin {
        animation: spin 0.8s linear infinite;
    }

    .clickable-badge {
        cursor: pointer;
        transition: all 0.2s ease;
        border: 1px solid transparent !important;
        background-color: #f8f9fa !important;
        font-weight: 500;
        border-radius: 6px !important;
    }

    .clickable-badge:hover {
        background-color: #fce4ec !important;
        border-color: #f06292 !important;
        color: #d81b60 !important;
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .modal-td {
        padding: 0.85rem 1rem !important;
        font-size: 0.85rem !important;
    }

    .pill-badge {
        font-size: 0.65rem !important;
        font-weight: 700;
        padding: 0.4rem 0.8rem !important;
        border-radius: 30px !important;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    @keyframes spin {
        100% {
            transform: rotate(360deg);
        }
    }

    /* --- MASTER PREMIUM STYLES --- */
    .master-card {
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1) !important;
    }

    .master-card:hover {
        transform: translateY(-8px) scale(1.01);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08) !important;
    }

    .glass-effect {
        background: rgba(255, 255, 255, 0.7) !important;
        backdrop-filter: blur(12px) saturate(180%);
        -webkit-backdrop-filter: blur(12px) saturate(180%);
    }

    .top-performer-row {
        background: linear-gradient(90deg, rgba(255, 215, 0, 0.08) 0%, rgba(255, 255, 255, 0) 100%) !important;
        position: relative;
    }

    .top-performer-row::after {
        content: '\f091';
        /* fa-medal */
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        position: absolute;
        left: 5px;
        top: 50%;
        transform: translateY(-50%);
        color: #ffca28;
        font-size: 0.8rem;
    }

    .pulse-urgent {
        animation: pulse-red 2s infinite;
        border: 2px solid #fa5252 !important;
    }

    @keyframes pulse-red {
        0% {
            box-shadow: 0 0 0 0 rgba(250, 82, 82, 0.4);
        }

        70% {
            box-shadow: 0 0 0 10px rgba(250, 82, 82, 0);
        }

        100% {
            box-shadow: 0 0 0 0 rgba(250, 82, 82, 0);
        }
    }

    .insight-tag {
        font-size: 0.6rem;
        font-weight: 800;
        letter-spacing: 1px;
        text-transform: uppercase;
        padding: 2px 8px;
        border-radius: 4px;
    }

    /* Sticky Headers for Master Level UX */
    #tablaMetricas thead th {
        position: sticky !important;
        top: 0 !important;
        z-index: 10 !important;
        background-color: #f8f9fa !important;
        box-shadow: inset 0 -1px 0 #dee2e6, 0 2px 5px rgba(0, 0, 0, 0.1);
        border-bottom: none !important;
    }

    #containerTablaModal thead th {
        position: sticky !important;
        top: 0 !important;
        z-index: 10 !important;
        background-color: #ffffff !important;
        box-shadow: inset 0 -1px 0 #dee2e6;
        border-bottom: none !important;
    }

    #tablaMetricas,
    #containerTablaModal table {
        border-collapse: separate !important;
        border-spacing: 0 !important;
    }

    /* Force overflow visible on parents to prevent sticky breaking */
    .card,
    .card-body,
    .table-responsive,
    .content-wrapper,
    .main-content {
        overflow: visible !important;
    }

    /* Keep scroller only on main wrapper */
    .content-wrapper {
        overflow-y: auto !important;
    }

    /* Prevent Bootstrap table-responsive from breaking sticky */
    .table-responsive {
        overflow: visible !important;
    }

    #containerTablaModal {
        overflow-y: auto !important;
        overflow-x: auto !important;
    }

    /* --- MASTER SUMMARY CARDS ANIMATIONS --- */
    .summary-card {
        border-radius: 12px;
        border-left: 4px solid #4b6cb7;
        height: 100%;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        cursor: default;
        position: relative;
    }

    .summary-card:hover {
        transform: translateY(-8px) scale(1.02);
        box-shadow: 0 15px 30px rgba(75, 108, 183, 0.15) !important;
        background-color: #fff;
    }

    .summary-card .bg-navy {
        transition: all 0.4s ease;
    }

    .summary-card:hover .bg-navy {
        transform: rotate(10deg) scale(1.1);
        background-color: #4b6cb7 !important;
        color: white !important;
    }

    .summary-card:hover .bg-navy i {
        color: white !important;
    }

    .summary-card:hover .text-navy {
        filter: brightness(1.1);
    }

    .bg-navy {
        background-color: #182848 !important;
        /* Navy */
    }

    .text-navy {
        color: #4b6cb7 !important;
        /* Navy Lighter */
    }

    .bg-opacity-10 {
        --bs-bg-opacity: 0.1;
    }


  * { margin: 0; padding: 0; box-sizing: border-box; }
  body { font-family: 'Segoe UI', Arial, sans-serif; color: #111; background: #fff; }
  .header { background: linear-gradient(135deg,#0f766e,#134e4a); color: white; padding: 20px 28px 16px; }
  .header h1 { font-size: 17px; font-weight: 700; margin-bottom: 3px; }
  .header p  { font-size: 10px; opacity: .75; text-transform: uppercase; letter-spacing: .5px; }
  .meta { display: flex; gap: 12px; padding: 12px 28px; background: #f8fafb; border-bottom: 1px solid #e5e7eb; flex-wrap: wrap; align-items: center; }
  .pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 9.5px; font-weight: 700; }
  .pill-green { background: rgba(21,128,61,.12); color: #15803d; border: 1px solid rgba(21,128,61,.25); }
  .pill-red   { background: rgba(220,38,38,.1);  color: #dc2626; border: 1px solid rgba(220,38,38,.2); }
  .pill-gold  { background: rgba(161,98,7,.1);   color: #a16207; border: 1px solid rgba(161,98,7,.2); }
  .filter-label { margin-left: auto; font-size: 9px; color: #6b7280; font-style: italic; }
  .progress-wrap { padding: 10px 28px 8px; }
  .progress-label { display: flex; justify-content: space-between; font-size: 9px; color: #6b7280; margin-bottom: 4px; }
  .progress-track { height: 7px; border-radius: 6px; background: #e5e7eb; overflow: hidden; }
  .progress-fill  { height: 7px; border-radius: 6px; background: linear-gradient(90deg,#0f766e,#14b8a6); }
  table { width: 100%; border-collapse: collapse; margin: 0 0 24px; }
  thead th { background: #f1f5f9; padding: 7px 8px; font-size: 9.5px; font-weight: 700; text-transform: uppercase; color: #374151; border-bottom: 2px solid #cbd5e1; letter-spacing: .3px; }
  .wrap { padding: 0 28px; }
  .footer-print { margin: 16px 28px 0; padding-top: 10px; border-top: 1px solid #e5e7eb; display: flex; justify-content: space-between; font-size: 8.5px; color: #9ca3af; }
  @page { margin: 14mm 12mm; size: A4 portrait; }
  @media print { body { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }


