/* ==================== CSS VARIABLES ==================== */
:root {
  --color-bg: #f1f5f9;
  --color-surface: #ffffff;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --color-primary: #0f172a;
  --color-primary-hover: #1e293b;
  --color-success: #10b981;
  --color-success-bg: #d1fae5;
  --color-info: #3b82f6;
  --color-info-bg: #dbeafe;
  --radius: 12px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --transition: all 0.2s ease;
}

/* ==================== RESET ==================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

/* ==================== LAYOUT ==================== */
.container {
  width: 100%;
  max-width: 1000px;
}

.card {
  padding: 2rem;
  animation: fadeIn 0.4s ease;
}

/* ==================== HEADER ==================== */
.header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--color-border);
}

.header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--color-primary);
  color: white;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.header h1 {
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.header p {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

/* ==================== FORM ==================== */
.form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.required {
  color: #dc2626;
}

.optional {
  color: var(--color-text-muted);
  font-weight: 400;
}

.info {
  color: var(--color-info);
  font-weight: 400;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  outline: none;
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.1);
}

.form-group input::placeholder {
  color: var(--color-text-muted);
}

.form-group input[readonly] {
  background: var(--color-info-bg);
  color: var(--color-info);
  cursor: not-allowed;
}

.form-group select {
  cursor: pointer;
}

/* ==================== BUTTONS ==================== */
.btn-primary,
.btn-secondary,
.btn-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: inherit;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  width: 100%;
  color: white;
  background: var(--color-primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-bg);
  border-color: var(--color-primary);
}

.btn-copy {
  padding: 0.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.btn-copy:hover {
  background: var(--color-success-bg);
  border-color: var(--color-success);
  color: var(--color-success);
}

.btn-copy.copied {
  background: var(--color-success-bg);
  border-color: var(--color-success);
  color: var(--color-success);
}

/* ==================== RESULT SECTION ==================== */
.result-section {
  display: none;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  animation: slideDown 0.4s ease;
}

.result-section.show {
  display: block;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  color: var(--color-success);
}

.result-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.result-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.cert-id-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--color-surface);
  border: 2px solid var(--color-success);
  border-radius: 8px;
  padding: 1rem;
}

.cert-id-display code {
  flex: 1;
  font-family: "Courier New", monospace;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-success);
  word-break: break-all;
}

.result-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.detail-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.875rem;
}

.detail-label {
  display: block;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

.detail-value {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
  word-break: break-word;
}

.result-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.result-actions .btn-secondary {
  flex: 1;
}

/* ==================== FOOTER ==================== */
.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.footer svg {
  color: var(--color-text-muted);
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .form {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 1.5rem;
  }

  .result-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  body {
    padding: 1rem;
  }

  .header h1 {
    font-size: 1.25rem;
  }

  .header p {
    font-size: 0.875rem;
  }

  .card {
    padding: 1.25rem;
  }

  .cert-id-display code {
    font-size: 0.8125rem;
  }
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
  width: 1px;
}

::-webkit-scrollbar-track {
  background: transparent;
}
