/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f23;
  --surface: #1a1a2e;
  --surface-2: #16213e;
  --primary: #4fc3f7;
  --primary-dark: #0288d1;
  --accent: #e94560;
  --text: #e0e0e0;
  --text-muted: #9e9e9e;
  --border: #2a2a4a;
  --success: #66bb6a;
  --radius: 8px;
}

body {
  font-family: 'Segoe UI', 'Microsoft JhengHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 40px 20px;
}

header {
  text-align: center;
  margin-bottom: 40px;
}

header h1 {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  margin-top: 8px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
}

.tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Forms */
.auth-form, .upload-form {
  background: var(--surface);
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--primary-dark);
  color: white;
  width: 100%;
}

.btn-primary:hover { background: var(--primary); color: var(--bg); }

.btn-accent {
  background: var(--accent);
  color: white;
}

.btn-accent:hover { opacity: 0.9; }

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}

/* Error messages */
.error {
  color: var(--accent);
  margin-top: 12px;
  font-size: 0.9rem;
}

/* Dashboard */
.dashboard-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.dashboard-header h1 { font-size: 1.5rem; }

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}

.upload-section {
  background: var(--surface);
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 32px;
}

.upload-section h2 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--primary);
}

.file-input-wrapper {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.file-input-wrapper input[type="file"] {
  flex: 1;
  min-width: 200px;
}

/* Presentation list */
.pres-list {
  display: grid;
  gap: 16px;
}

.pres-card {
  background: var(--surface);
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color 0.2s;
}

.pres-card:hover { border-color: var(--primary); }

.pres-info h3 { font-size: 1.1rem; margin-bottom: 4px; }

.pres-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pres-actions {
  display: flex;
  gap: 8px;
}

/* Layout selector */
.layout-selector {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.layout-option {
  padding: 8px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text);
  font-size: 0.9rem;
  transition: all 0.2s;
}

.layout-option:hover { border-color: var(--primary); }
.layout-option.active {
  border-color: var(--primary);
  background: var(--primary-dark);
  color: white;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Impress.js presentation overrides */
.step {
  width: 1920px;
  height: 1080px;
  padding: 60px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  font-size: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.step h1 { font-size: 3rem; margin-bottom: 24px; color: var(--primary); }
.step h2 { font-size: 2.4rem; margin-bottom: 20px; color: var(--primary); }
.step h3 { font-size: 1.8rem; margin-bottom: 16px; }
.step p { margin-bottom: 16px; }
.step ul, .step ol { margin-left: 40px; margin-bottom: 16px; }
.step li { margin-bottom: 8px; }
.step code { background: var(--bg); padding: 2px 8px; border-radius: 4px; font-size: 0.9em; }
.step pre { background: var(--bg); padding: 20px; border-radius: 8px; overflow-x: auto; }
.step pre code { background: none; padding: 0; }
.step img { max-width: 100%; max-height: 80%; object-fit: contain; border-radius: 8px; }

/* Title slide special styling */
.step.title-slide {
  text-align: center;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
}
.step.title-slide h1 {
  font-size: 3.5rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Responsive: mobile */
@media (max-width: 768px) {
  .container { padding: 20px 12px; }

  header h1 { font-size: 1.4rem; }

  .dashboard-container { padding: 12px; }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .pres-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .pres-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .file-input-wrapper {
    flex-direction: column;
  }

  .file-input-wrapper .btn { width: 100%; }

  /* Editor overlay mobile */
  .editor-body {
    grid-template-columns: 1fr !important;
  }
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Selection color */
::selection {
  background: rgba(79, 195, 247, 0.3);
  color: var(--text);
}
