/* ===== CSS Variables & Reset ===== */
:root {
  --primary: #6c5ce7;
  --primary-dark: #5a4bd1;
  --primary-light: #a29bfe;
  --accent: #00cec9;
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-card-hover: #222240;
  --text: #e8e8f0;
  --text-muted: #9a9ab0;
  --border: #2d2d4a;
  --success: #00b894;
  --danger: #e17055;
  --warning: #fdcb6e;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Animated Background ===== */
.bg-shapes {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
}

.shape-1 {
  width: 600px; height: 600px;
  background: var(--primary);
  top: -200px; right: -100px;
  animation: float 20s ease-in-out infinite;
}

.shape-2 {
  width: 400px; height: 400px;
  background: var(--accent);
  bottom: -100px; left: -100px;
  animation: float 25s ease-in-out infinite reverse;
}

.shape-3 {
  width: 300px; height: 300px;
  background: var(--primary-light);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: float 30s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -30px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(10px, 40px) scale(1.02); }
}

/* ===== Navbar ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 15, 26, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.3rem;
}

.logo-icon { font-size: 1.6rem; }

.nav-links {
  display: flex;
  gap: 16px;
  align-items: center;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.nav-link:hover { color: var(--primary-light); }

/* ===== Hero ===== */
.hero {
  position: relative;
  z-index: 1;
  padding: 80px 0 60px;
}

.hero-content {
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.badge {
  display: inline-block;
  background: rgba(108, 92, 231, 0.15);
  color: var(--primary-light);
  padding: 6px 18px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 24px;
  border: 1px solid rgba(108, 92, 231, 0.3);
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 18px;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 40px;
  line-height: 1.7;
}

/* ===== Search Box ===== */
.search-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

.search-box {
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 8px 8px 20px;
  transition: border-color 0.3s;
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.15);
}

.search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 1.05rem;
  font-family: inherit;
  padding: 10px 0;
}

.search-box input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.search-box button {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.search-box button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.search-box button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.search-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 14px;
  text-align: center;
}

/* ===== Spinner ===== */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-large {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Result Container ===== */
.result-container {
  margin-top: 40px;
  animation: fadeIn 0.4s ease;
}

.hidden { display: none !important; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.cert-result {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
}

.cert-valid { border-color: var(--success); border-width: 2px; }
.cert-revoked { border-color: var(--danger); border-width: 2px; }
.cert-not-found { border-color: var(--warning); border-width: 2px; }

.cert-status {
  text-align: center;
  margin-bottom: 30px;
}

.status-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
}

.cert-status h2 {
  font-size: 1.6rem;
  font-weight: 700;
}

.cert-valid .cert-status h2 { color: var(--success); }
.cert-revoked .cert-status h2 { color: var(--danger); }

.cert-status p {
  color: var(--text-muted);
  margin-top: 10px;
  font-size: 0.95rem;
}

.cert-details {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: start;
}

.cert-main-info {
  display: grid;
  gap: 20px;
}

.cert-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cert-field label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

.cert-field span {
  font-size: 1.1rem;
  font-weight: 500;
}

.cert-code-value {
  font-family: 'Courier New', monospace;
  color: var(--primary-light);
  font-size: 1.2rem !important;
  font-weight: 700 !important;
  letter-spacing: 1px;
}

.cert-qr {
  text-align: center;
}

.cert-qr img {
  width: 180px;
  height: 180px;
  border-radius: 12px;
  border: 2px solid var(--border);
}

.cert-qr p {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 8px;
}

/* ===== Features ===== */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 80px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  transition: all 0.3s;
}

.feature-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.feature-card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  font-weight: 700;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ===== Footer ===== */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 80px;
}

/* ===== Admin Styles ===== */
.login-card {
  max-width: 400px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
}

.login-card h2 {
  text-align: center;
  margin-bottom: 30px;
  font-size: 1.5rem;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.15);
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239a9ab0' viewBox='0 0 12 12'%3e%3cpath d='M6 8.825L1.175 4 2.238 2.938 6 6.7 9.763 2.937 10.825 4z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.form-error {
  background: rgba(225, 112, 85, 0.1);
  border: 1px solid rgba(225, 112, 85, 0.3);
  color: var(--danger);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
}

.full-width { width: 100%; justify-content: center; }

.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
}

.btn-link:hover { color: var(--danger); }

.admin-panel {
  position: relative;
  z-index: 1;
  padding: 40px 0;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.admin-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
}

.cert-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 30px;
  box-shadow: var(--shadow);
}

.cert-form-card h3 {
  margin-bottom: 24px;
  font-size: 1.2rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.table-header h3 { font-size: 1.1rem; }

.cert-count {
  color: var(--text-muted);
  font-size: 0.85rem;
  background: rgba(108, 92, 231, 0.1);
  padding: 4px 12px;
  border-radius: 20px;
}

.table-responsive { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

thead { background: rgba(255, 255, 255, 0.03); }

th {
  text-align: left;
  padding: 14px 16px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

td {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: middle;
}

td code {
  background: rgba(108, 92, 231, 0.1);
  color: var(--primary-light);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 600;
}

tr:hover td { background: rgba(255, 255, 255, 0.02); }

.empty-state {
  text-align: center;
  padding: 40px !important;
  color: var(--text-muted);
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-active {
  background: rgba(0, 184, 148, 0.12);
  color: var(--success);
}

.status-revoked {
  background: rgba(225, 112, 85, 0.12);
  color: var(--danger);
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.2s;
  color: var(--text-muted);
  font-size: 1rem;
}

.btn-icon:hover { background: rgba(255,255,255,0.05); }
.btn-icon svg { display: block; }

.action-btns {
  display: flex;
  gap: 4px;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 420px;
  width: 90%;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute;
  top: 12px; right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.modal-close:hover { color: var(--text); background: rgba(255,255,255,0.05); }

.modal-content h3 {
  margin-bottom: 20px;
  font-size: 1.15rem;
  padding-right: 30px;
}

.qr-modal-body {
  text-align: center;
}

.qr-large {
  width: 250px;
  height: 250px;
  border-radius: 12px;
  border: 2px solid var(--border);
}

.qr-code-text {
  color: var(--primary-light);
  font-family: 'Courier New', monospace;
  font-weight: 700;
  font-size: 1rem;
  margin-top: 12px;
}

.qr-url {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 6px;
  word-break: break-all;
}

.back-link {
  color: var(--primary-light);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.back-link:hover { color: var(--primary); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero h1 { font-size: 2rem; }
  .hero-subtitle { font-size: 0.95rem; }
  
  .search-box {
    flex-direction: column;
    padding: 12px;
  }
  
  .search-box input { width: 100%; text-align: center; }
  .search-box button { width: 100%; justify-content: center; }
  .search-icon { display: none; }
  
  .features {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 50px;
  }

  .cert-details {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .cert-qr { order: -1; }
  
  .form-grid { grid-template-columns: 1fr; }
  
  .admin-header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  .cert-result { padding: 24px; }
}
