/* ===================================================
   PPTX to SCORM Converter — Application Styles
   =================================================== */

/* ----- CSS Variables ----- */
:root {
  --bg-primary: #0a0a14;
  --bg-secondary: #12121f;
  --bg-card: #16162a;
  --bg-card-hover: #1c1c36;
  --bg-input: #1a1a30;
  --text-primary: #eaeaf2;
  --text-secondary: #9999bb;
  --text-muted: #666688;
  --accent: #6c63ff;
  --accent-hover: #7b73ff;
  --accent-light: rgba(108, 99, 255, 0.12);
  --accent-glow: rgba(108, 99, 255, 0.25);
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.1);
  --error: #f87171;
  --error-bg: rgba(248, 113, 113, 0.1);
  --warning: #fbbf24;
  --border: #222240;
  --border-light: #2a2a4a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.3);
  --gradient-text: linear-gradient(135deg, #6c63ff, #b063ff, #ff63c5);
  --transition: all 0.2s ease;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a:hover {
  color: var(--accent-hover);
}

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

.main-content {
  flex: 1;
  padding: 40px 0;
}

/* ----- Navbar ----- */
.navbar {
  background: rgba(18, 18, 31, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.nav-brand:hover {
  color: var(--text-primary);
}

.brand-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  border-radius: 10px;
  font-size: 16px;
  color: white;
}

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

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
}

.nav-link:hover {
  background: var(--accent-light);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--accent-light);
  color: var(--accent);
}

/* ----- Hero ----- */
.hero {
  text-align: center;
  padding: 48px 0 40px;
}

.hero-title {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.15;
  margin-bottom: 16px;
}

.text-gradient {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ----- Upload Card ----- */
.upload-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 600px;
  margin: 0 auto 48px;
  box-shadow: var(--shadow);
}

/* ----- Dropzone ----- */
.dropzone {
  position: relative;
  border: 2px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 24px;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.dropzone-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.7;
}

.dropzone-main {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.dropzone-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-selected {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  margin-top: 16px;
}

.file-icon {
  font-size: 24px;
}

.file-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.file-remove {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.file-remove:hover {
  color: var(--error);
}

/* ----- Buttons ----- */
.btn-submit {
  width: 100%;
  padding: 14px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.btn-submit:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 4px 20px var(--accent-glow);
}

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

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

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

/* ----- Errors ----- */
.field-errors {
  background: var(--error-bg);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.error-text {
  color: var(--error);
  font-size: 13px;
  font-weight: 500;
}

/* ----- Alerts ----- */
.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  margin: 16px 0;
  font-size: 14px;
  font-weight: 500;
  animation: fadeInDown 0.3s ease;
}

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

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.alert-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.alert-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.6;
}

.alert-close:hover {
  opacity: 1;
}

/* ----- Features Grid ----- */
.features {
  padding: 16px 0 48px;
}

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

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  transition: var(--transition);
}

.feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.feature-icon {
  font-size: 32px;
  margin-bottom: 14px;
}

.feature-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.feature-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ----- Result Page ----- */
.result-card {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  text-align: center;
  box-shadow: var(--shadow);
}

.result-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 20px;
  background: var(--success-bg);
  color: var(--success);
  border: 2px solid rgba(52, 211, 153, 0.2);
}

.error-icon {
  background: var(--error-bg) !important;
  color: var(--error) !important;
  border-color: rgba(248, 113, 113, 0.2) !important;
}

.result-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

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

.result-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 32px;
  padding: 24px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.btn-action {
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-preview {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-preview:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}

.btn-download {
  background: var(--accent);
  color: white;
}

.btn-download:hover {
  background: var(--accent-hover);
  color: white;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary-action {
  background: var(--accent);
  color: white;
}

.btn-primary-action:hover {
  background: var(--accent-hover);
  color: white;
}

.error-details {
  background: var(--error-bg);
  border: 1px solid rgba(248,113,113,0.2);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  text-align: left;
  font-size: 13px;
  color: var(--error);
  margin-bottom: 24px;
  word-break: break-word;
}

/* ----- Preview Container ----- */
.preview-container {
  margin-top: 16px;
}

.preview-heading {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.preview-frame-wrapper {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.preview-frame {
  width: 100%;
  height: 850px;
  border: none;
  background: #0f0f1a;
}

/* ----- History Page ----- */
.page-header {
  margin-bottom: 32px;
}

.page-title {
  font-size: 32px;
  font-weight: 700;
}

.page-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.history-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
}

.history-table th {
  padding: 14px 20px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.history-table td {
  padding: 14px 20px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

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

.history-row:hover {
  background: var(--bg-card-hover);
}

.cell-file {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.file-icon-sm {
  font-size: 18px;
}

.cell-date {
  color: var(--text-secondary);
  font-size: 13px;
}

.cell-actions {
  display: flex;
  gap: 12px;
}

.action-link {
  font-size: 13px;
  font-weight: 500;
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-completed {
  background: var(--success-bg);
  color: var(--success);
}

.status-failed {
  background: var(--error-bg);
  color: var(--error);
}

.status-processing {
  background: rgba(251, 191, 36, 0.1);
  color: var(--warning);
}

.status-pending {
  background: rgba(153, 153, 187, 0.1);
  color: var(--text-secondary);
}

/* ----- Pagination ----- */
.pagination-nav {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
}

.page-link:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.page-info {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ----- Empty State ----- */
.empty-state {
  text-align: center;
  padding: 80px 24px;
}

.empty-icon {
  font-size: 64px;
  opacity: 0.3;
  margin-bottom: 16px;
}

.empty-state h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ----- Spinner Large ----- */
.spinner-large {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

/* ----- Footer ----- */
.footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  text-align: center;
}

.footer p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
  .hero-title { font-size: 32px; }
  .result-stats { gap: 20px; padding: 16px; }
  .result-card { padding: 32px 20px; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .feature-grid { grid-template-columns: 1fr; }
  .result-actions { flex-direction: column; }
}
