/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-dark: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.85);
  --border-color: rgba(255, 255, 255, 0.1);
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #cbd5e1;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow-glow: 0 10px 30px -10px rgba(16, 185, 129, 0.25);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(at 0% 0%, rgba(6, 182, 212, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.12) 0px, transparent 50%);
}

.app-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  width: 100%;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Navbar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-name {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-name span {
  color: var(--accent-emerald);
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.version-badge {
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.4);
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

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

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Hero Section */
.hero-section {
  text-align: center;
  margin-bottom: 36px;
}

.hero-section h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 38px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 12px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-emerald));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto;
}

/* Glass Card Container */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-glow);
}

.step-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.step-panel.hidden {
  display: none !important;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-emerald));
  color: #0f172a;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.step-header h2 {
  font-size: 20px;
  font-weight: 600;
}

/* Dropzone */
.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(15, 23, 42, 0.4);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.05);
}

.upload-icon {
  color: var(--accent-cyan);
  margin-bottom: 12px;
}

.browse-link {
  color: var(--accent-cyan);
  text-decoration: underline;
}

.dropzone-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

.file-input-hidden {
  display: none;
}

/* File List */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-name {
  font-weight: 500;
  font-size: 14px;
}

.file-size {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-remove {
  background: none;
  border: none;
  color: #f43f5e;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-emerald {
  background: linear-gradient(135deg, var(--accent-emerald), #059669);
  color: #fff;
}

.btn-emerald:hover:not(:disabled) {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.step-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 12px;
}

.step-actions.vertical {
  flex-direction: column;
  justify-content: stretch;
}

/* Config Grid */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
}

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

.pdf-preview-container {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(30, 41, 59, 0.8);
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

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

.btn-icon {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
}

.canvas-wrapper {
  padding: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 420px;
}

.pdf-page-mockup {
  width: 100%;
  max-width: 480px;
  min-height: 420px;
  background: #ffffff;
  border-radius: 4px;
  position: relative;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  user-select: none;
  overflow: hidden;
}

.pdf-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.info-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.info-card-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--accent-cyan);
}

.info-card-text {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Signature Stamp Box (Draggable) */
.signature-stamp-box {
  position: absolute;
  left: 50px;
  top: 280px;
  width: 200px;
  height: 70px;
  background: rgba(240, 249, 255, 0.95);
  border: 1.5px solid #1d4ed8;
  border-radius: 6px;
  padding: 6px 8px;
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.25);
  cursor: grab;
  color: #0f172a;
}

.signature-stamp-box:active {
  cursor: grabbing;
}

.stamp-header {
  font-size: 9px;
  font-weight: 700;
  background: #1d4ed8;
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
  display: inline-block;
  margin-bottom: 4px;
}

.stamp-body {
  font-size: 8.5px;
  line-height: 1.3;
  color: #1e293b;
}

.drag-handle {
  position: absolute;
  right: 4px;
  bottom: 4px;
  font-size: 8px;
  color: #64748b;
  background: #e2e8f0;
  padding: 1px 4px;
  border-radius: 3px;
}

/* Config Form */
.config-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
}

.input-text {
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: white;
  font-size: 14px;
}

.input-text:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.form-group small {
  font-size: 11px;
  color: var(--text-muted);
}

.stamp-position-info {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.info-row {
  display: flex;
  justify-content: space-between;
}

/* Modal Backdrop */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-backdrop.hidden {
  display: none !important;
}

.glass-modal {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 440px;
  width: 90%;
  position: relative;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.qr-wrapper {
  margin: 20px 0;
  background: white;
  padding: 12px;
  border-radius: var(--radius-md);
  display: inline-block;
  position: relative;
}

#qr-image {
  width: 240px;
  height: 240px;
  display: block;
}

.status-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-top: 10px;
}

.status-indicator-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-indicator-dot.yellow { background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }
.status-indicator-dot.blue { background: #3b82f6; box-shadow: 0 0 8px #3b82f6; }
.status-indicator-dot.green { background: #10b981; box-shadow: 0 0 8px #10b981; }

.modal-footer {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Success Step */
.success-banner {
  text-align: center;
  padding: 20px 0;
}

.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.signed-files-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.signed-file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
}

/* Footer */
.footer {
  margin-top: auto;
  padding-top: 32px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* Responsive Styles for Mobile Devices */
@media (max-width: 768px) {
  .app-container {
    padding: 14px 12px;
  }

  .navbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 24px;
  }

  .brand {
    width: 100%;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .brand-name {
    font-size: 19px;
  }

  .badge {
    font-size: 10px;
    padding: 2px 8px;
  }

  .nav-status {
    width: 100%;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 12px;
    justify-content: flex-start;
  }

  .hero-section h1 {
    font-size: 26px;
  }

  .hero-sub {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .brand-name {
    font-size: 17px;
  }

  .badge {
    font-size: 9px;
    padding: 2px 6px;
  }
}
