/* ============================================
   音楽教室予約システム - スタイルシート
   ============================================ */

:root {
  --sidebar-width: 260px;
  --sidebar-bg: #1a1a2e;
  --sidebar-hover: #16213e;
  --primary: #4e73df;
  --primary-dark: #3a5bc7;
  --success: #1cc88a;
  --warning: #f6c23e;
  --danger: #e74a3b;
  --info: #36b9cc;
  --light-bg: #f4f6f9;
  --card-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

body {
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  background: var(--light-bg);
  margin: 0;
  min-height: 100vh;
}

/* ---- Login Page ---- */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-card h2 {
  text-align: center;
  margin-bottom: 8px;
  color: #1a1a2e;
  font-weight: 700;
}
.login-card .subtitle {
  text-align: center;
  color: #6c757d;
  margin-bottom: 32px;
  font-size: 0.95rem;
}
.login-card .form-label { font-weight: 600; font-size: 0.9rem; }
.login-card .btn-primary {
  width: 100%;
  padding: 12px;
  font-weight: 600;
  font-size: 1rem;
}

/* ---- Landing Page ---- */
.landing-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.landing-wrapper h1 { font-weight: 800; margin-bottom: 12px; font-size: 2.4rem; }
.landing-wrapper .lead { opacity: 0.8; margin-bottom: 48px; }
.role-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 40px 32px;
  text-align: center;
  text-decoration: none;
  color: #fff;
  transition: all 0.3s;
  display: block;
}
.role-card:hover {
  background: rgba(255,255,255,0.15);
  transform: translateY(-4px);
  color: #fff;
}
.role-card .icon {
  font-size: 3rem;
  margin-bottom: 16px;
  display: block;
}
.role-card h3 { font-weight: 700; margin-bottom: 8px; }
.role-card p { opacity: 0.7; font-size: 0.9rem; margin: 0; }

/* ---- Sidebar ---- */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  color: #fff;
  z-index: 1000;
  overflow-y: auto;
  transition: transform 0.3s;
}
#sidebar .brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
#sidebar .brand i { font-size: 1.4rem; color: var(--primary); }
#sidebar .nav-section {
  padding: 16px 0 8px 20px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.4;
  font-weight: 600;
}
#sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.92rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
#sidebar .nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}
#sidebar .nav-link.active {
  background: var(--sidebar-hover);
  color: #fff;
  border-left-color: var(--primary);
}
#sidebar .nav-link i { width: 20px; text-align: center; font-size: 0.95rem; }

#sidebar .user-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
}
#sidebar .user-info .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

/* ---- Main Content ---- */
#content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

/* ---- Top Navbar ---- */
.top-navbar {
  background: #fff;
  padding: 16px 24px;
  border-bottom: 1px solid #e3e6f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.top-navbar h4 {
  margin: 0;
  font-weight: 700;
  font-size: 1.15rem;
  color: #333;
}
.top-navbar .breadcrumb {
  margin: 0;
  font-size: 0.85rem;
}

.page-content { padding: 24px; }

/* ---- Dashboard Cards ---- */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--card-shadow);
  border-left: 4px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stat-card.border-success { border-left-color: var(--success); }
.stat-card.border-warning { border-left-color: var(--warning); }
.stat-card.border-danger { border-left-color: var(--danger); }
.stat-card.border-info { border-left-color: var(--info); }
.stat-card .stat-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  font-weight: 600;
  margin-bottom: 4px;
}
.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: #333;
}
.stat-card .stat-icon {
  font-size: 2rem;
  opacity: 0.2;
}

