/* Estilos globales */

/* Navbar: estilo cristal (glassmorphism) */
.navbar-translucent {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  margin: 8px 12px;
}

.navbar-translucent .container {
  padding-top: 6px;
  padding-bottom: 6px;
}

/* Logo en navbar */
.navbar-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  vertical-align: middle;
}

/* Botón gris-limón suave para navbar */
.btn.btn-limegray {
  --btn-bg: hsl(75, 18%, 72%);
  --btn-bg-hover: hsl(75, 20%, 68%);
  --btn-bg-active: hsl(75, 22%, 62%);
  --btn-border: hsl(75, 16%, 60%);
  color: #111 !important;
  background-color: var(--btn-bg) !important;
  border: 1px solid var(--btn-border) !important;
  border-radius: 9999px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  transition: background-color .15s ease, box-shadow .15s ease, transform .02s ease;
}
.btn.btn-limegray:hover {
  background-color: var(--btn-bg-hover) !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}
.btn.btn-limegray:active {
  background-color: var(--btn-bg-active) !important;
  transform: translateY(1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
.btn.btn-limegray .fas { color: inherit; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    line-height: 1.6;
}

/* Navbar personalizado */
.navbar-brand {
    font-weight: 600;
    font-size: 1.5rem;
}

/* Cards con efectos hover */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 15px;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15) !important;
}

/* Botones personalizados */
.btn {
    border-radius: 25px;
    font-weight: 500;
    padding: 12px 30px;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Formularios */
.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}

.form-control, .form-select {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 12px 15px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* ==================== TABLAS ==================== */
.table-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 2rem;
}

