/* Custom CSS for ABLTech Support System (Compact Enterprise Theme) */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --dark-sidebar: #0f172a;
    --dark-sidebar-hover: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-active-text: #ffffff;
    --card-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.03);
    --hover-shadow: 0 6px 12px -2px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f1f5f9;
    color: #1e293b;
    font-size: 0.85rem;
    line-height: 1.45;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   TÍTULOS Y ENCABEZADOS COMPACTOS
   ========================================================================== */
h1, .h1 { font-size: 1.35rem; font-weight: 700; line-height: 1.25; }
h2, .h2 { font-size: 1.20rem; font-weight: 700; line-height: 1.25; }
h3, .h3 { font-size: 1.05rem; font-weight: 600; line-height: 1.3; }
h4, .h4 { font-size: 0.95rem; font-weight: 600; line-height: 1.3; }
h5, .h5 { font-size: 0.875rem; font-weight: 600; line-height: 1.35; }
h6, .h6 { font-size: 0.80rem; font-weight: 600; line-height: 1.35; }

.page-title {
    font-size: 0.95rem;
    font-weight: 700;
}

.card-title {
    font-size: 0.85rem;
    font-weight: 600;
}

/* ==========================================================================
   SIDEBAR COMPACTO
   ========================================================================== */
.app-sidebar {
    width: 240px;
    background: var(--dark-sidebar);
    color: var(--sidebar-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    z-index: 1000;
}

.sidebar-brand {
    padding: 0.85rem 1.15rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand i {
    font-size: 1.2rem;
}

.sidebar-menu {
    list-style: none;
    padding: 0.65rem 0.5rem;
    margin: 0;
    flex-grow: 1;
}

.menu-header {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: #64748b;
    padding: 0.55rem 0.65rem 0.2rem;
}

.menu-item {
    margin-bottom: 0.15rem;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.65rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 0.375rem;
    font-weight: 500;
    font-size: 0.815rem;
    transition: all 0.15s ease;
}

.menu-link:hover {
    background: var(--dark-sidebar-hover);
    color: var(--sidebar-active-text);
}

.menu-link.active {
    background: var(--primary-color);
    color: #ffffff;
    font-weight: 600;
}

.menu-link i {
    width: 1.15rem;
    text-align: center;
    font-size: 0.9rem;
}

/* ==========================================================================
   LAYOUT Y CONTENIDO PRINCIPAL
   ========================================================================== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
}

.app-navbar {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.55rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.825rem;
}

.app-content {
    padding: 1.15rem 1.35rem;
    flex-grow: 1;
}

/* ==========================================================================
   CARDS Y CONTENEDORES
   ========================================================================== */
.card-custom {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-custom:hover {
    box-shadow: var(--hover-shadow);
}

.card-header {
    padding: 0.65rem 1rem;
    font-size: 0.825rem;
}

.card-body {
    padding: 1rem 1.15rem;
}

.card-footer {
    padding: 0.5rem 1rem;
    font-size: 0.775rem;
}

/* ==========================================================================
   INDICADORES Y KPIS
   ========================================================================== */
.kpi-card {
    border-radius: 0.5rem;
    padding: 0.85rem 1rem;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.kpi-card::after {
    content: '';
    position: absolute;
    right: -15px;
    bottom: -15px;
    width: 75px;
    height: 75px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.kpi-primary { background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%); }
.kpi-warning { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.kpi-danger  { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.kpi-success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.kpi-info    { background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%); }
.kpi-dark    { background: linear-gradient(135deg, #334155 0%, #1e293b 100%); }

.kpi-value {
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 0.15rem;
}

.kpi-label {
    font-size: 0.75rem;
    opacity: 0.92;
    font-weight: 600;
}

.kpi-icon {
    font-size: 1.75rem;
    opacity: 0.28;
}

/* Badges / Etiquetas */
.badge {
    font-size: 0.72rem;
    padding: 0.28em 0.55em;
    font-weight: 600;
    border-radius: 0.25rem;
}

/* ==========================================================================
   REGISTROS Y TABLAS
   ========================================================================== */
.table {
    font-size: 0.80rem;
    margin-bottom: 0;
}

.table th {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.5rem 0.65rem;
    color: #475569;
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.table td {
    font-size: 0.80rem;
    padding: 0.45rem 0.65rem;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: #f8fafc;
}

.table-sm th {
    padding: 0.35rem 0.5rem;
    font-size: 0.70rem;
}

.table-sm td {
    padding: 0.3rem 0.5rem;
    font-size: 0.76rem;
}

/* ==========================================================================
   CAMPOS Y ETIQUETAS DE FORMULARIOS
   ========================================================================== */
.form-label {
    font-size: 0.775rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.22rem;
}

.form-control, .form-select {
    font-size: 0.82rem;
    padding: 0.325rem 0.6rem;
    border-radius: 0.375rem;
    border-color: #cbd5e1;
    min-height: 33px;
    color: #1e293b;
}

.form-control:focus, .form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control-sm, .form-select-sm {
    font-size: 0.76rem;
    padding: 0.2rem 0.45rem;
    min-height: 28px;
    border-radius: 0.3rem;
}

.form-control-lg, .form-select-lg {
    font-size: 0.875rem;
    padding: 0.45rem 0.75rem;
    min-height: 38px;
}

.input-group-text {
    font-size: 0.80rem;
    padding: 0.325rem 0.55rem;
    color: #64748b;
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.form-text, .invalid-feedback, .valid-feedback {
    font-size: 0.72rem;
    margin-top: 0.2rem;
}

/* Botones */
.btn {
    font-size: 0.815rem;
    padding: 0.35rem 0.75rem;
    font-weight: 500;
    border-radius: 0.375rem;
}

.btn-sm {
    font-size: 0.75rem;
    padding: 0.2rem 0.45rem;
    border-radius: 0.3rem;
}

.btn-lg {
    font-size: 0.90rem;
    padding: 0.5rem 1rem;
}

/* ==========================================================================
   CICLO DE VIDA, BITÁCORAS Y COMPONENTES
   ========================================================================== */
.priority-pulse {
    animation: pulseGlow 1.8s infinite;
    font-weight: bold;
}

@keyframes pulseGlow {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(220, 53, 69, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

/* Visual Tracker de Ciclo de Vida */
.lifecycle-tracker {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 1rem 0.5rem;
    margin-bottom: 1rem;
}

.lifecycle-tracker::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 30px;
    right: 30px;
    height: 3px;
    background: #e2e8f0;
    transform: translateY(-50%);
    z-index: 1;
}

.lifecycle-step {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
}

.step-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #cbd5e1;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.80rem;
    transition: all 0.25s ease;
}

.lifecycle-step.active .step-icon {
    border-color: #2563eb;
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.lifecycle-step.completed .step-icon {
    border-color: #10b981;
    background: #10b981;
    color: #ffffff;
}

.step-title {
    margin-top: 0.35rem;
    font-size: 0.70rem;
    font-weight: 600;
    color: #64748b;
    text-align: center;
}

.lifecycle-step.active .step-title {
    color: #2563eb;
}

/* Timeline / Bitácora */
.timeline-feed {
    position: relative;
    padding-left: 1.75rem;
    list-style: none;
    margin: 0;
}

.timeline-feed::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 9px;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item {
    position: relative;
    margin-bottom: 1.15rem;
}

.timeline-marker {
    position: absolute;
    left: -1.75rem;
    top: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.timeline-marker.note-internal {
    background: #f59e0b;
}

.timeline-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    padding: 0.75rem 0.9rem;
    font-size: 0.815rem;
}

.timeline-card.internal-bg {
    background: #fffbeb;
    border-color: #fef3c7;
}

/* WhatsApp Button */
.btn-whatsapp {
    background-color: #25d366;
    color: #ffffff !important;
    font-weight: 600;
    border: none;
    transition: background 0.2s ease;
}

.btn-whatsapp:hover {
    background-color: #1eb956;
}

/* Attachments preview grid */
.attachment-thumb {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 0.375rem;
    border: 1px solid #e2e8f0;
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.attachment-thumb:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Lightbox Overlay */
#lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.87);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

#lightbox-overlay.active {
    display: flex;
}

#lightbox-img {
    max-width: 92vw;
    max-height: 84vh;
    border-radius: 0.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    object-fit: contain;
}

#lightbox-caption {
    margin-top: 0.65rem;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.80rem;
    text-align: center;
}

#lightbox-close {
    position: fixed;
    top: 1.15rem;
    right: 1.35rem;
    font-size: 1.75rem;
    color: #ffffff;
    cursor: pointer;
    background: rgba(0,0,0,0.4);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    border: none;
    line-height: 1;
}

#lightbox-close:hover {
    background: rgba(239, 68, 68, 0.7);
}

/* Paste/Drop zone improvements */
.paste-drop-zone {
    border: 2px dashed #93c5fd;
    border-radius: 0.375rem;
    background: #f0f9ff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.paste-drop-zone:hover, .paste-drop-zone.drag-over {
    background: #dbeafe;
    border-color: #2563eb;
}

/* Responsive */
@media (max-width: 768px) {
    .lifecycle-tracker { flex-wrap: wrap; gap: 0.5rem; }
    .lifecycle-tracker::before { display: none; }
    .app-sidebar { position: fixed; left: -240px; transition: left 0.3s ease; }
    .app-sidebar.open { left: 0; }
}

/* Print */
@media print {
    .app-sidebar, .app-navbar, .btn, form { display: none !important; }
    .app-content { padding: 0; }
    .card-custom { box-shadow: none; border: 1px solid #ccc; }
}
