/* ========================================================
   SISTEMA SAJOMA - DESKTOP GLASSMORPHISM DESIGN SYSTEM v5.0
   Estilos Agrupados por Módulos y Categorías Visuales
   ======================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
}

@keyframes popIn {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

body {
  background: #0f172a url('https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?q=80&w=1920&auto=format&fit=crop') no-repeat center center fixed;
  background-size: cover;
  height: 100vh;
  overflow: hidden;
  color: #f8fafc;
}

/* CONTAINER AGRUPADO DE ACCESOS EN ESCRITORIO */
.desktop-workspace {
  height: calc(100vh - 48px);
  padding: 20px;
  overflow-y: auto;
}

.grouped-desktop-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.desktop-group-category {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.group-category-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #93c5fd;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.desktop-shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.desktop-shortcut:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.shortcut-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #ffffff;
  margin-bottom: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.shortcut-label {
  font-size: 11px;
  font-weight: 500;
  color: #e2e8f0;
  line-height: 1.3;
}

/* MENÚ DE INICIO SAJOMA OS POR CATEGORÍAS */
.start-menu {
  position: fixed;
  bottom: 56px;
  left: 10px;
  width: 320px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.start-menu.open {
  display: flex;
}

.start-menu-header {
  padding: 14px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

.user-role {
  font-size: 10px;
  color: #94a3b8;
}

.menu-category-header {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #818cf8;
  padding: 8px 14px 4px 14px;
  text-transform: uppercase;
  margin-top: 6px;
}

.start-item {
  padding: 8px 14px;
  font-size: 12px;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.start-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* TASKBAR SUPERIOR / INFERIOR */
.taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 9990;
}

.start-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: linear-gradient(135deg, #4f46e5, #3730a3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.start-btn:hover {
  filter: brightness(1.1);
}

.taskbar-tabs {
  display: flex;
  gap: 6px;
  flex: 1;
  margin: 0 16px;
  overflow-x: auto;
}

.taskbar-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  font-size: 12px;
  color: #cbd5e1;
  cursor: pointer;
}

.taskbar-tab.active {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

.taskbar-clock {
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  padding: 0 8px;
}

/* WINDOW CONTAINER (DESKTOP WINDOWS) */
.desktop-window {
  position: absolute;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 320px;
  min-height: 200px;

  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.desktop-window.visible {
  opacity: 1;
  transform: scale(1);
}

.desktop-window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: calc(100vh - 48px) !important;
  border-radius: 0;
}

.window-header {
  height: 38px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  cursor: move;
}

.window-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #f1f5f9;
}

.window-controls {
  display: flex;
  gap: 6px;
}

.btn-win-control {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

.btn-win-close { background: #ef4444; }
.btn-win-minimize { background: #f59e0b; }
.btn-win-maximize { background: #10b981; }

.window-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

/* DATA TABLES & FORMS */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th, .data-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.data-table th {
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
}

.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
  color: #cbd5e1;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #ffffff;
  font-size: 13px;
  outline: none;
}

.form-control:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

select option {
  background-color: #0f172a !important;
  color: #ffffff !important;
  padding: 8px 12px;
  font-size: 13px;
}

select option:hover,
select option:focus,
select option:checked {
  background-color: #2563eb !important;
  color: #ffffff !important;
}

.btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;

  transition: filter 0.15s ease;
}

.btn:hover { filter: brightness(1.1); }
.btn-primary { background: #4f46e5; color: #fff; }
.btn-success { background: #10b981; color: #fff; }
.btn-danger { background: #ef4444; color: #fff; }

/* LOGIN OVERLAY */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 360px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.login-header {
  text-align: center;
  margin-bottom: 20px;
}

.login-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  margin: 0 auto 12px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
  box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
}

.login-alert {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 12px;
  text-align: center;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.spin {
  animation: spin 1s linear infinite;
  display: inline-block;
}
