/* Carlin Pedidos - Estilos */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --success-dark: #15803d;
    --warning: #f59e0b;
    --danger: #dc2626;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    min-height: 100vh;
}

/* Login Screen */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-card {
    background: white;
    border-radius: 1.5rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.login-logo svg {
    width: 40px;
    height: 40px;
    color: white;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: var(--gray-500);
    margin-bottom: 2rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-error {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 768px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo svg {
    width: 32px;
    height: 32px;
}

.nav-tabs {
    display: flex;
    gap: 0.25rem;
    background: rgba(255,255,255,0.1);
    padding: 0.25rem;
    border-radius: 0.75rem;
}

.nav-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.8);
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.nav-tab:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-tab.active {
    background: white;
    color: var(--primary);
}

.nav-tab svg {
    width: 18px;
    height: 18px;
}

/* Main Content */
.main-content {
    max-width: 768px;
    margin: 0 auto;
    padding: 1rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Section Title */
.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.section-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 1rem;
}

/* Form Elements */
.input-group {
    margin-bottom: 1rem;
}

.input-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.75rem;
    font-size: 1rem;
    transition: all 0.2s;
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Select */
.select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.75rem;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn svg {
    width: 20px;
    height: 20px;
}

.btn:active {
    transform: scale(0.98);
}

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

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

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: var(--success-dark);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--gray-300);
    color: var(--gray-700);
}

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-icon {
    padding: 0.5rem;
    width: auto;
}

/* List Items */
.list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.list-item:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.list-item.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.list-item-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.list-item-icon.primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.list-item-icon.success {
    background: rgba(22, 163, 74, 0.1);
    color: var(--success);
}

