/* ==========================================================================
   SUKI SHIFT - 夜勤・昼勤ライフスケジューラー Stylesheet
   ========================================================================== */

:root {
  --bg-main: #0b0f19;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.8);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(56, 189, 248, 0.5);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-blue: #38bdf8;
  --accent-purple: #c084fc;
  --accent-night: #a855f7;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-indigo: #6366f1;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  padding: 16px;
}

/* App Container */
.app-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* App Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 1.8rem;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(56, 189, 248, 0.3));
  border: 1px solid rgba(168, 85, 247, 0.4);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

.logo-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 40%, var(--accent-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-badge {
  font-size: 0.72rem;
  background: rgba(168, 85, 247, 0.2);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #d8b4fe;
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* Month Navigation */
.month-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px 6px;
}

.btn-nav {
  background: none;
  border: none;
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.btn-nav:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.current-month-display {
  font-family: monospace;
  font-size: 1.1rem;
  font-weight: 800;
  padding: 0 10px;
  min-width: 120px;
  text-align: center;
  color: #fff;
}

.btn-today {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-blue);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-today:hover {
  background: var(--accent-blue);
  color: #000;
}

/* Action Buttons */
.action-buttons-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.btn-action:hover {
  filter: brightness(1.2);
  transform: translateY(-1px);
}

.btn-google-sync {
  background: linear-gradient(135deg, rgba(66, 133, 244, 0.2), rgba(52, 168, 83, 0.2));
  border-color: rgba(66, 133, 244, 0.4);
  color: #93c5fd;
}

.btn-export-ics {
  background: rgba(255, 255, 255, 0.06);
}

.btn-settings {
  background: rgba(255, 255, 255, 0.06);
}

/* Summary Banner */
.summary-banner {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 16px;
}

.summary-grid {
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.summary-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.summary-val {
  font-family: monospace;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
}

/* Stamp Palette Bar */
.stamp-palette-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.stamp-palette-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.palette-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stamp-buttons-container {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stamp-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  user-select: none;
}

.stamp-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.2);
}

.stamp-btn.active {
  box-shadow: 0 0 14px currentColor, inset 0 0 8px currentColor;
  border-color: currentColor;
  transform: scale(1.04);
}

.stamp-btn-clear {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.3);
  color: var(--accent-rose);
}

/* Main Layout (Calendar + Detail Panel) */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  align-items: start;
}

/* Calendar Card */
.calendar-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  overflow: hidden;
}

.calendar-header-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.calendar-header-grid .sun { color: var(--accent-rose); }
.calendar-header-grid .sat { color: var(--accent-blue); }

.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 8px;
}

/* Calendar Cell */
.cal-cell {
  min-height: 95px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}

.cal-cell:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.cal-cell.other-month {
  opacity: 0.3;
}

.cal-cell.today {
  border-color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.05);
}

.cal-cell.selected {
  outline: 2px solid var(--accent-purple);
  background: rgba(168, 85, 247, 0.1);
}

.cell-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cell-day-num {
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.cal-cell.sun .cell-day-num { color: var(--accent-rose); }
.cal-cell.sat .cell-day-num { color: var(--accent-blue); }

/* Cell Shift Badge */
.cell-shift-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Cell Events Badges */
.cell-events-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cell-event-chip {
  font-size: 0.68rem;
  background: rgba(236, 72, 153, 0.2);
  border-left: 2px solid #ec4899;
  color: #fbcfe8;
  padding: 1px 4px;
  border-radius: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Cell Free Time Indicator */
.cell-free-indicator {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent-emerald);
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Right Detail Panel */
.day-detail-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 16px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.detail-date {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}

.detail-shift-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
}

.btn-add-event {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.25), rgba(168, 85, 247, 0.25));
  border-color: rgba(236, 72, 153, 0.4);
  color: #fbcfe8;
}

/* 24h Timeline Navigator */
.timeline-navigator-container {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
}

.timeline-nav-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.timeline-24h-track {
  position: relative;
  height: 32px;
  background: rgba(30, 41, 59, 0.5);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.timeline-24h-block {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.timeline-24h-ruler {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  font-family: monospace;
  color: var(--text-dim);
  margin-top: 4px;
  padding: 0 2px;
}

/* Free Time Summary Box */
.free-time-summary-box {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.8rem;
  color: #a7f3d0;
  line-height: 1.4;
}

.free-time-highlight {
  font-weight: 800;
  color: #fff;
}

/* Events Section */
.day-events-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.events-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.events-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.event-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-left: 3px solid #ec4899;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}

.event-card:hover {
  background: rgba(255, 255, 255, 0.06);
}

.event-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.event-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
}

.event-time {
  font-size: 0.72rem;
  font-family: monospace;
  color: var(--text-muted);
}

.event-actions {
  display: flex;
  gap: 4px;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.btn-icon:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.modal-header {
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 18px;
  max-height: 80vh;
  overflow-y: auto;
}

/* Forms */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input, .form-textarea {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 8px 12px;
  font-size: 0.88rem;
  transition: all 0.2s;
}

.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.form-row {
  display: flex;
  gap: 10px;
}

.flex-1 { flex: 1; }

.quick-preset-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.preset-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.preset-chip:hover {
  background: rgba(236, 72, 153, 0.2);
  border-color: #ec4899;
  color: #fff;
}

.conflict-alert {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--accent-amber);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.78rem;
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  border: none;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  filter: brightness(1.15);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Sync Instructions */
.sync-banner {
  background: linear-gradient(135deg, rgba(66, 133, 244, 0.15), rgba(52, 168, 83, 0.15));
  border: 1px solid rgba(66, 133, 244, 0.3);
  padding: 12px;
  border-radius: var(--radius-md);
}

.sync-instructions {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 12px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Responsive */
@media (max-width: 960px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
  .day-detail-card {
    position: static;
  }
  .cal-cell {
    min-height: 75px;
  }
}

@media (max-width: 600px) {
  body {
    padding: 8px;
  }
  .app-header {
    padding: 10px 14px;
  }
  .cal-cell {
    min-height: 60px;
    padding: 4px;
  }
  .cell-day-num {
    font-size: 0.75rem;
  }
  .cell-shift-badge {
    font-size: 0.65rem;
    padding: 1px 3px;
  }
  .stamp-btn {
    padding: 6px 10px;
    font-size: 0.78rem;
  }
}

.btn-account {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(56, 189, 248, 0.2));
  border-color: rgba(168, 85, 247, 0.4);
  color: #d8b4fe;
}

.btn-account:hover {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.35), rgba(56, 189, 248, 0.35));
  color: #fff;
}

