/**
 * WatchTower: The Network - Enhanced UI/UX Styles
 * Cyberpunk-themed hacking game interface
 */

/* ====================================
   ENHANCED BUTTON INTERACTIONS
   ==================================== */

/* Button glow effects */
.btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::after {
  width: 300px;
  height: 300px;
  transition: width 0s, height 0s;
}

.btn-primary {
  box-shadow: 
    0 2px 10px rgba(255, 0, 128, 0.3),
    0 0 20px rgba(255, 0, 128, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.btn-primary:hover {
  box-shadow: 
    0 4px 20px rgba(255, 0, 128, 0.5),
    0 0 40px rgba(255, 0, 128, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.btn-primary:active {
  box-shadow: 
    0 1px 5px rgba(255, 0, 128, 0.3),
    0 0 15px rgba(255, 0, 128, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(0);
}

.btn-ghost {
  transition: all 0.3s ease;
}

.btn-ghost:hover {
  box-shadow: 
    0 4px 20px rgba(0, 255, 255, 0.4),
    0 0 30px rgba(0, 255, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* Button loading state */
.btn.loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
}

.btn.loading::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ====================================
   SMOOTH TRANSITIONS
   ==================================== */

.panel, .stat, .meter, .op, .mission-item {
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.panel:hover {
  transform: translateY(-2px);
}

/* Fade in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.4s ease-out;
}

/* Slide in animation */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.slide-in-right {
  animation: slideInRight 0.4s ease-out;
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.slide-in-left {
  animation: slideInLeft 0.4s ease-out;
}

/* ====================================
   ENHANCED TERMINAL
   ==================================== */

.terminal {
  position: relative;
}

.terminal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.6), transparent);
  animation: scanline 2s ease-in-out infinite;
}

@keyframes scanline {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.terminal .log-entry {
  opacity: 0;
  animation: fadeIn 0.3s ease-out forwards;
}

.terminal .log-entry:nth-child(n+20) {
  animation: none;
}

/* Terminal cursor blink */
.terminal-cursor {
  display: inline-block;
  width: 8px;
  height: 16px;
  background: var(--accent);
  margin-left: 4px;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ====================================
   MODAL ENHANCEMENTS
   ==================================== */

.modal-backdrop {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  transition: opacity 0.3s ease;
}

.modal {
  animation: modalAppear 0.3s ease-out;
}

@keyframes modalAppear {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.modal-close {
  transition: all 0.2s ease;
}

.modal-close:hover {
  transform: rotate(90deg) scale(1.2);
  color: var(--accent);
}

/* ====================================
   TOOLTIPS
   ==================================== */

.tooltip {
  position: relative;
  cursor: help;
}

.tooltip::before,
.tooltip::after {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.tooltip::before {
  content: attr(data-tooltip);
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-5px);
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--border-color);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.tooltip::after {
  content: '';
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  width: 0;
  height: 0;
  border: 5px solid transparent;
  border-top-color: var(--panel);
  z-index: 1001;
}

.tooltip:hover::before,
.tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ====================================
   LOADING STATES
   ==================================== */

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ====================================
   PROGRESS BARS
   ==================================== */

.progress-bar {
  position: relative;
  height: 12px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 6px;
  transition: width 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: progressShimmer 1.5s infinite;
}

@keyframes progressShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ====================================
   ENHANCED STATS
   ==================================== */

.stat {
  position: relative;
  overflow: hidden;
}

.stat::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 255, 255, 0.2),
    transparent
  );
  transition: left 0.6s ease;
}

.stat:hover::after {
  left: 100%;
}

.stat .val {
  transition: all 0.3s ease;
}

.stat:hover .val {
  text-shadow: 0 0 20px currentColor;
  transform: scale(1.05);
}

/* ====================================
   NOTIFICATION SYSTEM
   ==================================== */

.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16px 20px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  z-index: 10000;
  animation: slideInRight 0.4s ease-out;
  max-width: 350px;
}

.notification.success {
  border-color: var(--good);
  box-shadow: 0 4px 20px rgba(0, 255, 136, 0.3);
}

.notification.error {
  border-color: var(--bad);
  box-shadow: 0 4px 20px rgba(255, 0, 128, 0.3);
}

.notification.warning {
  border-color: var(--warn);
  box-shadow: 0 4px 20px rgba(255, 170, 0, 0.3);
}

/* ====================================
   ENHANCED MISSION ITEMS
   ==================================== */

.op {
  position: relative;
  cursor: pointer;
}

.op::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.op:hover::before {
  transform: scaleY(1);
}

.op:hover {
  transform: translateX(4px);
  background: linear-gradient(180deg, #1a1f21, #161a1d);
}

/* ====================================
   MAP CONTROLS
   ==================================== */

.view-toggle button,
.theme-switcher button {
  position: relative;
  overflow: hidden;
}

.view-toggle button::before,
.theme-switcher button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.4s, height 0.4s;
}

.view-toggle button:active::before,
.theme-switcher button:active::before {
  width: 100px;
  height: 100px;
}

/* ====================================
   SCROLLBAR STYLING
   ==================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent2);
}

::-webkit-scrollbar-corner {
  background: rgba(0, 0, 0, 0.3);
}

/* ====================================
   GLOW EFFECTS
   ==================================== */

.glow {
  box-shadow: 0 0 20px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 20px var(--accent);
    opacity: 1;
  }
  50% {
    box-shadow: 0 0 40px var(--accent);
    opacity: 0.8;
  }
}

/* ====================================
   CYBERPUNK GRID OVERLAY
   ==================================== */

.cyber-grid {
  position: relative;
  overflow: hidden;
}

.cyber-grid::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(var(--primary-glow) 1px, transparent 1px),
    linear-gradient(90deg, var(--primary-glow) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.1;
  pointer-events: none;
}

/* ====================================
   ENHANCED FORMS
   ==================================== */

input, select, textarea {
  transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* ====================================
   ACCESSIBILITY IMPROVEMENTS
   ==================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ====================================
   PERFORMANCE OPTIMIZATIONS
   ==================================== */

.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

.gpu-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* ====================================
   RESPONSIVE IMPROVEMENTS
   ==================================== */

@media (max-width: 768px) {
  .tooltip::before {
    font-size: 10px;
    padding: 6px 10px;
  }
  
  .notification {
    top: 10px;
    right: 10px;
    max-width: calc(100vw - 40px);
  }
  
  .btn {
    padding: 10px 14px;
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  .btn {
    padding: 8px 12px;
    font-size: 9px;
  }
  
  .notification {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

/* ====================================
   PRINT STYLES
   ==================================== */

@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
  
  .panel {
    border: 1px solid #000;
    box-shadow: none;
  }
}

