/* ==========================================================================
   CTS - Cartografía y Trazado Satelital (repositorIA)
   Theme: Modern Engineering Dark/Glassmorphism UI
   ========================================================================== */

:root {
  --bg-primary: #0d131f;
  --bg-secondary: #162032;
  --bg-card: rgba(22, 32, 50, 0.85);
  --bg-card-hover: rgba(30, 43, 67, 0.95);
  --bg-glass: rgba(18, 26, 43, 0.75);
  
  --border-color: rgba(255, 255, 255, 0.1);
  --border-focus: #00d2ff;
  
  --text-primary: #f0f4fc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-cyan: #00d2ff;
  --accent-blue: #3a7bd5;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-indigo: #6366f1;
  
  --gradient-brand: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
  --gradient-accent: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --gradient-glow: radial-gradient(circle at 50% 0%, rgba(0, 210, 255, 0.15), transparent 70%);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.6);
  --shadow-neon: 0 0 15px rgba(0, 210, 255, 0.35);
  
  --sidebar-width: 440px;
  --header-height: 64px;
  --footer-height: 40px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Layout */
.app-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: var(--gradient-brand);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-neon);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
}

.brand-badge {
  font-size: 0.7rem;
  background: rgba(0, 210, 255, 0.15);
  color: var(--accent-cyan);
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  border: 1px solid rgba(0, 210, 255, 0.3);
  margin-left: 0.5rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-main {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 500;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-normal);
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: rgba(13, 19, 31, 0.6);
}

.sidebar-tab-btn {
  flex: 1;
  padding: 0.85rem 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition-fast);
  border-bottom: 2px solid transparent;
}

.sidebar-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background: rgba(0, 210, 255, 0.05);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
}

.tab-pane.active {
  display: flex;
}

/* Map Container */
.map-viewport {
  flex: 1;
  position: relative;
  background: #000;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 10;
}

/* Cards & Sections */
.card-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title i {
  color: var(--accent-cyan);
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-control {
  background: rgba(10, 15, 26, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  transition: var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(0, 210, 255, 0.2);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}

/* Dropzone */
.dropzone {
  border: 2px dashed rgba(0, 210, 255, 0.4);
  border-radius: var(--radius-md);
  padding: 1.5rem 1rem;
  text-align: center;
  background: rgba(0, 210, 255, 0.03);
  cursor: pointer;
  transition: var(--transition-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(0, 210, 255, 0.08);
  transform: translateY(-1px);
}

.dropzone-icon {
  font-size: 2rem;
  color: var(--accent-cyan);
}

.dropzone-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.dropzone-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition-fast);
}

.btn-primary {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 210, 255, 0.25);
}

.btn-primary:hover {
  filter: brightness(1.15);
  box-shadow: var(--shadow-neon);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--gradient-accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

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

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

.btn-sm {
  padding: 0.4rem 0.7rem;
  font-size: 0.75rem;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Stats / Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.metric-box {
  background: rgba(10, 15, 26, 0.6);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.metric-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-top: 0.2rem;
}

/* Map Floating Widgets */
.map-floating-panel {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 400;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
}

.map-layer-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-align: left;
  transition: var(--transition-fast);
}

.map-layer-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.map-layer-btn.active {
  background: rgba(0, 210, 255, 0.15);
  color: var(--accent-cyan);
  border-color: rgba(0, 210, 255, 0.3);
  font-weight: 600;
}

.coord-display {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  z-index: 400;
  background: rgba(13, 19, 31, 0.85);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-family: monospace;
  color: var(--text-secondary);
  backdrop-filter: blur(6px);
}

/* Progress bar */
.progress-container {
  background: rgba(10, 15, 26, 0.8);
  border-radius: 20px;
  height: 8px;
  width: 100%;
  overflow: hidden;
  margin-top: 0.5rem;
  border: 1px solid var(--border-color);
}

.progress-bar {
  background: var(--gradient-brand);
  height: 100%;
  width: 0%;
  transition: width 0.2s ease;
}

/* Footer */
.app-footer {
  height: var(--footer-height);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  z-index: 1000;
}

.footer-copy {
  font-weight: 500;
  color: var(--text-secondary);
}

.footer-copy strong {
  color: var(--accent-cyan);
}

.footer-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-emerald);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(10, 15, 26, 0.5);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

/* Badges & Pills */
.pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
}

.pill-cyan { background: rgba(0, 210, 255, 0.15); color: var(--accent-cyan); }
.pill-emerald { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.pill-amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }

/* Layers Tree */
.layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.6rem;
  background: rgba(10, 15, 26, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 0.4rem;
}

.layer-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-actions {
  display: flex;
  gap: 0.3rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 650px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

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

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: rgba(10, 15, 26, 0.4);
}
