:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --bg-grad-1: #0f172a;
    --bg-grad-2: #1e1b4b;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --input-bg: rgba(15, 23, 42, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, sans-serif;
}

body {
    background: linear-gradient(135deg, var(--bg-grad-1), var(--bg-grad-2));
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
}

/* Navbar */
nav {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
    overflow-x: auto;
    white-space: nowrap;
}

nav button {
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

nav button:hover, nav button.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

nav button.active {
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* Contenedores Glassmorphism */
.container {
    padding: 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    margin-bottom: 2rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.card-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Form inputs */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

input, select {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    color: #fff;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

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

/* Botones */
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(99,102,241,0.4); }
.btn-success { background: var(--success); color: white; width: 100%; font-size: 1.2rem; padding: 1rem; }
.btn-success:hover { background: var(--success-hover); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(16,185,129,0.4); }
.btn-danger { background: var(--danger); color: white; padding: 0.4rem 0.8rem; font-size: 0.85rem;}
.btn-danger:hover { background: var(--danger-hover); }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: rgba(99,102,241,0.1); }

/* Tables */
.table-responsive {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}
th {
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}
tr:hover {
    background: rgba(255, 255, 255, 0.02);
}
.badge {
    padding: 0.3rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge.Completada { background: rgba(16,185,129,0.2); color: #34d399; }
.badge.Devuelto { background: rgba(239,68,68,0.2); color: #f87171; }
.badge.Pendiente { background: rgba(245,158,11,0.2); color: #fbbf24; }
.badge.Pagado { background: rgba(16,185,129,0.2); color: #34d399; }

/* Radio options as blocks */
.radio-group { display: flex; gap: 1rem; }
.radio-card {
    flex: 1;
    position: relative;
}
.radio-card input { display: none; }
.radio-card label {
    display: block;
    margin: 0;
    padding: 1rem;
    border: 2px solid var(--glass-border);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    color: var(--text-muted);
}
.radio-card input:checked + label {
    border-color: var(--primary);
    color: #fff;
    background: rgba(99,102,241,0.1);
}

/* Modal */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); z-index: 100; align-items: center; justify-content: center; }
.modal.active { display: flex; animation: fadeIn 0.2s; }
.modal-content { background: var(--glass-bg); border: 1px solid var(--glass-border); padding: 2rem; border-radius: 16px; width: 90%; max-width: 500px; }

/* Responsive Adjustments */
@media (max-width: 768px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    nav { padding: 0.5rem; gap: 0.5rem; }
    nav button { padding: 0.5rem; font-size: 0.85rem; }
    .card { padding: 1.5rem; }
}

/* Ocultar ticket de impresión en pantalla normal */
#ticket_impresion {
    display: none;
}

/* TICKET TÉRMICO (Impresión 58mm) */
@media print {
    body * { visibility: hidden !important; }
    #ticket_impresion {
        display: block !important;
    }
    #ticket_impresion, #ticket_impresion * {
        visibility: visible !important;
        font-family: monospace;
        color: #000 !important;
    }
    #ticket_impresion {
        position: absolute;
        left: 0;
        top: 0;
        width: 58mm;
        margin: 0;
        padding: 5px;
        background: #fff;
    }
    .t-head { text-align: center; margin-bottom: 5px;}
    .t-head h2 { font-size: 14px; margin: 0; }
    .t-head p { font-size: 10px; margin: 0; }
    .t-tbl { width: 100%; font-size: 10px; border-top: 1px dashed #000; border-bottom: 1px dashed #000; margin: 5px 0; text-align: left; border-collapse: collapse; }
    .t-tbl th, .t-tbl td { padding: 2px 0; border: none; }
    .t-tot { text-align: right; font-size: 12px; font-weight: bold; margin-top: 5px; }
    .t-foot { text-align: center; font-size: 10px; margin-top: 10px; }
}
