/* ============================================
   FILENOTARISE - Modern Tech UI
   ============================================ */

/* CSS Variables */
:root {
  /* Light Mode */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --accent: #0891b2;
  --accent-hover: #0e7490;
  --accent-glow: rgba(8, 145, 178, 0.3);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --gradient-start: #06b6d4;
  --gradient-end: #0891b2;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.2);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a24;
  --bg-input: #252532;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #2d2d3a;
  --accent: #22d3ee;
  --accent-hover: #67e8f9;
  --accent-glow: rgba(34, 211, 238, 0.4);
  --glass-bg: rgba(26, 26, 36, 0.8);
  --glass-border: rgba(255, 255, 255, 0.1);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Background Animation */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Animated Tech Background */
.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.bg-animation::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 80%, var(--accent-glow) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(14, 165, 233, 0.15) 0%, transparent 40%);
  animation: pulse 8s ease-in-out infinite;
}

.grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(var(--border-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-color) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.3;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 70%);
}

.floating-particles {
  position: absolute;
  width: 100%;
  height: 100%;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.6;
  animation: float 15s infinite;
}

.particle:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; top: 80%; animation-delay: 2s; }
.particle:nth-child(3) { left: 60%; top: 40%; animation-delay: 4s; }
.particle:nth-child(4) { left: 80%; top: 60%; animation-delay: 6s; }
.particle:nth-child(5) { left: 30%; top: 50%; animation-delay: 8s; }
.particle:nth-child(6) { left: 90%; top: 30%; animation-delay: 10s; }

@keyframes float {
  0%, 100% { transform: translateY(0) translateX(0); opacity: 0.6; }
  25% { transform: translateY(-30px) translateX(10px); opacity: 0.8; }
  50% { transform: translateY(-10px) translateX(-10px); opacity: 0.4; }
  75% { transform: translateY(-40px) translateX(5px); opacity: 0.7; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Layout */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.header {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px;
  height: 36px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.nav a:hover {
  color: var(--accent);
  background: var(--bg-input);
}

/* Theme Toggle */
.theme-toggle {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: var(--text-secondary);
  margin-left: 8px;
}

.theme-toggle:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* Main */
.main {
  flex: 1;
  padding: 48px 0;
  position: relative;
  z-index: 1;
}

/* Card */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 40px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
}

.card h1 {
  color: var(--text-primary);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 1rem;
}

/* Forms */
.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="email"] {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 1rem;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.form-group input[type="text"]::placeholder,
.form-group input[type="email"]::placeholder {
  color: var(--text-muted);
}

/* File Input */
.file-input-wrapper {
  position: relative;
}

.form-group input[type="file"] {
  width: 100%;
  padding: 32px;
  background: var(--bg-input);
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.form-group input[type="file"]:hover {
  border-color: var(--accent);
  background: rgba(6, 182, 212, 0.05);
}

.form-group input[type="file"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.form-group small {
  display: block;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Tag Input */
.tag-input-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  cursor: text;
  transition: all 0.2s ease;
  min-height: 52px;
}

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

.tag-input-wrapper input {
  flex: 1;
  min-width: 180px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1rem;
  color: var(--text-primary);
  padding: 4px 0;
}

.tag-input-wrapper input::placeholder {
  color: var(--text-muted);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.email-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: white;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  animation: tagIn 0.2s ease;
}

@keyframes tagIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.email-tag .tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 0.75rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: background 0.2s ease;
}

.email-tag .tag-remove:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

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

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-copy {
  padding: 6px 12px;
  font-size: 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.btn-copy:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Alerts */
.alert {
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
}

.alert-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-warning {
  background: var(--warning-bg);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .alert-warning {
  color: var(--warning);
}

/* Success Header */
.success-header {
  text-align: center;
  margin-bottom: 32px;
}

.success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: var(--success-bg);
  color: var(--success);
  border-radius: 50%;
  font-size: 2rem;
  margin-bottom: 16px;
  border: 2px solid rgba(16, 185, 129, 0.3);
}

/* Certificate Details */
.certificate-details {
  background: var(--bg-input);
  border-radius: 16px;
  padding: 24px;
  margin: 24px 0;
  border: 1px solid var(--border-color);
}

.detail-row {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-row .label {
  font-weight: 600;
  width: 140px;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.detail-row .value {
  flex: 1;
  color: var(--text-primary);
  font-weight: 500;
}

.detail-row .value.mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.9rem;
  background: var(--bg-secondary);
  padding: 4px 8px;
  border-radius: 6px;
}

/* Actions */
.actions {
  display: flex;
  gap: 16px;
  margin-top: 32px;
}

/* Results */
.result {
  text-align: center;
  padding: 40px;
  border-radius: 16px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.result::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0.1;
  background: radial-gradient(circle at center, currentColor 0%, transparent 70%);
}

.result-valid {
  background: var(--success-bg);
  color: var(--success);
  border: 2px solid rgba(16, 185, 129, 0.3);
}

.result-tampered {
  background: var(--error-bg);
  color: var(--error);
  border: 2px solid rgba(239, 68, 68, 0.3);
}

.result-not-found {
  background: var(--bg-input);
  color: var(--text-muted);
  border: 2px solid var(--border-color);
}

.result-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  font-size: 2.5rem;
  margin-bottom: 16px;
  background: var(--bg-card);
  position: relative;
  z-index: 1;
}

.result h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.result p {
  position: relative;
  z-index: 1;
}

/* Info Section */
.info-section {
  margin-top: 40px;
}

.info-section h2 {
  color: var(--text-primary);
  margin-bottom: 24px;
  font-size: 1.25rem;
  font-weight: 600;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}

.step {
  text-align: center;
  padding: 24px 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  transition: all 0.3s ease;
}

.step:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: white;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1.25rem;
  margin-bottom: 16px;
}

.step h3 {
  color: var(--text-primary);
  margin-bottom: 8px;
  font-weight: 600;
}

.step p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.instructions {
  padding-left: 24px;
  color: var(--text-secondary);
}

.instructions li {
  margin-bottom: 12px;
}

.instructions a {
  color: var(--accent);
  text-decoration: none;
}

.instructions a:hover {
  text-decoration: underline;
}

/* Footer */
.footer {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  padding: 24px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Error Page */
.error-page {
  text-align: center;
  padding: 80px 40px;
}

.error-page h1 {
  font-size: 6rem;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
  font-weight: 800;
}

.error-page p {
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 1.1rem;
}

/* Loading State */
.btn-loading {
  position: relative;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
  .header .container {
    flex-wrap: wrap;
    gap: 12px;
  }

  .nav {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .card {
    padding: 24px;
    border-radius: 16px;
  }

  .detail-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .detail-row .label {
    width: 100%;
  }

  .actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .steps {
    grid-template-columns: 1fr 1fr;
  }
}

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

  .container {
    padding: 0 16px;
  }
}

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

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Selection */
::selection {
  background: var(--accent);
  color: white;
}
