@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Montserrat:wght@500;600;700;800&display=swap');

:root {
    --color-midnight: #0f172a;
    --color-teal: #0891b2;
    --color-bg: #f3f4f6;
    --color-sidebar: #0f172a;
    --color-sidebar-hover: #1e293b;
    --color-sidebar-active: #0891b2;
    --font-body: 'Inter', sans-serif;
    --font-heading: 'Montserrat', sans-serif;
}

* { box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    margin: 0;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
}

/* ---- Layout ---- */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 24px;
    background: var(--color-bg);
    min-height: 100vh;
}

/* ---- Sidebar ---- */

.sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    width: 250px;
    height: calc(100vh - 60px);
    background: var(--color-midnight);
    overflow-y: auto;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand .brand-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
}

.sidebar-brand .brand-slogan {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.sidebar-section {
    padding: 12px 20px 4px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.3);
    font-weight: 600;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: var(--color-sidebar-hover);
    color: #fff;
}

.sidebar-link.active {
    background: rgba(8, 145, 178, 0.15);
    color: #fff;
    border-left-color: var(--color-teal);
}

.sidebar-link i {
    width: 20px;
    margin-right: 12px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
}

/* ---- Topbar ---- */

.topbar {
    background: #fff;
    padding: 12px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1001;
    height: 60px;
    width: 100%;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.branch-selector {
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.8rem;
    background: #f8fafc;
    cursor: pointer;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-teal);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

/* ---- Components ---- */

.dash-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s ease;
}

.dash-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.btn-teal {
    background: var(--color-teal);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    padding: 8px 20px;
    transition: background 0.15s ease;
}

.btn-teal:hover {
    background: #0e7490;
    color: #fff;
}

.btn-midnight {
    background: var(--color-midnight);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    padding: 8px 20px;
}

.btn-midnight:hover {
    background: #1e293b;
    color: #fff;
}

.btn-outline-teal {
    background: transparent;
    color: var(--color-teal);
    border: 1px solid var(--color-teal);
    border-radius: 8px;
    font-weight: 600;
    padding: 8px 20px;
}

.btn-outline-teal:hover {
    background: var(--color-teal);
    color: #fff;
}

/* ---- Tables ---- */

.table thead th {
    background: #f8fafc;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: #64748b;
    border-bottom: 2px solid #e5e7eb;
}

.table tbody td {
    vertical-align: middle;
}

/* ---- Badges ---- */

