/* components.css - Design System Unificado */

/* --- BOTONES BASE --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    font-family: inherit;
    white-space: nowrap;
    user-select: none;
    background: #f1f5f9;
    color: #475569;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(1); }
.btn:active { transform: scale(0.97); }

/* Variantes */
.btn--primary { background: var(--primary); color: white; }
.btn--primary:hover { background: var(--accent); box-shadow: 0 4px 12px rgba(225, 29, 72, 0.2); }

.btn--secondary { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.btn--secondary:hover { background: #e2e8f0; }

.btn--danger { background: #fef2f2; color: #ef4444; border-color: #fee2e2; }
.btn--danger:hover { background: #ef4444; color: white; }

.btn--outline { background: transparent; border-color: var(--border); color: var(--text-main); }
.btn--outline:hover { border-color: var(--primary); color: var(--primary); }

.btn--warning { background: transparent; border-color: var(--warning); color: var(--warning); }
.btn--warning:hover { background: #fff7ed; border-color: #f59e0b; box-shadow: 0 4px 12px rgba(245, 158, 11, 0.1); }

.btn--icon { width: 42px; height: 42px; padding: 0; border-radius: var(--radius-md); }
.btn--icon i { width: 20px; height: 20px; }

/* --- INPUTS Y FORMULARIOS --- */
.form-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.form-group label { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); }

.input-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: white;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s;
    outline: none;
}
.input-control:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.05); }

/* --- BADGES --- */
.badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    background: #f1f5f9;
    color: #64748b;
}
.badge--success { background: #ecfdf5; color: #10b981; }
.badge--danger { background: #fef2f2; color: #ef4444; }

/* --- MODALES --- */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}
.modal.active { display: flex; }

.modal.active { display: flex; }

.modal-content {
    background: white;
    width: 92%;
    max-width: 450px;
    border-radius: var(--radius-lg);
    padding: 32px 24px 24px 24px;
    text-align: left;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
    z-index: 100;
}

.btn-modal-close:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: rotate(90deg);
}

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

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* --- FORMULARIOS E INPUTS --- */
.search-bar {
    position: relative;
    width: 100%;
    background: white;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-bar i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
}

.search-bar input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    outline: none;
    transition: border-color 0.2s;
}

@media (min-width: 768px) {
    .search-bar { width: 300px; }
}

.setting-group {
    margin-bottom: 20px;
    text-align: left;
}

.setting-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.setting-group input, .setting-group select {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    font-size: 1rem;
    outline: none;
}

/* --- ACCESO / LOGIN --- */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.login-card {
    background: white;
    padding: 30px 20px;
    border-radius: 24px;
    box-shadow: 0 24px 40px -8px rgba(0, 0, 0, 0.15);
    text-align: center;
    max-width: 360px;
    width: 92%;
}

.pin-display {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 12px;
    margin: 32px 0;
    color: var(--primary);
    background: var(--bg-app);
    padding: 12px;
    border-radius: var(--radius-md);
    height: 64px;
}

.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.pin-pad button {
    padding: 20px;
    font-size: 1.5rem;
    font-weight: 600;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.1s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.pin-pad button:active {
    background: #f1f5f9;
    transform: scale(0.95);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.pin-pad .btn-login-go {
    background: var(--primary);
    color: white;
}

.btn-clear { color: var(--danger); }

/* --- OTROS --- */
.user-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.user-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.user-card:hover {
    border-color: var(--accent);
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transform: translateY(-2px);
}

.user-avatar {
    width: 48px;
    height: 48px;
    background: var(--bg-app);
    color: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
}

.user-card span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.user-badge {
    background: #e5e7eb;
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
    letter-spacing: 1px;
}

.btn-text-only {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-text-only:hover { color: var(--accent); }

.receipt-paper {
    background: #fdfdfd;
    border: 1px dashed var(--border);
    padding: 20px;
    margin: 24px 0;
    text-align: left;
    font-family: 'Courier New', Courier, monospace;
}
/* --- SKELETON LOADERS --- */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite linear;
    border-radius: var(--radius-sm);
    color: transparent !important;
    pointer-events: none;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text { height: 1rem; margin-bottom: 0.5rem; width: 100%; }
.skeleton-title { height: 1.5rem; margin-bottom: 1rem; width: 60%; }
.skeleton-circle { width: 48px; height: 48px; border-radius: 50%; }

/* --- TRANSICIONES GLOBALES --- */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

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

/* --- SWITCHES (Interruptores) --- */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

input:checked + .slider {
  background-color: var(--success);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--success);
}

input:checked + .slider:before {
  transform: translateX(22px);
}
