/* ==============================================================================
   Digcontrolremote - Modern CSS Theme & Design Tokens
   Empresa: Digital Innovation Global LLC
   ============================================================================== */

:root {
  --bg-dark: #0b0f19;
  --bg-card: #151c2c;
  --bg-card-hover: #1e283d;
  --bg-header: rgba(15, 23, 42, 0.85);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-primary: #38bdf8;
  --accent-primary-hover: #0284c7;
  --accent-secondary: #6366f1;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(56, 189, 248, 0.5);
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.25);
  
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Modo Claro Ultra-Suave (Light Mode Tokens) */
body[data-theme="light"] {
  --bg-dark: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-header: rgba(255, 255, 255, 0.95);
  
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
}

body[data-theme="light"] select, body[data-theme="light"] select option {
  background-color: #ffffff !important;
  color: #1e293b !important;
  border-color: #cbd5e1 !important;
}

body[data-theme="light"] .btn-secondary {
  background: #f1f5f9 !important;
  color: #1e293b !important;
  border: 1px solid #e2e8f0 !important;
}

body[data-theme="light"] .btn-secondary:hover {
  background: #e2e8f0 !important;
}

body[data-theme="light"] input[type="text"],
body[data-theme="light"] input[type="email"],
body[data-theme="light"] input[type="url"],
body[data-theme="light"] input[type="password"] {
  background-color: #ffffff !important;
  color: #1e293b !important;
  border-color: #cbd5e1 !important;
}

body[data-theme="light"] .app-footer {
  background: #ffffff;
}

body[data-theme="light"] .footer-links a,
body[data-theme="light"] .footer-legal-links a,
body[data-theme="light"] .btn-cookie-settings {
  color: #64748b !important;
}

body[data-theme="light"] .footer-links a:hover,
body[data-theme="light"] .footer-legal-links a:hover,
body[data-theme="light"] .btn-cookie-settings:hover {
  color: #0f172a !important;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

/* Selector Oscuro de Opciones */
select, select option {
  background-color: #0f172a !important;
  color: #f8fafc !important;
}

/* Header */
.app-header {
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 100%;
  width: 100%;
  margin: 0;
  padding: 0.85rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-icon {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-name .highlight {
  color: var(--accent-primary);
}

.brand-sub {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

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

.lang-selector {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.lang-selector select {
  background: transparent;
  color: var(--text-primary);
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

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

/* Layout Principal */
.main-content {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Cards & Grid */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.04);
  width: 54px;
  height: 54px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Computers Grid */
.computers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.computer-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25 ease;
  position: relative;
  overflow: hidden;
}

.computer-card-favorite {
  border: 1px solid rgba(245, 158, 11, 0.5) !important;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.06) 0%, var(--bg-card) 100%) !important;
}

body[data-theme="light"] .computer-card-favorite {
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
  background: linear-gradient(180deg, rgba(254, 243, 199, 0.45) 0%, #ffffff 100%) !important;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.08) !important;
}

.computer-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(56, 189, 248, 0.3);
  box-shadow: var(--shadow-md);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.pc-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.pc-ip {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

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

.badge-online .badge-dot {
  background: var(--accent-success);
  box-shadow: 0 0 8px var(--accent-success);
}

.badge-offline {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.badge-offline .badge-dot {
  background: var(--text-muted);
}

.pc-details {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.pc-detail-item {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.04);
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #0284c7);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

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

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
}

/* Visor de Escritorio Remoto (Session Canvas) */
.remote-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 160px);
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

.remote-toolbar {
  background: #111827;
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.remote-toolbar-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.remote-viewport {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #1e293b 0%, #090d16 100%);
  overflow: hidden;
}

#remote-canvas {
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
  border-radius: 4px;
}

.remote-overlay {
  position: absolute;
  background: transparent;
  padding: 0;
  border-radius: var(--radius-md);
  text-align: center;
  border: none;
  color: #ffffff;
  z-index: 100;
}

/* Modal y Banner RGPD */
.gdpr-banner {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 900px;
  background: var(--bg-card);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  z-index: 1000;
  backdrop-filter: blur(16px);
}

.hidden {
  display: none !important;
}

.gdpr-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.gdpr-header h3 {
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
}

.gdpr-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.gdpr-description a {
  color: var(--accent-primary);
  text-decoration: underline;
}

.gdpr-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.gdpr-options {
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gdpr-option-item {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #334155;
  transition: .3s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

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

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

/* Footer & Enlaces Blancos Elegantes */
.app-footer {
  border-top: 1px solid var(--border-color);
  padding: 1.5rem;
  margin-top: 3rem;
  background: rgba(11, 15, 25, 0.9);
}

.footer-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-links a, .footer-legal-links a, .btn-cookie-settings {
  color: #94a3b8 !important;
  text-decoration: none !important;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.footer-links a:hover, .footer-legal-links a:hover, .btn-cookie-settings:hover {
  color: #ffffff !important;
  text-decoration: underline !important;
}

.sep {
  margin: 0 0.4rem;
  color: var(--border-color);
}

/* Soporte Nativo RTL (Right-To-Left) para Árabe, Hebreo, Urdu, etc. */
html[dir="rtl"], body[data-dir="rtl"] {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .header-container,
html[dir="rtl"] .dashboard-header,
html[dir="rtl"] .app-nav,
html[dir="rtl"] .search-filter-bar {
  flex-direction: row-reverse;
}

html[dir="rtl"] .stats-grid {
  direction: rtl;
}

html[dir="rtl"] th,
html[dir="rtl"] td {
  text-align: right;
}
