/* ==========================================================================
   TU ALMACÉN POS - DESIGN SYSTEM & GLOBAL STYLES
   ========================================================================== */

:root {
  /* Color Palette - Dark Mode (Default) */
  --bg-app: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-elevated: #334155;
  --bg-input: #0f172a;
  
  --border-color: #334155;
  --border-focus: #38bdf8;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: rgba(2, 132, 199, 0.15);
  
  --accent-success: #10b981;
  --accent-success-hover: #059669;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --accent-purple: #8b5cf6;
  
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.6);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light-theme {
  --bg-app: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f8fafc;
  --bg-input: #ffffff;
  
  --border-color: #e2e8f0;
  --border-focus: #0284c7;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  user-select: none;
}

/* App Container Layout */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ==========================================================================
   TOPBAR & HEADER
   ========================================================================== */
.topbar {
  height: 60px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text-primary);
}

.brand-icon {
  font-size: 1.4rem;
}

.brand-badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  background: var(--primary);
  color: white;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.main-nav {
  display: flex;
  gap: 0.4rem;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.shift-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.shift-badge.open {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-success);
  border: 1px solid var(--accent-success);
}

.shift-badge.closed {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger);
  border: 1px solid var(--accent-danger);
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.sync-status.online {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-success);
}

.sync-status.syncing {
  background: rgba(2, 132, 199, 0.1);
  color: var(--primary);
  animation: pulse 1.5s infinite;
}

.sync-status.offline {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-warning);
}

.sync-status.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-danger);
}

.clock-display {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-secondary);
  background: var(--bg-surface-elevated);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
}

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

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.main-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.view-section {
  height: 100%;
  width: 100%;
}

.view-section.hidden {
  display: none !important;
}

/* ==========================================================================
   BUTTONS & FORM CONTROLS
   ========================================================================== */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

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

.btn-success {
  background: var(--accent-success);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

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

.btn-danger {
  background: var(--accent-danger);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-danger:hover {
  background: #dc2626;
}

.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

/* ==========================================================================
   MODAL SYSTEM
   ========================================================================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 90%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScale 0.2s ease-out;
  z-index: 101;
}

.modal-content.modal-lg {
  max-width: 820px;
}

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

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-modal-close {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  transition: var(--transition);
}

.btn-modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.4rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
  background: rgba(0, 0, 0, 0.1);
}

/* Animations */
@keyframes modalScale {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.hidden {
  display: none !important;
}

.text-muted {
  color: var(--text-muted);
}