.list-item-icon svg {
    width: 24px;
    height: 24px;
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.list-item-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.list-item-action {
    color: var(--gray-400);
}

/* Book Item */
.book-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.book-item.in-cart {
    border-color: var(--success);
    background: rgba(22, 163, 74, 0.05);
}

.book-item-content {
    flex: 1;
}

.book-item-title {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.book-item-meta {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.book-item-price {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
}

/* Cart Item */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1rem;
    background: white;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--gray-200);
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 0.875rem;
}

.cart-item-meta {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gray-100);
    padding: 0.25rem;
    border-radius: 0.5rem;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: white;
    border-radius: 0.375rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.qty-value {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
}

.remove-btn {
    color: var(--danger);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
}

/* Cart Summary */
.cart-summary {
    background: var(--gray-50);
    border-radius: 0.75rem;
    padding: 1rem;
    margin: 1rem 0;
}

.cart-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.cart-row.total {
    font-size: 1.125rem;
    font-weight: 700;
    border-top: 1px solid var(--gray-300);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

.cart-total-value {
    color: var(--primary);
    font-size: 1.25rem;
}

/* Ticket */
.ticket {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.ticket-header {
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--gray-300);
}

.ticket-logo {
    height: 48px;
    margin-bottom: 0.5rem;
}

.ticket-legal {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.ticket-id {
    background: rgba(37, 99, 235, 0.1);
    padding: 0.5rem;
    border-radius: 0.5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.ticket-id-label {
    font-size: 0.75rem;
    color: var(--gray-600);
}

.ticket-id-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.ticket-info {
    margin-bottom: 1rem;
}

.ticket-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
}

.ticket-row-label {
    color: var(--gray-600);
}

.ticket-row-value {
    font-weight: 600;
}

.ticket-items {
    border-top: 1px dashed var(--gray-300);
    border-bottom: 1px dashed var(--gray-300);
    padding: 1rem 0;
    margin: 1rem 0;
}

.ticket-item {
    margin-bottom: 0.5rem;
}

.ticket-item-row {
    display: flex;
    justify-content: space-between;
}

.ticket-item-name {
    color: var(--gray-600);
}

.ticket-item-price {
    font-weight: 600;
}

.ticket-item-isbn {
    font-size: 0.75rem;
    color: var(--gray-400);
    font-family: monospace;
}

.ticket-total {
    text-align: center;
    padding-top: 1rem;
    border-top: 2px solid var(--gray-800);
}

.ticket-total-label {
    font-size: 1.125rem;
    font-weight: 700;
}

.ticket-total-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Order Status */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.pendiente {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.status-badge.confirmado {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.status-badge.entregado {
    background: rgba(22, 163, 74, 0.1);
    color: var(--success);
}

/* Order Card */
.order-card {
    background: white;
    border-radius: 1rem;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.order-card-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
}

.order-card-id {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.order-card-date {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.order-card-body {
    padding: 1rem;
    display: none;
}

.order-card.expanded .order-card-body {
    display: block;
}

.order-card-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.order-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Filters */
.filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: 9999px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-chip:hover {
    border-color: var(--primary);
}

.filter-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Success Screen */
.success-icon {
    width: 80px;
    height: 80px;
    background: rgba(22, 163, 74, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.success-icon svg {
    width: 40px;
    height: 40px;
    color: var(--success);
}

.success-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.5rem;
}

.success-subtitle {
    text-align: center;
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

.empty-state-text {
    color: var(--gray-500);
}

/* Loading */
.loading {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    z-index: 1000;
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 200;
}

.modal {
    background: white;
    border-radius: 1rem;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow: auto;
}

.modal-header {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-weight: 700;
    font-size: 1.125rem;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-500);
}

.modal-body {
    padding: 1rem;
}

.modal-footer {
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 0.5rem;
}

/* Grid */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

/* Search */
.search-box {
    position: relative;
    margin-bottom: 1rem;
}

.search-box svg {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--gray-400);
}

.search-box input {
    padding-left: 2.75rem;
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .header, .nav-tabs, .no-print {
        display: none !important;
    }

    .main-content {
        padding: 0;
        max-width: none;
    }

    .ticket {
        border: 1px solid #ccc;
        box-shadow: none;
    }
}

/* Responsive */
@media (max-width: 640px) {
    .nav-tabs {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 0;
        padding: 0.5rem;
        justify-content: space-around;
        background: white;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }

    .nav-tab span {
        display: none;
    }

    .main-content {
        padding-bottom: 5rem;
    }

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

/* Print Styles */
@media print {
    @page {
        size: 80mm auto;
        margin: 5mm;
    }

    body {
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .header,
    .nav-tabs,
    .btn-success,
    .grid-2,
    .no-print {
        display: none !important;
    }

    .main-content {
        padding: 0 !important;
        margin: 0 !important;
        background: white !important;
    }

    .ticket {
        border: 1px solid #333 !important;
        border-radius: 0 !important;
        padding: 10px !important;
        margin: 0 !important;
        box-shadow: none !important;
        width: 80mm !important;
        max-width: 80mm !important;
    }

    .ticket-header {
        text-align: center !important;
        margin-bottom: 10px !important;
        padding-bottom: 10px !important;
        border-bottom: 1px dashed #999 !important;
    }

    .ticket-logo {
        height: 40px !important;
        margin-bottom: 5px !important;
    }

    .ticket-legal {
        font-size: 8px !important;
        color: #666 !important;
    }

    .ticket-id {
        background: #f0f0f0 !important;
        padding: 8px !important;
        border-radius: 4px !important;
        margin-bottom: 10px !important;
    }

    .ticket-id-label {
        font-size: 10px !important;
    }

    .ticket-id-value {
        font-size: 16px !important;
        font-weight: bold !important;
        color: #000 !important;
    }

    .ticket-info {
        margin-bottom: 10px !important;
    }

    .ticket-row {
        display: flex !important;
        justify-content: space-between !important;
        padding: 3px 0 !important;
        font-size: 12px !important;
    }

    .ticket-row-label {
        color: #333 !important;
    }

    .ticket-row-value {
        font-weight: bold !important;
        color: #000 !important;
    }

    .ticket-items {
        border-top: 1px dashed #999 !important;
        border-bottom: 1px dashed #999 !important;
        padding: 10px 0 !important;
        margin: 10px 0 !important;
    }

    .ticket-items strong {
        font-size: 12px !important;
        display: block !important;
        margin-bottom: 5px !important;
    }

    .ticket-item {
        margin-bottom: 8px !important;
        page-break-inside: avoid !important;
    }

    .ticket-item-row {
        display: flex !important;
        justify-content: space-between !important;
        font-size: 11px !important;
    }

    .ticket-item-name {
        color: #333 !important;
    }

    .ticket-item-price {
        font-weight: bold !important;
        color: #000 !important;
    }

    .ticket-item-isbn {
        font-size: 9px !important;
        color: #666 !important;
        font-family: monospace !important;
    }

    .ticket-total {
        text-align: center !important;
        padding-top: 10px !important;
        border-top: 2px solid #000 !important;
        margin-top: 10px !important;
    }

    .ticket-total-label {
        font-size: 14px !important;
        font-weight: bold !important;
    }

    .ticket-total-value {
        font-size: 20px !important;
        font-weight: bold !important;
        color: #000 !important;
    }
}
