/* Modern CSS Design System - Port Checker (CanYouSeeMe Clone) */

svg {
  display: inline-block;
  vertical-align: middle;
}

:root {
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Color Palette */
  --bg-dark: #090d16;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(31, 41, 55, 0.85);
  --bg-input: rgba(15, 23, 42, 0.8);
  
  --border-color: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(6, 182, 212, 0.5);

  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.35);
  --accent-blue: #3b82f6;
  
  --status-open: #10b981;
  --status-open-glow: rgba(16, 185, 129, 0.25);
  --status-closed: #ef4444;
  --status-closed-glow: rgba(239, 68, 68, 0.25);
  --status-timeout: #f59e0b;
  --status-timeout-glow: rgba(245, 158, 11, 0.25);

  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-main: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Dynamic Glowing Background Effects */
.bg-glow-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.25;
  animation: floatOrb 15s infinite alternate ease-in-out;
}

.orb-1 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #06b6d4, #3b82f6);
  top: -100px;
  left: -100px;
}

.orb-2 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, #8b5cf6, #ec4899);
  bottom: -150px;
  right: -150px;
  animation-delay: -7s;
}

.orb-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #10b981, #06b6d4);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -3s;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 60px) scale(1.1); }
  100% { transform: translate(-30px, -40px) scale(0.95); }
}

/* App Layout Container */
.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 900px;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Header Section */
.app-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--accent-cyan);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-cyan);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.4; }
}

.app-title {
  font-family: var(--font-heading);
  font-size: 2.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 50%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

.app-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 600px;
}

/* Glassmorphic Card */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-main);
  transition: var(--transition);
}

/* Form Styles */
.check-form {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 1.25rem;
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.btn-detect {
  background: none;
  border: none;
  color: var(--accent-cyan);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: var(--transition);
}

.btn-detect:hover {
  color: #38bdf8;
  text-decoration: underline;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.custom-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.8rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: var(--transition);
}

.custom-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 4px var(--accent-cyan-glow);
}

/* Quick Presets */
.presets-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

.presets-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.preset-pill {
  padding: 0.4rem 0.85rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.preset-pill:hover {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.preset-pill.active {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: #000;
  font-weight: 600;
  box-shadow: 0 0 12px var(--accent-cyan-glow);
}

.preset-port {
  opacity: 0.75;
  font-size: 0.75rem;
}

/* Submit Action Button */
.btn-submit {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, #06b6d4 0%, #2563eb 100%);
  border: none;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 4px 20px var(--accent-cyan-glow);
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(6, 182, 212, 0.5);
  filter: brightness(1.1);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Result Section */
.result-card {
  display: none;
  animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.result-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge-open {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--status-open);
  color: var(--status-open);
  box-shadow: 0 0 20px var(--status-open-glow);
}

.status-badge-closed {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--status-closed);
  color: var(--status-closed);
  box-shadow: 0 0 20px var(--status-closed-glow);
}

.status-badge-timeout {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--status-timeout);
  color: var(--status-timeout);
  box-shadow: 0 0 20px var(--status-timeout-glow);
}

.result-latency {
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.result-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-message {
  font-size: 1.05rem;
  line-height: 1.6;
}

.result-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.detail-key {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-val {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* History Section */
.history-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-clear:hover {
  color: var(--status-closed);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  transition: var(--transition);
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.history-target {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.history-tag {
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.tag-open {
  background: rgba(16, 185, 129, 0.2);
  color: var(--status-open);
}

.tag-closed {
  background: rgba(239, 68, 68, 0.2);
  color: var(--status-closed);
}

.tag-timeout {
  background: rgba(245, 158, 11, 0.2);
  color: var(--status-timeout);
}

/* Footer */
.app-footer {
  text-align: center;
  padding-top: 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.footer-badges {
  display: flex;
  gap: 0.75rem;
}

.tech-badge {
  padding: 0.2rem 0.6rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Mode Navigation Tabs */
.mode-tabs {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.mode-tab {
  padding: 0.75rem 1.25rem;
  background: rgba(17, 24, 39, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  transition: var(--transition);
}

.mode-tab:hover {
  background: rgba(31, 41, 55, 0.8);
  color: var(--text-primary);
  border-color: rgba(6, 182, 212, 0.3);
}

.mode-tab.active {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2) 0%, rgba(37, 99, 235, 0.2) 100%);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 15px var(--accent-cyan-glow);
}

/* Mode Content Toggle */
.mode-content {
  display: none;
}

.mode-content.active {
  display: block;
  animation: fadeIn 0.3s ease-out forwards;
}

.target-ip-bar {
  margin-bottom: 1.5rem;
}

/* Auto Scan Range Grid */
.range-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 600px) {
  .range-grid {
    grid-template-columns: 1fr;
  }
}

.scan-desc-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.btn-scan {
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.35);
}

.btn-scan:hover {
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
}

/* Progress Bar */
.progress-box {
  margin-top: 1.5rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.progress-bar-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #06b6d4 0%, #10b981 100%);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

/* Scan Results Grid */
.scan-results-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  animation: fadeIn 0.4s ease-out forwards;
}

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

.scan-target-tag {
  font-size: 0.85rem;
  padding: 0.3rem 0.8rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}

.open-ports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.open-port-card {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: var(--transition);
  position: relative;
}

.open-port-card:hover {
  background: rgba(16, 185, 129, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.25);
}

.port-number-badge {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--status-open);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.port-service-name {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 600;
}

.port-latency-info {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
