/**
 * POWERZONER UI COMPONENTS
 * Shared UI components for PowerZoner including:
 * - Tab interface
 * - Confirmation modal
 * - Cesium 3D viewer
 * - Animations
 */

/* ==========================================
   TAB INTERFACE
   ========================================== */

/* Workflow tabs container */
.workflow-tabs {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.tab-buttons {
  display: flex;
  background: #f3f4f6;
  border-bottom: 2px solid #e5e7eb;
  margin: 0;
  padding: 8px 8px 0 8px !important;
}

.tab-btn {
  flex: 1;
  padding: 8px 4px !important;
  background: none;
  border: none;
  font-size: 10px !important;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 3px solid transparent;
  text-align: center;
  border-radius: 6px 6px 0 0 !important;
  min-width: 0;
  white-space: normal;
  line-height: 1.2;
}

.tab-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

.tab-btn.active {
  background: white;
  color: #7c3aed;
  border-bottom-color: #7c3aed;
  font-weight: 700;
}

.tab-content {
  flex: 1;
  padding: 8px;
  padding-bottom: 8px;
  background: white;
  overflow-y: auto;
}

.tab-pane {
  display: none;
  min-height: 100%;
  flex-direction: column;
}

.tab-pane.active {
  display: flex;
}

.tab-section {
  margin-bottom: 20px;
}

.tab-section:last-child {
  margin-bottom: 0;
}

.section-header {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e5e7eb;
}

.section-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ==========================================
   CONFIRMATION MODAL
   ========================================== */

.confirm-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease-out;
}

.confirm-modal {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 450px;
  width: 90%;
  animation: slideIn 0.3s ease-out;
}

.confirm-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 12px;
}

.confirm-modal-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.confirm-modal-icon.warning {
  color: #f59e0b;
}

.confirm-modal-icon.danger {
  color: #ef4444;
}

.confirm-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.confirm-modal-body {
  padding: 24px;
}

.confirm-modal-message {
  font-size: 14px;
  color: #4b5563;
  line-height: 1.6;
  margin: 0 0 8px 0;
}

.confirm-modal-warning {
  font-size: 13px;
  color: #dc2626;
  font-weight: 500;
  margin: 12px 0 0 0;
  padding: 12px;
  background: #fef2f2;
  border-left: 3px solid #ef4444;
  border-radius: 4px;
}

.confirm-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.confirm-modal-btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.confirm-modal-btn-cancel {
  background: #f3f4f6;
  color: #374151;
}

.confirm-modal-btn-cancel:hover {
  background: #e5e7eb;
}

.confirm-modal-btn-confirm {
  background: #ef4444;
  color: white;
}

.confirm-modal-btn-confirm:hover {
  background: #dc2626;
}

.confirm-modal-btn-confirm:active {
  transform: scale(0.98);
}

/* ==========================================
   CESIUM 3D VIEWER MODAL
   ========================================== */

.cesium-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease-out;
}

.cesium-modal {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  width: 90%;
  height: 85%;
  max-width: 1400px;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.3s ease-out;
}

.cesium-modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  border-radius: 12px 12px 0 0;
}

.cesium-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cesium-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 18px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.cesium-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.cesium-container {
  flex: 1;
  position: relative;
  background: #000;
  overflow: hidden;
}

.cesium-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: white;
  z-index: 1000;
}

.cesium-loading i {
  font-size: 48px;
  margin-bottom: 16px;
}

.cesium-loading p {
  font-size: 16px;
  margin: 0;
}

.cesium-controls {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  border-radius: 0 0 12px 12px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: center;
}

.cesium-control-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cesium-control-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
}

.cesium-control-group i {
  color: #6b7280;
}

.cesium-control-group input[type="range"] {
  width: 150px;
  cursor: pointer;
}

.cesium-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.cesium-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.cesium-btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  background: #7c3aed;
  color: white;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.cesium-btn:hover {
  background: #6d28d9;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(124, 58, 237, 0.3);
}

.cesium-btn:active {
  transform: translateY(0);
}

/* Camera Control Help */
.cesium-camera-help {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.8);
  padding: 16px 20px;
  border-radius: 12px;
  z-index: 1000;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  min-width: 200px;
  display: none; /* Hidden by default - toggle with help button */
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.cesium-camera-help.show {
  display: block;
}

/* Camera Help Toggle Button */
.cesium-help-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1001;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

.cesium-help-toggle:hover {
  background: rgba(0, 0, 0, 0.95);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}

.cesium-help-toggle i {
  color: white;
  font-size: 18px;
}

.cesium-help-title {
  color: white;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 8px;
}

.cesium-help-item {
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  margin-bottom: 8px;
  line-height: 1.5;
}

.cesium-help-item strong {
  color: white;
  font-weight: 600;
  display: inline-block;
  min-width: 120px;
}

.cesium-help-item:last-child {
  margin-bottom: 0;
}

/* 3D Compass Indicator */
.cesium-compass-container {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 1000;
  pointer-events: none;
  perspective: 400px;
  perspective-origin: 50% 50%;
}

.cesium-compass-3d {
  transform-style: preserve-3d;
  transition: transform 0.15s ease-out;
  will-change: transform;
}

/* ==========================================
   ANIMATIONS
   ========================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInFromRight {
  from {
    transform: translateX(100px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ==========================================
   DISCLAIMER POPUP
   ========================================== */

.disclaimer-popup {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 10003 !important;
  pointer-events: auto !important;
}

.disclaimer-popup .popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
}

.disclaimer-popup .popup-content {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  background: white !important;
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
  width: 700px;
  max-width: 96vw;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 10004 !important;
  display: block !important;
  visibility: visible !important;
}

.disclaimer-popup .popup-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 24px 20px;
  border-bottom: 2px solid #e5e7eb;
  background: linear-gradient(to bottom, #f9fafb, white);
}

.disclaimer-popup .popup-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #1f2937;
}

.disclaimer-popup .popup-body {
  padding: 20px 28px;
}
