/* === シフト提出アプリ - モバイルファーストCSS === */

:root {
  --primary: #06C755;
  --primary-dark: #05a848;
  --danger: #e74c3c;
  --warning: #f39c12;
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --text: #333333;
  --text-light: #888888;
  --border: #e0e0e0;
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 80px;
}

/* === Loading Overlay === */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 12px;
}

.loading-overlay.active {
  display: flex;
}

.spinner {
  width: 36px;
  height: 36px;
  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); }
}

.loading-text {
  color: var(--text-light);
  font-size: 14px;
}

/* === Error Message === */
.error-message {
  display: none;
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 16px;
  font-size: 13px;
}

/* === Header === */
.header {
  background: var(--primary);
  color: white;
  padding: 16px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header h1 {
  font-size: 16px;
  font-weight: 600;
}

.header .subtitle {
  font-size: 12px;
  opacity: 0.9;
  margin-top: 2px;
}

/* === Unauthorized === */
.unauthorized {
  text-align: center;
  padding: 60px 24px;
}

.unauthorized .icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.unauthorized p {
  color: var(--text-light);
  font-size: 14px;
}

/* === Container === */
.container {
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
}

/* === Greeting === */
.greeting {
  text-align: center;
  padding: 20px 0;
}

.greeting .name {
  font-size: 18px;
  font-weight: 600;
}

.greeting .welcome {
  color: var(--text-light);
  font-size: 13px;
  margin-top: 4px;
}

/* === Period Card === */
.period-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: transform 0.1s;
  border: 2px solid transparent;
}

.period-card:active {
  transform: scale(0.98);
}

.period-card .period-title {
  font-size: 16px;
  font-weight: 600;
}

.period-card .period-dates {
  color: var(--text-light);
  font-size: 13px;
  margin-top: 4px;
}

.period-card .arrow {
  float: right;
  color: var(--text-light);
  font-size: 20px;
  margin-top: -20px;
}

/* === Bulk Settings === */
.bulk-settings {
  background: var(--card-bg);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.bulk-header {
  padding: 12px 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8faf8;
  border-bottom: 1px solid var(--border);
}

.bulk-header .toggle-icon {
  transition: transform 0.2s;
  font-size: 12px;
}

.bulk-header.open .toggle-icon {
  transform: rotate(180deg);
}

.bulk-body {
  padding: 16px;
  display: none;
}

.bulk-body.open {
  display: block;
}

.bulk-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.bulk-row label {
  font-size: 13px;
  color: var(--text-light);
  min-width: 40px;
}

.btn-apply-all {
  width: 100%;
  padding: 10px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-apply-all:active {
  background: var(--primary-dark);
}

/* === Availability Buttons === */
.avail-group {
  display: flex;
  gap: 4px;
}

.avail-btn {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: white;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.avail-btn.selected-maru {
  border-color: var(--primary);
  background: #e8f9ee;
  color: var(--primary);
  font-weight: bold;
}

.avail-btn.selected-sankaku {
  border-color: var(--warning);
  background: #fef9e7;
  color: var(--warning);
  font-weight: bold;
}

.avail-btn.selected-batsu {
  border-color: var(--danger);
  background: #fef2f2;
  color: var(--danger);
  font-weight: bold;
}

/* === Date Row (Shift entry per day) === */
.date-row {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.date-row.weekend {
  border-left: 3px solid var(--warning);
}

.date-label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.date-label .day-of-week {
  font-weight: normal;
  color: var(--text-light);
  margin-left: 4px;
}

.date-label .day-of-week.sun {
  color: var(--danger);
}

.date-label .day-of-week.sat {
  color: #3b82f6;
}

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

.time-select {
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 4px;
  font-size: 13px;
  background: white;
  color: var(--text);
  flex: 1;
  min-width: 75px;
  max-width: 90px;
}

.time-separator {
  color: var(--text-light);
  font-size: 13px;
}

.time-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

/* === Summary Fields === */
.summary-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.summary-section h3 {
  font-size: 14px;
  margin-bottom: 12px;
}

.field-group {
  margin-bottom: 12px;
}

.field-group label {
  display: block;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.field-group input,
.field-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.field-group textarea {
  height: 80px;
  resize: vertical;
}

.count-display {
  color: var(--text-light);
  font-size: 12px;
  margin-top: 4px;
}

/* === Sticky Footer Button === */
.sticky-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: white;
  border-top: 1px solid var(--border);
  z-index: 100;
}

.btn-primary {
  display: block;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

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

.btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.btn-secondary {
  display: block;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 14px;
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  cursor: pointer;
}

.footer-buttons {
  display: flex;
  gap: 8px;
  max-width: 480px;
  margin: 0 auto;
}

.footer-buttons .btn-secondary,
.footer-buttons .btn-primary {
  flex: 1;
}

/* === Confirm Page === */
.confirm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.confirm-table th,
.confirm-table td {
  padding: 8px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.confirm-table th {
  background: #f8faf8;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-light);
}

.confirm-table .date-cell {
  text-align: left;
  font-weight: 600;
}

.confirm-summary {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.confirm-summary dt {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 8px;
}

.confirm-summary dt:first-child {
  margin-top: 0;
}

.confirm-summary dd {
  font-size: 14px;
  margin-top: 2px;
}

/* === Done Page === */
.done-content {
  text-align: center;
  padding: 48px 24px;
}

.done-content .check-icon {
  width: 64px;
  height: 64px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: white;
  font-size: 32px;
}

.done-content h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.done-content p {
  color: var(--text-light);
  font-size: 14px;
}