/* ---- Card ---- */
.card-custom {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  border: none;
  overflow: hidden;
}
.card-custom .card-header {
  background: #fff;
  border-bottom: 1px solid #e3e6f0;
  padding: 16px 24px;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-custom .card-body { padding: 24px; }

/* ---- Tables ---- */
.table-custom {
  width: 100%;
  border-collapse: collapse;
}
.table-custom thead th {
  background: #f8f9fc;
  padding: 12px 16px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  font-weight: 700;
  border-bottom: 2px solid #e3e6f0;
  white-space: nowrap;
}
.table-custom tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.92rem;
  vertical-align: middle;
}
.table-custom tbody tr:hover { background: #f8f9fc; }

/* ---- Badge ---- */
.badge-status {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-pending { background: #fff3cd; color: #856404; }
.badge-confirmed { background: #d4edda; color: #155724; }
.badge-cancelled { background: #f8d7da; color: #721c24; }
.badge-completed { background: #d1ecf1; color: #0c5460; }

/* ---- Calendar ---- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.calendar-header {
  text-align: center;
  padding: 10px;
  font-weight: 700;
  font-size: 0.82rem;
  color: #666;
}
.calendar-header.sun { color: var(--danger); }
.calendar-header.sat { color: var(--primary); }
.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.92rem;
  transition: all 0.2s;
  border: 2px solid transparent;
  position: relative;
  min-height: 60px;
}
.calendar-day:hover { background: #e8ecff; }
.calendar-day.today {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}
.calendar-day.has-slots::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  position: absolute;
  bottom: 8px;
}
.calendar-day.other-month { opacity: 0.3; }
.calendar-day.selected {
  border-color: var(--primary);
  background: #e8ecff;
}
.calendar-day.sunday { color: var(--danger); }
.calendar-day.saturday { color: var(--primary); }

/* Calendar Navigation */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.calendar-nav h5 { margin: 0; font-weight: 700; }
.calendar-nav .btn { padding: 6px 14px; }

/* ---- Availability Grid ---- */
.availability-grid {
  display: grid;
  grid-template-columns: 80px repeat(7, 1fr);
  gap: 2px;
}
.availability-grid .time-label {
  padding: 8px;
  font-size: 0.82rem;
  color: #666;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.availability-grid .day-header {
  text-align: center;
  padding: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  background: #f8f9fc;
  border-radius: 6px;
}
.availability-slot {
  padding: 8px;
  text-align: center;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
  border: 1px solid #e3e6f0;
  background: #fff;
}
.availability-slot:hover { background: #e8ecff; }
.availability-slot.available {
  background: #d4edda;
  border-color: #b8dacc;
  color: #155724;
}
.availability-slot.booked {
  background: #e8ecff;
  border-color: #b8c4f0;
  color: var(--primary-dark);
  cursor: default;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.2;
}
.availability-slot.booked:hover {
  background: #dce3ff;
}
.availability-slot.provisional {
  background: #fce4ec;
  border-color: #f48fb1;
  color: #c62828;
  cursor: default;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.2;
}
.availability-slot.provisional:hover {
  background: #f8bbd0;
}
.availability-slot.past-booked {
  background: #f0f0f0;
  border-color: #e0e0e0;
  color: #999;
  cursor: default;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.2;
}
.availability-slot.past-booked:hover {
  background: #f0f0f0;
}
.availability-slot.past-empty {
  background: #fafafa;
  border-color: #eee;
  color: #ccc;
  cursor: default;
}
.availability-slot.past-empty:hover {
  background: #fafafa;
}

/* ---- Time Slots (for booking) ---- */
.time-slot-list { display: flex; flex-wrap: wrap; gap: 8px; }
.time-slot-btn {
  padding: 10px 20px;
  border: 2px solid #e3e6f0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  font-weight: 500;
}
.time-slot-btn:hover { border-color: var(--primary); color: var(--primary); }
.time-slot-btn.selected {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.time-slot-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* ---- Past Lessons Monthly Grid ---- */
.monthly-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.monthly-grid .day-cell {
  background: #fff;
  border: 1px solid #e3e6f0;
  border-radius: 6px;
  padding: 8px;
  min-height: 80px;
  font-size: 0.82rem;
}
.monthly-grid .day-cell .date-num {
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 0.85rem;
}
.monthly-grid .day-cell .lesson-info {
  background: #e8ecff;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.75rem;
  color: var(--primary-dark);
  margin-top: 2px;
}
.monthly-grid .day-cell.no-lesson { opacity: 0.5; }
.monthly-grid .day-cell.has-lesson { border-color: var(--primary); }

/* ---- Buttons ---- */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}
.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
}

/* ---- Modal ---- */
.modal-custom .modal-header {
  border-bottom: 2px solid var(--primary);
}
.modal-custom .modal-title { font-weight: 700; }

/* ---- Mobile Availability View ---- */
#mobile-availability, #mobile-booking, #mobile-default-schedule { display: none; }

/* ---- Booking Grid Selection ---- */
.availability-slot.selected-booking {
  background: var(--primary) !important;
  border-color: var(--primary-dark) !important;
  color: #fff !important;
  font-weight: 700;
}
.availability-slot.selected-booking:hover {
  background: var(--primary-dark) !important;
}

.mobile-week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 16px;
}
.mobile-day-btn {
  text-align: center;
  padding: 10px 2px;
  border-radius: 10px;
  background: #f8f9fc;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.2s;
  line-height: 1.4;
}
.mobile-day-btn small { font-weight: 500; color: #888; }
.mobile-day-btn.sat { color: var(--primary); }
.mobile-day-btn.sun { color: var(--danger); }
.mobile-day-btn.sat small,
.mobile-day-btn.sun small { color: inherit; }
.mobile-day-btn.active {
  background: var(--primary);
  color: #fff !important;
  border-color: var(--primary);
}
.mobile-day-btn.active small { color: rgba(255,255,255,0.8) !important; }

.mobile-slot-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.mobile-slot-row .mobile-time-label {
  width: 48px;
  font-size: 0.82rem;
  color: #666;
  text-align: right;
  flex-shrink: 0;
  font-weight: 500;
}
.mobile-slot-row .availability-slot {
  flex: 1;
  padding: 11px 10px;
  font-size: 0.88rem;
}

/* ---- Mobile Menu Modal ---- */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  transition: opacity 0.25s;
}
.mobile-menu-overlay.show {
  display: flex;
  justify-content: flex-end;
  opacity: 1;
}
.mobile-menu-panel {
  width: 280px;
  max-width: 80vw;
  height: 100%;
  background: #fff;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
}
.mobile-menu-overlay.show .mobile-menu-panel {
  transform: translateX(0);
}
.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #e3e6f0;
}
.mobile-menu-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #888;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}
.mobile-menu-close:hover { background: #f0f0f0; color: #333; }
.mobile-menu-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.mobile-menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  color: #333;
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.2s;
}
.mobile-menu-link i { width: 20px; text-align: center; color: #999; font-size: 0.9rem; }
.mobile-menu-link:hover { background: #f8f9fc; }
.mobile-menu-link.active { background: #f0f3ff; color: var(--primary); font-weight: 600; }
.mobile-menu-link.active i { color: var(--primary); }
.mobile-menu-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid #e3e6f0;
  font-size: 0.85rem;
  font-weight: 600;
}
.mobile-menu-footer .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700;
}
.mobile-menu-footer a { color: #888; text-decoration: none; font-weight: 500; font-size: 0.82rem; }

/* ---- Confirmed New Button (responsive) ---- */
.confirmed-new-btn { white-space: nowrap; }
@media (max-width: 768px) {
  .card-custom .card-header:has(.confirmed-new-btn) {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    text-align: center;
  }
  .confirmed-new-btn { width: 100%; }
}

/* ---- Mobile Card List ---- */
.mobile-card-list { display: flex; flex-direction: column; gap: 10px; }
.mobile-card {
  border: 1px solid #e3e6f0;
  border-radius: 10px;
  padding: 14px 16px;
  background: #fff;
}
.mobile-card.rejected { opacity: 0.55; }
.mobile-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.mobile-card-head strong { font-size: 0.88rem; }
.mobile-card-date { font-size: 0.88rem; color: #999; }
.mobile-card-body {
  display: flex;
  gap: 14px;
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 10px;
}
.mobile-card-body i { color: #aaa; font-size: 0.78rem; }
.mobile-card-actions {
  display: flex;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
}

/* ---- Search Filter Toggle (mobile) ---- */
.search-toggle-btn {
  display: none;
  width: 100%;
  background: none;
  border: none;
  padding: 12px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  text-align: left;
}
.search-toggle-btn i.fa-chevron-down {
  transition: transform 0.25s;
  float: right;
  line-height: 1.4;
}
.search-toggle-btn.open i.fa-chevron-down {
  transform: rotate(180deg);
}
.search-filter-body {
  transition: max-height 0.3s ease, padding 0.3s ease;
  overflow: hidden;
}

/* ---- No-Sidebar Layout (Student) ---- */
body.no-sidebar #sidebar { display: none; }
body.no-sidebar #content { margin-left: 0; }
body.no-sidebar .mobile-brand-bar {
  display: flex !important;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
}
body.no-sidebar .top-navbar { display: none !important; }
body.no-sidebar .mobile-brand-bar .sidebar-toggle { display: block !important; }
body.no-sidebar .page-content { max-width: 960px; margin-left: auto; margin-right: auto; }

/* ---- Mobile Brand Bar ---- */
.mobile-brand-bar {
  display: none;
  background: var(--sidebar-bg);
  color: #fff;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 0.95rem;
  align-items: center;
  gap: 8px;
}
.mobile-brand-bar i { color: var(--primary); font-size: 1.1rem; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .mobile-brand-bar { display: flex; position: sticky; top: 0; z-index: 1000; justify-content: space-between; }
  .top-navbar { position: sticky; top: 49px; z-index: 999; padding-top: 8px; padding-bottom: 8px; }
  #sidebar { transform: translateX(-100%); }
  #content { margin-left: 0; }
  .sidebar-toggle { display: block !important; order: 2; margin-left: auto !important; margin-right: 0 !important; }
  .top-navbar > div:first-child { display: flex; align-items: center; width: 100%; }
  .calendar-day { min-height: 40px; font-size: 0.8rem; }
  .stat-card { padding: 16px; }
  .stat-card .stat-value { font-size: 1.2rem; }
  .table-custom thead th { padding: 8px 6px; font-size: 0.75rem; }
  .table-custom tbody td { padding: 8px 6px; font-size: 0.82rem; white-space: nowrap; }
  .search-toggle-btn { display: block; }
  .search-filter-body.collapsed { max-height: 0 !important; padding-top: 0 !important; padding-bottom: 0 !important; }
  .availability-grid { display: none !important; }
  #mobile-availability, #mobile-booking, #mobile-default-schedule { display: block; }
  .card-custom .card-header {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  .card-custom .card-header > div {
    justify-content: center;
  }
}

/* ---- Utility ---- */
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sidebar-toggle { display: none; }
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
