/* assets/css/style.css */

/* =====================
   CSS Variables
   ===================== */
:root {
  --color-primary: #4F6BED;
  --color-primary-dk: #3A52C7;
  --color-primary-lt: #EEF1FD;
  --color-accent: #F97316;
  --color-success: #22C55E;
  --color-danger: #EF4444;
  --color-line: #06C755;

  --color-bg: #F4F6FB;
  --color-sidebar-bg: #1E2340;
  --color-sidebar-txt: #A9B0CC;
  --color-header-bg: #FFFFFF;
  --color-border: #E2E8F0;
  --color-text: #1E293B;
  --color-text-muted: #64748B;
  --color-white: #FFFFFF;

  --header-height: 56px;
  --sidebar-width: 220px;

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

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .10);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .14);

  --transition: 0.24s ease;
}

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

html {
  font-size: 14px;
}

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Meiryo', sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

/* =====================
   Header
   ===================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--color-sidebar-bg);
  /* メニューと同じ濃紺 */
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  height: 100%;
}

/* PC：ロゴ＋スクサポ（サイドバー幅に合わせる） */
.header-logo {
  width: var(--sidebar-width);
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  background: var(--color-sidebar-bg);
  flex-shrink: 0;
  border-right: none;
}

.header-logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dk));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  font-size: .88rem;
  flex-shrink: 0;
}

.header-brand {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-white);
  letter-spacing: .06em;
}

/* iPad以下のみ表示：ハンバーガー */
.menu-toggle {
  display: none;
  /* PCでは非表示 */
  width: 56px;
  height: var(--header-height);
  align-items: center;
  justify-content: center;
  color: var(--color-sidebar-txt);
  font-size: 1.15rem;
  background: var(--color-sidebar-bg);
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.menu-toggle:hover {
  background: #262d50;
  color: var(--color-white);
}

.menu-toggle i {
  transition: transform 0.2s ease, opacity 0.15s ease;
}

/* ヘッダー右 */
.header-right {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 16px;
}

.header-school-name {
  font-size: .82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, .75);
  /* 白文字 */
  padding: 0 4px 0 12px;
  white-space: nowrap;
}

.header-divider {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, .2);
  margin: 0 4px;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}

.user-info:hover {
  background: rgba(255, 255, 255, .1);
}

.user-name {
  font-size: .88rem;
  font-weight: 600;
  color: var(--color-white);
}

/* 白文字 */
.user-menu-btn {
  font-size: .72rem;
  color: rgba(255, 255, 255, .6);
  padding: 2px;
}

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 16px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 170px;
  z-index: 2000;
  overflow: hidden;
}

.user-dropdown.open {
  display: block;
}

.user-dropdown ul {
  padding: 6px 0;
}

.user-dropdown li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: .88rem;
  color: var(--color-text);
  transition: background var(--transition);
}

.user-dropdown li a:hover {
  background: var(--color-primary-lt);
}

.user-dropdown li a.logout {
  color: var(--color-danger);
}

.user-dropdown li.divider {
  height: 1px;
  background: var(--color-border);
  margin: 4px 0;
}

/* =====================
   Layout
   ===================== */
.layout-wrapper {
  display: flex;
  padding-top: var(--header-height);
  min-height: 100vh;
}

/* =====================
   Sidebar（PC：常時表示）
   ===================== */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 900;
}

.sidebar-inner {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
}

.sidebar-inner::-webkit-scrollbar {
  width: 3px;
}

.sidebar-inner::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .12);
  border-radius: 2px;
}

.menu-list {
  padding: 0 10px;
}

.menu-item {
  margin-bottom: 2px;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-sidebar-txt);
  font-size: 1.0rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

.menu-link:hover {
  background: rgba(255, 255, 255, .08);
  color: var(--color-white);
}

.menu-item.active .menu-link {
  background: var(--color-primary);
  color: var(--color-white);
}

.menu-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.menu-label {}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-version {
  font-size: .7rem;
  color: rgba(255, 255, 255, .22);
}

/* =====================
   Main Content
   ===================== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
}

.content-inner {
  padding: 26px 28px;
  max-width: 1200px;
  flex: 1;
}

/* =====================
   Page title
   ===================== */
.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-title i {
  color: var(--color-primary);
  font-size: 1.15rem;
}

