:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --warning: #f59e0b;
  --error: #dc2626;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
  --radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.header {
  text-align: center;
  padding: 24px 0;
}

.header h1 {
  font-size: 1.75rem;
  margin-bottom: 4px;
}

.header p {
  color: var(--text-muted);
}

/* Progress */
.progress-container {
  text-align: center;
  padding: 16px 0;
}

.progress-circle {
  width: 120px;
  height: 120px;
  margin: 0 auto 16px;
  position: relative;
}

.progress-circle svg {
  transform: rotate(-90deg);
}

.progress-circle circle {
  fill: none;
  stroke-width: 10;
}

.progress-circle .bg {
  stroke: var(--border);
}

.progress-circle .progress {
  stroke: var(--primary);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  font-weight: 700;
}

.progress-label {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Stamps Grid */
.stamps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.stamp-item {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  transition: all 0.2s;
}

.stamp-item.acquired {
  background: linear-gradient(135deg, #dbeafe, #ede9fe);
  border-color: var(--primary);
}

.stamp-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  font-weight: 700;
}

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

.stamp-icon.not-acquired-icon {
  color: var(--text-muted);
}

.stamp-item.acquired .stamp-icon {
  animation: stamp-bounce 0.5s ease;
}

@keyframes stamp-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.stamp-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}

.stamp-time {
  font-size: 0.625rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Form */
.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 0.875rem;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

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

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

.btn-block {
  width: 100%;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
}

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

/* Result Page */
.result-icon {
  font-size: 4rem;
  text-align: center;
  margin-bottom: 16px;
}

.result-success .result-icon { color: var(--success); }
.result-already .result-icon { color: var(--warning); }
.result-invalid .result-icon { color: var(--error); }

.result-message {
  text-align: center;
}

.result-message h1 {
  margin-bottom: 8px;
}

.result-message p {
  color: var(--text-muted);
}

.spot-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin: 16px 0;
}

/* Admin */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Table */
.table-container {
  overflow-x: auto;
  margin: 16px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--bg);
  padding: 4px;
  border-radius: 8px;
}

.tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}

.tab.active {
  background: var(--card-bg);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 400px;
  transform: scale(0.9);
  transition: transform 0.2s;
}

.modal-overlay.show .modal {
  transform: scale(1);
}

/* Tag URL */
.tag-url {
  background: var(--bg);
  padding: 12px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.75rem;
  word-break: break-all;
  margin: 8px 0;
}

/* Utilities */
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none; }

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 600;
}

.badge-success {
  background: #dcfce7;
  color: var(--success);
}

.badge-inactive {
  background: #fee2e2;
  color: var(--error);
}
