/* =============================================
   Imprenta Digital — Custom Styles
   ============================================= */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1a1a1a;
    --sidebar-hover: #333333;
    --sidebar-active: #EE7203;
    --topnav-height: 60px;
    --primary: #EE7203;
    --primary-dark: #c85e00;
    --gray-bg: #f4f6fb;
    --card-shadow: 0 2px 12px rgba(0,0,0,.08);
}

/* ---- Base ---- */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--gray-bg);
    color: #2c3e50;
}

/* =============================================
   AUTH LAYOUT
   ============================================= */
body.auth-layout {
    background: linear-gradient(135deg, #1a1a1a 0%, #EE7203 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-wrapper {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    width: 100%;
    max-width: 440px;
    overflow: hidden;
}

.auth-card-header {
    background: linear-gradient(135deg, #1a1a1a 0%, #EE7203 100%);
    color: #fff;
    padding: 2.5rem 2rem 2rem;
    text-align: center;
}

.auth-card-header .brand-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: .5rem;
}

.auth-card-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
}

.auth-card-header p {
    opacity: .8;
    margin: .25rem 0 0;
    font-size: .9rem;
}

.auth-card-body {
    padding: 2rem;
}

/* =============================================
   SIDEBAR LAYOUT
   ============================================= */
body.has-sidebar {
    overflow-x: hidden;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: transform .3s ease;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.1) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}

.sidebar-brand {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.sidebar-brand i { color: var(--primary); font-size: 1.3rem; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

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

.user-name {
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.sidebar-nav {
    list-style: none;
    padding: .75rem 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav .nav-item a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1.5rem;
    color: rgba(255,255,255,.7);
    text-decoration: none;
    font-size: .9rem;
    transition: all .2s;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-item a:hover {
    color: #fff;
    background: var(--sidebar-hover);
}

.sidebar-nav .nav-item.active a {
    color: #fff;
    background: rgba(238,114,3,.15);
    border-left-color: var(--primary);
}

.sidebar-nav .nav-item a i { font-size: 1rem; width: 20px; text-align: center; }

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,.08);
    margin: .5rem 1rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1040;
}

/* =============================================
   MAIN WRAPPER & TOP NAV
   ============================================= */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .3s ease;
}

.top-navbar {
    height: var(--topnav-height);
    background: #fff;
    border-bottom: 1px solid #e8ecf0;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.sidebar-toggle-btn {
    color: #555;
    padding: .5rem .75rem;
    text-decoration: none;
}

.main-content {
    flex: 1;
    padding: 1.5rem 2rem;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .main-content {
        padding: 1rem;
    }
}

/* =============================================
   STAT CARDS
   ============================================= */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform .2s, box-shadow .2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,.12);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
}

.stat-info .stat-label {
    font-size: .8rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
}

.stat-info .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: #000;
}

/* =============================================
   CARDS
   ============================================= */
.content-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.content-card .card-header {
    background: #fff;
    border-bottom: 1px solid #e8ecf0;
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.content-card .card-body {
    padding: 1.5rem;
}

/* =============================================
   TABLES
   ============================================= */
.table-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.table-card .table {
    margin-bottom: 0;
}

.table-card .table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #e8ecf0;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #6c757d;
    padding: .85rem 1rem;
    white-space: nowrap;
}

.table-card .table tbody td {
    padding: .9rem 1rem;
    vertical-align: middle;
    border-color: #f0f2f5;
    font-size: .9rem;
}

.table-card .table tbody tr:last-child td {
    border-bottom: 0;
}

.table-card .table tbody tr:hover {
    background: #fff8f2;
}

/* =============================================
   PAGE HEADER
   ============================================= */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: .75rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #000;
    margin: 0;
}

.page-header .breadcrumb {
    font-size: .85rem;
    margin: 0;
}

/* =============================================
   ORDER PROGRESS TRACKER
   ============================================= */
.order-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 1rem 0;
    overflow-x: auto;
}

.order-progress::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 3px;
    background: #e8ecf0;
    z-index: 0;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    position: relative;
    z-index: 1;
    flex: 1;
    min-width: 70px;
}

.progress-step-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #e8ecf0;
    border: 3px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #adb5bd;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
    transition: all .3s;
}

.progress-step.completed .progress-step-icon {
    background: #198754;
    color: #fff;
}

.progress-step.active .progress-step-icon {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(238,114,3,.25);
}

.progress-step-label {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: #adb5bd;
    text-align: center;
    line-height: 1.2;
}

.progress-step.completed .progress-step-label,
.progress-step.active .progress-step-label {
    color: #000;
}

/* =============================================
   COTIZACION ITEMS
   ============================================= */
.items-table-wrapper {
    border: 1px solid #e8ecf0;
    border-radius: 8px;
    overflow: hidden;
}

.item-row {
    border-bottom: 1px solid #e8ecf0;
    padding: .75rem;
    background: #fff;
}

.item-row:last-child { border-bottom: 0; }
.item-row:hover { background: #f8f9ff; }

/* =============================================
   FORMS
   ============================================= */
.form-label {
    font-weight: 600;
    font-size: .875rem;
    color: #374151;
}

.form-control, .form-select {
    border-color: #d1d5db;
    border-radius: 8px;
    font-size: .9rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 .25rem rgba(238,114,3,.15);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* =============================================
   DYNAMIC ITEMS FORM
   ============================================= */
#itemsContainer .item-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    background: #fff8f2;
    position: relative;
}

#itemsContainer .item-card .item-number {
    position: absolute;
    top: -12px;
    left: 16px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: .75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =============================================
   BADGES
   ============================================= */
.badge {
    font-size: .75rem;
    padding: .35em .65em;
    border-radius: 6px;
    font-weight: 600;
}

/* =============================================
   MISC
   ============================================= */
.text-muted { color: #6c757d !important; }

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #adb5bd;
}

.empty-state i {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
}

.empty-state h5 {
    color: #6c757d;
    font-weight: 600;
}

.timeline {
    list-style: none;
    padding: 0;
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e8ecf0;
}

.timeline-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.timeline-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 1;
    font-size: .9rem;
}

.timeline-content {
    flex: 1;
    background: #fff;
    border: 1px solid #e8ecf0;
    border-radius: 8px;
    padding: .75rem 1rem;
}

.timeline-content .timeline-title {
    font-weight: 600;
    font-size: .9rem;
}

.timeline-content .timeline-date {
    font-size: .78rem;
    color: #adb5bd;
}

/* =============================================
   PRINT FRIENDLY
   ============================================= */
@media print {
    .sidebar, .top-navbar, .btn, .alert { display: none !important; }
    .main-wrapper { margin-left: 0 !important; }
    .main-content { padding: 0 !important; }
}
