/* SmartReins High-End SaaS Dark Theme */

:root {
  --bg-color: #080c14;
  --card-bg: rgba(15, 22, 42, 0.65);
  --card-border: 1px solid rgba(255, 255, 255, 0.06);
  --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-color: #3b82f6;
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --success-color: #10b981;
}

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

body {
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(at 0% 0%, rgba(30, 41, 59, 0.3) 0, transparent 50%),
    radial-gradient(at 100% 100%, rgba(15, 23, 42, 0.3) 0, transparent 50%);
  color: var(--text-primary);
  font-family: 'Inter', 'Outfit', sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-x: hidden;
  letter-spacing: -0.2px;
}

/* 共通ガラスモーフィズムコンテナ */
.sr-nm-outset {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 12px;
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}

/* 入力インナーボックス */
.sr-nm-inset {
  background: rgba(15, 23, 42, 0.8);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.sr-nm-inset:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ボタン */
.sr-nm-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-primary);
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sr-nm-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.sr-nm-btn:active {
  transform: translateY(1px);
}

.sr-nm-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

/* コンテナ */
.sr-admin-container {
  width: 100%;
  max-width: 1200px;
  min-height: 500px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* パネル切り替え */
.view-panel {
  display: none;
  width: 100%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.view-panel.active {
  display: block;
  opacity: 1;
}

/* ==========================================================================
   1. ログイン画面
   ========================================================================== */
.login-card {
  width: 100%;
  max-width: 400px;
  padding: 48px 36px;
  margin: 0 auto;
}

.login-header {
  margin-bottom: 32px;
}

.logo-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.2);
  margin-bottom: 20px;
  color: var(--accent-color);
}

.login-header h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-top: 6px;
}

.input-group {
  margin-bottom: 24px;
  text-align: left;
}

.input-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.input-group input {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.92rem;
  outline: none;
}

.input-group input::placeholder {
  color: #475569;
}

.btn-submit {
  width: 100%;
  padding: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 8px;
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.25);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-submit:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

.btn-submit:active {
  transform: translateY(1px);
}

.login-footer {
  margin-top: 24px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-color);
  font-size: 0.82rem;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-link:hover {
  color: #60a5fa;
}

/* ==========================================================================
   2. ダッシュボード画面
   ========================================================================== */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  margin-bottom: 24px;
}

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

.logo-wrapper.mini {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dashboard-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: #ffffff;
}

.company-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.plan-badge {
  font-family: 'Outfit', sans-serif;
  background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.btn-icon-label {
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 契約ステータスグリッド */
.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.status-card {
  padding: 28px;
}

.card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.card-title h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.count-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent-color);
}

.progress-container {
  height: 6px;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  margin-bottom: 18px;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.status-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.billing-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.btn-action {
  width: 100%;
  padding: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

/* 管理エリアグリッド */
.management-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
}

.manage-box {
  padding: 28px;
  position: relative;
}

.manage-box h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #ffffff;
}

.section-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* テーブルデザイン */
.list-box {
  min-height: 380px;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.license-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
}

.license-table th, .license-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.license-table th {
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.license-table td {
  color: var(--text-primary);
}

.license-table tr {
  transition: background-color 0.2s;
}

.license-table tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.license-table .key-cell {
  font-family: monospace;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-row-action {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-row-action:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.08);
}

.btn-row-action.delete:hover {
  color: #ef4444;
  background-color: rgba(239, 68, 68, 0.12);
}

/* ロックオーバーレイ（発行上限到達用） */
.lock-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 12, 20, 0.95);
  border-radius: 12px;
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
  color: var(--text-primary);
  z-index: 10;
}

.lock-overlay p {
  font-size: 0.82rem;
  line-height: 1.6;
  margin-top: 12px;
  color: var(--text-secondary);
}

/* ==========================================================================
   3. モーダル画面
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 6, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  padding: 32px;
  position: relative;
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 14px;
}

.modal-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
  transition: background 0.2s, color 0.2s;
}

.btn-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.modal-body p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

.status-msg {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 500;
  text-align: center;
}

.status-msg.success {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-msg.error {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* スマホレスポンシブ */
@media (max-width: 900px) {
  .status-grid {
    grid-template-columns: 1fr;
  }
  .management-grid, .area-management-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Modern Flat Toggle Switch */
.switch-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sr-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.sr-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: #94a3b8;
  border-radius: 50%;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

input:checked + .slider {
  background-color: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
}

input:checked + .slider:before {
  transform: translateX(20px);
  background-color: #34d399;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.4);
}

input:disabled + .slider {
  opacity: 0.3;
  cursor: not-allowed;
}

/* 有効学区一覧用スタイル */
.active-pref-group {
  margin-bottom: 12px;
}

.active-pref-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: #60a5fa;
  padding: 10px 14px;
  background: rgba(96, 165, 250, 0.08);
  border-radius: 8px;
  border-left: 3px solid #60a5fa;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.active-pref-list {
  padding-left: 0;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.active-city-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.4);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.82rem;
}

.active-city-name {
  font-weight: 600;
  color: #f1f5f9;
}

.active-city-status {
  font-size: 0.75rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-remove-area {
  background: none;
  border: none;
  color: #f87171;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-remove-area:hover {
  background: rgba(239, 68, 68, 0.12);
  transform: scale(1.05);
}
