:root {
  --bg-primary: #f0f3fb;
  --bg-card: #ffffff;
  --bg-card-alt: #f8fafc;
  
  --border-color: #e2e8f0;
  --border-focus: #2196f3;
  
  --text-main: #32325d;
  --text-muted: #6d727a;
  --text-dim: #94a3b8;
  
  --primary: #2196f3;
  --primary-hover: #1976d2;
  --primary-light: #e3f2fd;
  --primary-shadow: rgba(33, 150, 243, 0.25);
  
  --success-color: #2e7d32;
  --success-bg: #e8f5e9;
  --success-border: #a5d6a7;
  
  --warning-color: #f57c00;
  --warning-bg: #fff3e0;
  --warning-border: #ffe0b2;
  
  --info-color: #0284c7;
  --info-bg: #e0f2fe;
  --info-border: #bae6fd;
  
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  --shadow-card: 0 4px 20px rgba(50, 50, 93, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 8px 25px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.05);
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font-main: 'Roboto', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Consolas, monospace;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  font-size: 0.9375rem;
  position: relative;
}

/* Subtle background accent shapes */
.background-globes {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.globe {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
}

.globe-1 {
  width: 400px;
  height: 400px;
  background: rgba(33, 150, 243, 0.12);
  top: -80px;
  right: -80px;
}

.globe-2 {
  width: 500px;
  height: 500px;
  background: rgba(103, 58, 183, 0.08);
  bottom: -150px;
  left: -100px;
}

.globe-3 {
  width: 300px;
  height: 300px;
  background: rgba(3, 169, 244, 0.1);
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.app-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1.25rem;
}

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

.logo-badge {
  background: var(--primary-light);
  border: 1px solid rgba(33, 150, 243, 0.3);
  padding: 0.65rem;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px var(--primary-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 50px;
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
  transition: var(--transition);
}

.status-badge.ready {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success-color);
}

.status-badge.warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning-color);
}

.status-badge.loading {
  background: var(--primary-light);
  border-color: rgba(33, 150, 243, 0.3);
  color: var(--primary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
  box-shadow: 0 0 6px currentColor;
  animation: pulseDot 2s infinite;
}

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

/* Main Content Cards */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.card-header.border-bottom {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.card-title h2, .card-title h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.icon {
  width: 22px;
  height: 22px;
  color: var(--primary);
}

.icon-success {
  width: 24px;
  height: 24px;
  color: var(--success-color);
}

.badge {
  font-size: 0.725rem;
  padding: 0.2rem 0.6rem;
  border-radius: 50px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.info-badge {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(33, 150, 243, 0.3);
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.input-wrapper {
  position: relative;
  width: 100%;
}

textarea, input[type="text"], input[type="number"], select {
  width: 100%;
  background: #ffffff;
  border: 1px solid #ced4da;
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.875rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.875rem;
  transition: var(--transition);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 85px;
  font-family: var(--font-mono);
  font-size: 0.825rem;
}

textarea:focus, input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.15);
  background: #ffffff;
}

.btn-icon {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 0.75rem;
}

.btn-icon:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* Detection Card */
.detection-card {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  margin-bottom: 1.25rem;
  animation: fadeIn 0.3s ease-out;
}

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

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

.detection-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.tag-presigned {
  background: var(--warning-bg);
  color: var(--warning-color);
  border: 1px solid var(--warning-border);
}

.tag-standard {
  background: var(--success-bg);
  color: var(--success-color);
  border: 1px solid var(--success-border);
}

.detection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.detection-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.item-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.item-value {
  font-size: 0.85rem;
  color: var(--text-main);
  word-break: break-all;
  font-weight: 600;
}

.font-mono {
  font-family: var(--font-mono);
}

.banner {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  margin-top: 0.875rem;
  font-size: 0.8125rem;
}

.info-banner {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: #0369a1;
}

.banner-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--info-color);
  margin-top: 2px;
}

/* Options Grid */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.custom-select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg fill='%236d727a' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  cursor: pointer;
}

/* Advanced Accordion */
.advanced-details {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 1rem;
  overflow: hidden;
}

.advanced-summary {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: var(--transition);
}

.advanced-summary:hover {
  color: var(--text-main);
  background: #f1f5f9;
}

.chevron {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

details[open] .chevron {
  transform: rotate(180deg);
}

.advanced-body {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  background: #ffffff;
}

/* Button Primary */
.action-container {
  margin-top: 1.5rem;
}

.btn-primary {
  width: 100%;
  padding: 0.875rem 1.25rem;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--primary-shadow);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 16px rgba(33, 150, 243, 0.35);
}

.btn-primary:active {
  transform: translateY(1px);
}

/* Result Card */
.result-card {
  border-color: var(--success-border);
  box-shadow: 0 8px 24px rgba(46, 125, 50, 0.08);
  animation: slideUp 0.35s ease-out;
}

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

.text-success {
  color: var(--success-color) !important;
}

.url-result-box {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#resultUrl {
  color: #1b5e20;
  background: var(--success-bg);
  border-color: var(--success-border);
  font-weight: 500;
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  background: #ffffff;
  border: 1px solid #ced4da;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: #f8f9fa;
  border-color: #adb5bd;
  color: #1e293b;
}

.btn-icon-svg {
  width: 16px;
  height: 16px;
}

/* Metadata Grid */
.metadata-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.875rem;
  margin-top: 1.25rem;
}

.meta-card {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.meta-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.meta-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  word-break: break-all;
}

.timer {
  color: var(--primary);
  font-size: 1.05rem;
  font-family: var(--font-mono);
}

.text-small {
  font-size: 0.775rem;
}

.app-footer {
  text-align: center;
  margin-top: 2.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

/* Spinner */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
}

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