.page-subtitle {
  font-size: .83rem;
  color: var(--color-text-muted);
  margin-bottom: 22px;
}

/* =====================
   Card
   ===================== */
.card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.card+.card {
  margin-top: 18px;
}

/* =====================
   Stats Grid
   ===================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.stat-icon.blue {
  background: #EEF1FD;
  color: var(--color-primary);
}

.stat-icon.green {
  background: #ECFDF5;
  color: var(--color-success);
}

.stat-icon.orange {
  background: #FFF7ED;
  color: var(--color-accent);
}

.stat-icon.red {
  background: #FEF2F2;
  color: var(--color-danger);
}

.stat-num {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1;
  color: var(--color-text);
}

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

/* Dashboard sections */
.stats-section {
  margin-bottom: 20px;
}
.stats-section-title {
  font-size: 1rem;
  color: var(--color-text);
  margin: 10px 0 8px 2px;
  font-weight: 600;
}

/* additional icon colors used by dashboard */
.stat-icon.gray {
  background: #F3F4F6;
  color: #6B7280;
}
.stat-icon.brown {
  background: #FFF8F1;
  color: #A16207;
}

/* =====================
   Placeholder
   ===================== */
.placeholder-box {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
  color: var(--color-text-muted);
}

.placeholder-box i {
  font-size: 2.4rem;
  margin-bottom: 12px;
  display: block;
  color: var(--color-border);
}

.placeholder-box p {
  font-size: .93rem;
}

/* =====================
   Login Page
   ===================== */
body.login-page {
  background: #EEF2F8;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-wrap {
  width: 100%;
  max-width: 460px;
  padding: 20px;
}

.login-card {
  background: var(--color-white);
  border-radius: 20px;
  padding: 44px 40px 38px;
  box-shadow: 0 6px 32px rgba(0, 0, 0, .10);
  text-align: center;
}

.login-logo-circle {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #1B3B7D, #2E5BA8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  font-size: 1.9rem;
  color: var(--color-white);
}

.login-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: .04em;
}

.login-section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .78rem;
  color: var(--color-text-muted);
  margin: 22px 0 14px;
}

.login-section-label::before,
.login-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.btn-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 20px;
  background: var(--color-line);
  color: var(--color-white);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: background var(--transition), box-shadow var(--transition);
  letter-spacing: .04em;
}

.btn-line:hover {
  background: #05a849;
  box-shadow: 0 4px 14px rgba(6, 199, 85, .35);
}

.btn-line i {
  font-size: 1.2rem;
}

.btn-register {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 20px;
  background: var(--color-primary);
  color: var(--color-white);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: background var(--transition), box-shadow var(--transition);
  letter-spacing: .04em;
}

.btn-register:hover {
  background: var(--color-primary-dk);
  box-shadow: 0 4px 14px rgba(79, 107, 237, .35);
}

.login-note {
  margin-top: 14px;
  font-size: .76rem;
  color: var(--color-text-muted);
  line-height: 1.7;
}

/* =====================
   Overlay（ドロワー用）
   ===================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: var(--header-height);
  /* ヘッダーの下から */
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 850;
  opacity: 0;
  transition: opacity var(--transition);
}

.sidebar-overlay.show {
  display: block;
}

.sidebar-overlay.visible {
  opacity: 1;
}

/* =====================
   iPad以下（768px）：ドロワー式
   ===================== */
@media (max-width: 768px) {

  /* ロゴ非表示、ハンバーガー表示 */
  .header-logo {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }

  /* サイドバー：ヘッダー直下からドロワー化（ヘッダーは常に見える） */
  .sidebar {
    top: var(--header-height);
    /* ヘッダーの下から始める */
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform var(--transition);
    z-index: 900;
    /* ヘッダー(1000)より下 */
  }

  body.drawer-open .sidebar {
    transform: translateX(0);
  }

  /* オーバーレイもヘッダーの下から */
  .sidebar-overlay {
    top: var(--header-height);
  }

  /* メインは左マージンなし */
  .main-content {
    margin-left: 0;
  }

  .content-inner {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.login-logo-wrap {
  margin-bottom: 30px;
}

.event-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #777772;
  text-align: left;
}

.event-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #f5f4f0;
  border-radius: 8px;
  border: 0.5px solid #b2b2b2;
}