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

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --success-hover: #15803d;
  --error: #dc2626;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: var(--shadow);
}

/* Logo */
.logo {
  font-size: 4rem;
  text-align: center;
  margin-bottom: 1rem;
}

.logo-small {
  font-size: 2rem;
}

/* Typography */
h1 {
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 2rem;
}

/* Header with logout */
.header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  position: relative;
}

.header h1 {
  margin-bottom: 0;
}

.btn-icon {
  position: absolute;
  right: 0;
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--border);
  color: var(--text);
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text);
}

input, select {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--card-bg);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-primary:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
}

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

.btn-success:hover {
  background: var(--success-hover);
}

.btn-secondary {
  background: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-text {
  display: inline;
}

.btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Spinner */
.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Progress */
.progress-container {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: 0.5rem;
}

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

/* Results */
.result {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border-radius: 0.5rem;
  text-align: center;
}

.result.success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.result.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.result-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.result.success .result-icon {
  color: var(--success);
}

.result.error .result-icon {
  color: var(--error);
}

.result h3 {
  margin-bottom: 0.5rem;
}

.result p {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.result .btn {
  width: auto;
  padding: 0.75rem 2rem;
}

/* Error message */
.error {
  color: var(--error);
  font-size: 0.875rem;
  margin-top: 1rem;
  text-align: center;
}

/* History */
.history-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.history-section h3 {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.history-list {
  list-style: none;
}

.history-list li {
  padding: 0.5rem 0;
  font-size: 0.875rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-list li.empty {
  color: var(--text-muted);
  font-style: italic;
}

.history-list a {
  color: var(--primary);
  text-decoration: none;
}

.history-list a:hover {
  text-decoration: underline;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Footer */
footer {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 480px) {
  .container {
    padding: 1rem;
  }

  .card {
    padding: 1.5rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}
