/* Modern Design System - Envíos Gorras Keko */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --border-color: #334155;
    --text-main: #f8fafc;
    --text-subtle: #94a3b8;
    --accent-blue: #38bdf8;
    --accent-emerald: #10b981;
    --accent-purple: #a855f7;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --radius-md: 12px;
    --radius-lg: 18px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: 3rem;
}

/* Header Navbar */
.navbar {
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.dino-logo-badge {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(16, 185, 129, 0.25));
    border: 1.5px solid rgba(56, 189, 248, 0.4);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dino-logo-badge:hover {
    transform: scale(1.05) rotate(-4deg);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
}

.dino-title-wrap {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.dino-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    background: linear-gradient(135deg, #38bdf8 0%, #34d399 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    line-height: 1;
    filter: drop-shadow(0 2px 8px rgba(56, 189, 248, 0.25));
}

/* Indicador de Sincronización con la Nube */
.sync-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
    transition: all 0.4s ease;
    white-space: nowrap;
}

.sync-indicator.sync-loading {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.3);
    color: #38bdf8;
    animation: sync-pulse 1.5s ease-in-out infinite;
}

.sync-indicator.sync-saving {
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.3);
    color: #fbbf24;
    animation: sync-pulse 1s ease-in-out infinite;
}

.sync-indicator.sync-saved {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.sync-indicator.sync-error {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.sync-indicator.sync-offline {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

.sync-indicator.sync-idle {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

@keyframes sync-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.55; }
}


/* Header Sleek Navigation Tabs */
.header-nav-tabs {
    display: inline-flex;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 30px;
    padding: 3px;
    margin-left: 1.25rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.header-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1.1rem;
    border-radius: 25px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-tab-btn:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.06);
}

.header-tab-btn.active {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.nav-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Icon-Only Navbar Buttons */
.btn-icon-nav {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: #f8fafc;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon-nav:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.25);
}

/* Layout Container */
.container {
    max-width: 1350px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* Financial Dashboard Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.card-stat {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s ease, border-color 0.2s ease;
    position: relative;
    overflow: hidden;
}

.card-stat:hover {
    transform: translateY(-3px);
    border-color: #475569;
}

.card-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-subtle);
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.card-stat-icon {
    font-size: 1.5rem;
    opacity: 0.9;
}

.card-stat-number {
    font-family: 'Outfit', sans-serif;
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-main);
}

.text-success { color: #34d399 !important; }
.text-danger { color: #f87171 !important; }
.text-warning { color: #fbbf24 !important; }

.card-highlight-net {
    background: linear-gradient(145deg, #064e3b, #065f46);
    border: 1px solid #10b981;
}

.card-highlight-net .card-stat-header {
    color: #a7f3d0;
}

.card-highlight-net .card-stat-number {
    color: #ffffff;
    font-size: 2.1rem;
}

/* Config Sub-bar */
.config-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.config-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.config-input {
    background: #0f172a;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    width: 110px;
    font-weight: 600;
}

/* Action Toolbar & Search */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex-grow: 1;
    max-width: 400px;
}

.search-input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.65rem 1rem 0.65rem 2.5rem;
    border-radius: 30px;
    font-size: 0.9rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-subtle);
}

.filter-tabs {
    display: flex;
    background: var(--bg-card);
    padding: 0.25rem;
    border-radius: 30px;
    border: 1px solid var(--border-color);
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--text-subtle);
    padding: 0.5rem 1.1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn.active {
    background: var(--accent-blue);
    color: #0f172a;
}

/* Table Styles */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
}

th {
    background: #0f172a;
    color: var(--text-subtle);
    padding: 1rem 1.25rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid #334155;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(51, 65, 85, 0.4);
}

/* Filas con datos faltantes o alertas (Resaltado en Rojo Elegante) */
tr.tr-has-alert td {
    background: rgba(239, 68, 68, 0.12) !important;
    border-bottom: 1px solid rgba(239, 68, 68, 0.3) !important;
}

tr.tr-has-alert:hover td {
    background: rgba(239, 68, 68, 0.22) !important;
}

tr.tr-has-alert .badge-code {
    background: rgba(239, 68, 68, 0.25) !important;
    color: #fca5a5 !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
}

/* Badges & Pills */
.badge {
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
    text-transform: uppercase;
}

.badge-code {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
    font-family: 'Outfit', monospace;
    font-weight: 700;
    font-size: 0.82rem;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    margin-right: 0.4rem;
    display: inline-block;
    letter-spacing: 0.05em;
}

.badge-warning { background: rgba(245, 158, 11, 0.2); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.4); }
.badge-info { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.4); }
.badge-primary { background: rgba(168, 85, 247, 0.2); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.4); }
.badge-success { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.4); }

.alert-pill {
    background: rgba(244, 63, 94, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(244, 63, 94, 0.4);
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    margin-top: 0.3rem;
    display: inline-block;
}

.gorras-tag {
    background: #334155;
    color: #f8fafc;
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    font-weight: 700;
}

.badge-cp {
    font-family: monospace;
    background: #0f172a;
    color: #38bdf8;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

/* Missing Field Alert Highlights */
.badge-missing-red {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    border: 1px solid #ef4444;
    padding: 0.15rem 0.55rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
    margin: 0.1rem 0;
}

.tr-has-alert {
    background: rgba(239, 68, 68, 0.08) !important;
    border-left: 4px solid #ef4444 !important;
}

.tr-has-alert:hover {
    background: rgba(239, 68, 68, 0.14) !important;
}

.alert-pill {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    margin-top: 0.25rem;
}

/* Quick Copy Buttons */
.quick-copy-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.btn-copy {
    background: #0f172a;
    border: 1px solid var(--border-color);
    color: #cbd5e1;
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.15 ease;
}

.btn-copy:hover {
    background: var(--accent-blue);
    color: #0f172a;
    border-color: var(--accent-blue);
    font-weight: 600;
}

/* Buttons */
.btn {
    padding: 0.65rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
}

.btn-secondary {
    background: #334155;
    color: #f8fafc;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.4rem;
    border-radius: 6px;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Toast Notifications */
.keko-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #1e293b;
    border: 1px solid var(--accent-blue);
    color: #f8fafc;
    padding: 0.85rem 1.4rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 0.88rem;
    font-weight: 600;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.keko-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 650px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-subtle);
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    background: #0f172a;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-blue);
}

textarea.form-control {
    resize: vertical;
    min-height: 140px;
    font-family: monospace;
    font-size: 0.85rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Section Container Visibility */
.app-section {
    display: block;
}

.app-section.hidden {
    display: none !important;
}

/* Delivery Type Gorras Breakdown Card Grid */
.delivery-breakdown-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.delivery-breakdown-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.delivery-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
}

.delivery-stat-card {
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.1rem;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.delivery-stat-card:hover {
    transform: translateY(-2px);
    border-color: #475569;
}

.delivery-stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.delivery-stat-gorras {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
}

.delivery-stat-details {
    font-size: 0.78rem;
    color: var(--text-subtle);
    margin-top: 0.3rem;
}

.cap-progress-bar-container {
    margin-top: 1rem;
    background: #0f172a;
    border-radius: 10px;
    height: 10px;
    overflow: hidden;
    display: flex;
}

.cap-progress-bar-segment {
    height: 100%;
    transition: width 0.3s ease;
}