.table {
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* Encabezados de tabla: respeta estilos Bootstrap cuando se usa .table-dark */
.table thead:not(.table-dark) th {
    background: var(--primary-color, #0d6efd) !important;
    color: white !important;
    font-weight: 600;
    border: none;
    padding: 1rem 0.75rem;
    white-space: nowrap;
}

/* Asegura contraste alto cuando se usa .table-dark (fondo negro, texto blanco) */
.table thead.table-dark th {
    background-color: #212529 !important;
    color: #fff !important;
}

.table td {
    padding: 0.75rem;
    vertical-align: middle;
    border-color: #e9ecef;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
    transition: background-color 0.2s ease;
}

/* Estilos específicos para enlaces web */
.enlace-column {
    min-width: 200px;
    max-width: 250px;
}

.enlace-web {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.85rem;
    display: inline-block;
    max-width: 100%;
    word-break: break-all;
    line-height: 1.3;
}

.enlace-web:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

.enlace-web i {
    color: var(--secondary-color);
    font-size: 0.8rem;
}

/* Tabla responsiva mejorada */
.table-responsive {
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

@media (max-width: 1200px) {
    .table {
        font-size: 0.8rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.4rem;
    }
    
    .enlace-column {
        min-width: 150px;
        max-width: 180px;
    }
    
    .enlace-web {
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) {
    .table-responsive {
        border: 1px solid #dee2e6;
        border-radius: 8px;
    }
    
    .table {
        min-width: 800px; /* Fuerza scroll horizontal */
    }
    
    .enlace-column {
        min-width: 120px;
        max-width: 150px;
    }
    
    .enlace-web {
        font-size: 0.7rem;
        line-height: 1.2;
    }
}

/* Comentarios en tabla */
.comentario-cell {
    display: block;
    overflow: visible;
    white-space: normal;
    word-break: break-word;
    cursor: help;
}

/* Ampliar la columna Comentario en la tabla principal */
#tablaOrdenes th:nth-child(6),
#tablaOrdenes td:nth-child(6) {
    width: 35%;
}

/* Estilos para edición de estado en tabla */
.estado-editable {
    position: relative;
    display: inline-block;
}

.estado-badge {
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
}

.estado-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.estado-badge:hover .icono-editar {
    opacity: 1;
    transform: scale(1.1);
}

.icono-editar {
    font-size: 0.7rem;
    opacity: 0.7;
    transition: all 0.2s ease;
    margin-left: 4px;
}

.estado-selector {
    min-width: 120px;
    font-size: 0.85rem;
    border: 2px solid var(--primary-color);
    border-radius: 6px;
}

.estado-selector:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Animación para cambio de estado */
.estado-badge.updating {
    opacity: 0.7;
    transform: scale(0.95);
}

/* Contenedor de formulario */
.form-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    padding: 30px;
    margin-bottom: 30px;
}

/* Títulos de sección */
.section-title {
    color: #495057;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

/* Badges para estados */
.badge-reservado {
    background-color: #ffc107;
    color: #000;
}

.badge-rendido {
    background-color: #28a745;
    color: #fff;
}

/* Iconos */
.icon-large {
    font-size: 4rem;
    margin-bottom: 20px;
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .card-body {
        padding: 20px !important;
    }
    
    .btn-lg {
        padding: 10px 25px;
        font-size: 1rem;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .table-responsive {
        font-size: 0.9rem;
    }
}

/* Estilos para el selector de cantidad */
.quantity-selector {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    border: 2px solid #e9ecef;
}

.quantity-selector label {
    font-weight: 600;
    color: #495057;
}

/* Estilos para alertas */
.alert {
    border-radius: 10px;
    border: none;
    font-weight: 500;
}

.alert-success {
    background-color: #d1edff;
    color: #0c5460;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

/* Footer */
footer {
    margin-top: auto;
}

/* Loader */
.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0d6efd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Estilos para campos requeridos */
.required::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

/* Breadcrumb personalizado */
.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 20px;
}

.breadcrumb-item a {
    color: #0d6efd;
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

/* Estilos para el calendario */
input[type="date"] {
    position: relative;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    background: transparent;
    bottom: 0;
    color: transparent;
    cursor: pointer;
    height: auto;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: auto;
}

/* ==================== INICIO (PORTADA) ==================== */
/* Título principal un poco más pequeño */
.main-title {
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
@media (max-width: 992px) {
  .main-title { font-size: 2.25rem; }
}

/* Hora más grande y visible */
#reloj {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.reloj-wrapper .fa-clock {
  font-size: 1.7rem;
}
@media (max-width: 992px) {
  #reloj { font-size: 2rem; }
  .reloj-wrapper .fa-clock { font-size: 1.5rem; }
}

/* Tarjetas compactas para OS/OC */
.card.card-compact .card-body {
  padding: 1.75rem !important;
}
.card.card-compact .card-title {
  font-size: 1.25rem;
}
.card.card-compact .card-text {
  margin-bottom: 1rem;
}
.card.card-compact .btn {
  padding: 10px 22px;
  font-size: 0.95rem;
}
.icon-compact {
  font-size: 3.2rem;
}

/* Icono del título al lado y con el mismo color */
.main-title i {
  color: inherit;
  vertical-align: middle;
}

/* ==================== Caja Chica (CJ) ==================== */
.text-cj {
  color: #198754 !important; /* Bootstrap green */
}
.btn.btn-cj {
  background-color: #198754 !important;
  border-color: #146c43 !important;
  color: #fff !important;
}
.btn.btn-cj:hover {
  background-color: #146c43 !important;
  border-color: #0f5132 !important;
}

/* ==================== TEMAS POR PÁGINA (OC/OS) ==================== */
/* Orden de Compra: rojo oscuro */
body.orden-compra .bg-info {
  background-color: #8B0000 !important; /* DarkRed */
}
body.orden-compra .text-info {
  color: #8B0000 !important;
}
body.orden-compra .btn.btn-info {
  background-color: #8B0000 !important;
  border-color: #5A0000 !important;
  color: #fff !important;
}
body.orden-compra .btn.btn-info:hover {
  background-color: #5A0000 !important;
  border-color: #3C0000 !important;
}
/* Encabezados de tabla y footer */
body.orden-compra .table-info th {
  background-color: #8B0000 !important;
  color: #fff !important;
}
/* Variables y estilos de formularios para compras */
body.orden-compra {
  --primary-color: #8B0000;
  --secondary-color: #5A0000;
}
body.orden-compra .alert.alert-info {
  background-color: #F5D7D7 !important; /* rojo muy claro */
  color: #5A0000 !important;
  border-color: #8B0000 !important;
}
body.orden-compra .form-control:focus,
body.orden-compra .form-select:focus {
  border-color: #8B0000 !important;
  box-shadow: 0 0 0 0.2rem rgba(139, 0, 0, 0.25) !important;
}

/* Orden de Servicio: azul claro */
body.orden-servicio .bg-success {
  background-color: #1E3A8A !important; /* Dark Blue */
}
body.orden-servicio .text-success {
  color: #1E3A8A !important;
}
body.orden-servicio .btn.btn-success {
  background-color: #1E3A8A !important;
  border-color: #162C66 !important;
  color: #fff !important;
}
body.orden-servicio .btn.btn-success:hover {
  background-color: #162C66 !important;
  border-color: #0F1F4D !important;
}
body.orden-servicio .table-success th {
  background-color: #1E3A8A !important;
  color: #fff !important;
}
/* Variables y estilos de formularios para servicio */
body.orden-servicio {
  --primary-color: #1E3A8A;
  --secondary-color: #162C66;
}
body.orden-servicio .alert.alert-info {
  background-color: #D6E4FF !important; /* azul muy claro */
  color: #162C66 !important;
  border-color: #1E3A8A !important;
}
body.orden-servicio .form-control:focus,
body.orden-servicio .form-select:focus {
  border-color: #1E3A8A !important;
  box-shadow: 0 0 0 0.2rem rgba(30, 58, 138, 0.25) !important;
}

/* Portada (Inicio): aplicar colores pedidos a OS y OC */
body.inicio .text-success { /* OS en portada -> azul oscuro */
  color: #1E3A8A !important;
}
body.inicio .btn.btn-success {
  background-color: #1E3A8A !important;
  border-color: #162C66 !important;
  color: #fff !important;
}
body.inicio .btn.btn-success:hover {
  background-color: #162C66 !important;
  border-color: #0F1F4D !important;
}
body.inicio .text-info { /* OC en portada -> rojo oscuro */
  color: #8B0000 !important;
}
body.inicio .btn.btn-info {
  background-color: #8B0000 !important;
  border-color: #5A0000 !important;
  color: #fff !important;
}
body.inicio .btn.btn-info:hover {
  background-color: #5A0000 !important;
  border-color: #3C0000 !important;
}