.badge-pendiente { background: #fef3c7; color: #92400e; }
.badge-en_proceso { background: #dbeafe; color: #1e40af; }
.badge-completado { background: #d1fae5; color: #065f46; }
.badge-entregado { background: #e0e7ff; color: #3730a3; }
.badge-cancelado { background: #fee2e2; color: #991b1b; }
.badge-pagado { background: #d1fae5; color: #065f46; }
.badge-anulado { background: #fee2e2; color: #991b1b; }

/* ---- Status pipeline ---- */

.pipeline {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 12px;
}

.pipeline-col {
    min-width: 280px;
    max-width: 320px;
    flex: 0 0 300px;
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px;
}

.pipeline-col-header {
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pipeline-card {
    background: #fff;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pipeline-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: var(--color-teal);
}

.pipeline-card .card-plate {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--color-midnight);
}

.pipeline-card .card-customer {
    font-size: 0.8rem;
    color: #64748b;
}

.pipeline-card .card-service {
    font-size: 0.75rem;
    color: var(--color-teal);
    font-weight: 500;
    margin-top: 4px;
}

.pipeline-card .card-timer {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 4px;
}

/* ---- Modal ---- */

.modal-header-midnight {
    background: var(--color-midnight);
    color: #fff;
}

/* ---- POS ---- */

.pos-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    height: calc(100vh - 140px);
}

.pos-products {
    overflow-y: auto;
}

.pos-cart {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.pos-cart-header {
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 700;
    font-family: var(--font-heading);
}

.pos-cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.pos-cart-footer {
    padding: 16px;
    border-top: 1px solid #e5e7eb;
}

.pos-cat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
}
.pos-cat-col {
    flex: 0 0 auto;
    min-width: 180px;
    max-width: 300px;
}
.pos-cat-col .pos-item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
}
.pos-item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.pos-item-btn {
    padding: 16px;
    text-align: center;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pos-item-btn:hover {
    border-color: var(--color-teal);
    box-shadow: 0 2px 8px rgba(8,145,178,0.15);
}

.pos-item-btn .item-icon {
    font-size: 1.5rem;
    color: var(--color-teal);
    margin-bottom: 6px;
}

.pos-item-btn .item-name {
    font-weight: 600;
    font-size: 0.8rem;
}

.pos-item-btn .item-price {
    font-size: 0.85rem;
    color: var(--color-teal);
    font-weight: 700;
}

/* ---- Turnos (POS drag & drop) ---- */

.turno-card {
    position: relative;
    user-select: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.turno-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: var(--color-midnight);
    color: #fff;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    z-index: 2;
    pointer-events: none;
}

.turno-dragging {
    opacity: 0.4;
    border: 2px dashed var(--color-teal);
}

.turno-drag-over {
    border: 2px solid var(--color-teal);
    box-shadow: 0 0 12px rgba(14,116,144,0.3);
    transform: scale(1.03);
}

/* ---- Print ---- */

.hoja-impresion {
    width: 21cm;
    min-height: 29.7cm;
    padding: 2cm;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

@media print {
    .sidebar, .topbar, .flotante-acciones, .btn, .modal, .no-print {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    .hoja-impresion {
        box-shadow: none;
        width: 100%;
        padding: 0;
    }
}

.ticket-termico {
    width: 80mm;
    font-family: 'Courier Prime', 'Courier New', monospace;
    font-size: 12px;
    margin: 0 auto;
    padding: 8mm;
    background: #fff;
}

@media print {
    .ticket-termico {
        width: 80mm;
        margin: 0;
        padding: 0;
    }
    @page {
        size: 80mm auto;
        margin: 0;
    }
}

/* ---- Autocomplete Dropdown ---- */

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    background: #fff;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.autocomplete-dropdown.show { display: block; }
.autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.875rem;
    border-bottom: 1px solid #f3f4f6;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item.active,
.autocomplete-item:hover { background: #e0f2fe; color: #0c4a6e; }
.autocomplete-item small { font-size: 0.75rem; }

/* ---- Timeline / distribucion de tiempos ---- */

.timeline-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0 4px;
    background: #e5e7eb;
}
.timeline-seg {
    height: 100%;
    min-width: 4px;
    transition: width 0.3s ease;
}
.timeline-legend {
    font-size: 0.65rem;
    color: #64748b;
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
    line-height: 1.4;
}
.timeline-legend i {
    font-size: 0.5rem;
    vertical-align: middle;
}

/* --- Nav Pills Info --- */
.nav-pills-info .nav-link {
    color: #0dcaf0;
}
.nav-pills-info .nav-link.active {
    background: #0dcaf0;
    color: #000;
}
.nav-pills-info .nav-link:hover:not(.active) {
    color: #0aaacf;
    background: rgba(13,202,240,0.1);
}

.nav-pills-teal .nav-link {
    color: #0891b2;
}
.nav-pills-teal .nav-link.active {
    background: #0891b2;
    color: #fff;
}
.nav-pills-teal .nav-link:hover:not(.active) {
    color: #06758f;
    background: rgba(8,145,178,0.1);
}

/* ---- Utilidades ---- */

.cursor-pointer { cursor: pointer; }
.text-teal { color: var(--color-teal); }
.text-midnight { color: var(--color-midnight); }
.bg-midnight { background: var(--color-midnight); }
.bg-teal { background: var(--color-teal); }
.fw-semibold { font-weight: 600; }
