/* ============================================================
   AWGroup 管理画面 スタイルシート
   ブランドカラー:
     - ダークネイビー: #1a2a3a
     - アクセント:    #6fb7e2
   ============================================================ */

/* ---- リセット & ベース ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  height: 100%;
}

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Meiryo', sans-serif;
  background: #f0f4f8;
  color: #1a2a3a;
  min-height: 100vh;
  line-height: 1.6;
}

a {
  color: #6fb7e2;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ---- レイアウト ---- */
#app {
  min-height: 100vh;
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* ---- サイドバー ---- */
.sidebar {
  width: 240px;
  background: #1a2a3a;
  color: #e8f4fc;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(111, 183, 226, 0.2);
}

.sidebar-logo h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #6fb7e2;
  letter-spacing: 0.05em;
}

.sidebar-logo p {
  font-size: 0.75rem;
  color: #8bafc4;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: #c5dce9;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
  background: rgba(111, 183, 226, 0.12);
  color: #6fb7e2;
  text-decoration: none;
}

.sidebar-nav li a .nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  opacity: 0.8;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(111, 183, 226, 0.2);
}

.sidebar-footer .user-info {
  font-size: 0.8rem;
  color: #8bafc4;
  margin-bottom: 8px;
}

.sidebar-footer .user-info strong {
  display: block;
  color: #c5dce9;
  font-size: 0.85rem;
}

.sidebar-footer .btn-logout {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(111, 183, 226, 0.3);
  color: #8bafc4;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: all 0.15s;
}

.sidebar-footer .btn-logout:hover {
  border-color: #6fb7e2;
  color: #6fb7e2;
}

/* ---- メインコンテンツ ---- */
.main-content {
  margin-left: 240px;
  flex: 1;
  padding: 32px;
  min-height: 100vh;
}

/* ---- ページヘッダー ---- */
.page-header {
  margin-bottom: 28px;
}

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a2a3a;
  margin-bottom: 4px;
}

.page-header p {
  font-size: 0.875rem;
  color: #5a7080;
}

/* ---- カード ---- */
.card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(26,42,58,0.07), 0 2px 10px rgba(26,42,58,0.04);
  padding: 24px;
  margin-bottom: 24px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1a2a3a;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e8f0f5;
}

/* ---- ダッシュボードカード ---- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.dashboard-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(26,42,58,0.07);
  border-left: 4px solid #6fb7e2;
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
}

.dashboard-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(26,42,58,0.10);
}

.dashboard-card h3 {
  font-size: 0.85rem;
  color: #5a7080;
  margin-bottom: 6px;
  font-weight: 500;
}

.dashboard-card .card-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1a2a3a;
}

.dashboard-card .card-link {
  font-size: 0.8rem;
  color: #6fb7e2;
  margin-top: 8px;
  display: block;
}

/* ---- テーブル ---- */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  background: #f0f4f8;
  color: #4a6070;
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid #dde8f0;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid #eef3f7;
  transition: background 0.1s;
}

tbody tr:hover {
  background: #f7fafc;
}

tbody td {
  padding: 11px 14px;
  color: #2a3a4a;
  vertical-align: middle;
}

/* ---- バッジ ---- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-hq {
  background: #e8f0fc;
  color: #3a6abf;
}

.badge-store {
  background: #e8f7ee;
  color: #2a7a4a;
}

.badge-active {
  background: #e8f7ee;
  color: #2a7a4a;
}

.badge-inactive {
  background: #f7e8e8;
  color: #8a2a2a;
}

/* ---- ボタン ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: #6fb7e2;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #5aa0cb;
}

.btn-secondary {
  background: #e8f0f5;
  color: #3a5a70;
}

.btn-secondary:hover:not(:disabled) {
  background: #d8e8f0;
}

.btn-danger {
  background: #e25a5a;
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #c44a4a;
}

.btn-warning {
  background: #e2a25a;
  color: #fff;
}

.btn-warning:hover:not(:disabled) {
  background: #c88840;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.btn-ghost {
  background: transparent;
  color: #6fb7e2;
  border: 1px solid #6fb7e2;
}

.btn-ghost:hover:not(:disabled) {
  background: #e8f4fc;
}

/* ---- フォーム ---- */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #2a3a4a;
  margin-bottom: 6px;
}

.form-label .required {
  color: #e25a5a;
  margin-left: 4px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #c8d8e0;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #1a2a3a;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-control:focus {
  border-color: #6fb7e2;
  box-shadow: 0 0 0 3px rgba(111, 183, 226, 0.15);
}

.form-control.is-invalid {
  border-color: #e25a5a;
}

select.form-control {
  cursor: pointer;
}

.form-hint {
  font-size: 0.78rem;
  color: #7a9aaa;
  margin-top: 4px;
}

.form-error {
  font-size: 0.8rem;
  color: #e25a5a;
  margin-top: 4px;
}

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

/* チェックボックス */
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #6fb7e2;
  cursor: pointer;
}

/* ---- アラート ---- */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.alert-error {
  background: #fef0f0;
  color: #8a2a2a;
  border: 1px solid #f8d0d0;
}

.alert-success {
  background: #f0fef4;
  color: #1a5a30;
  border: 1px solid #c0e8d0;
}

.alert-info {
  background: #f0f8fe;
  color: #1a4a6a;
  border: 1px solid #c0dff0;
}

/* ---- モーダル ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 30, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}

.modal {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(10, 20, 30, 0.25);
  animation: slideUp 0.2s ease;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a2a3a;
  margin-bottom: 16px;
}

.modal-body {
  font-size: 0.875rem;
  color: #3a5a70;
  margin-bottom: 20px;
}

.modal-password {
  background: #1a2a3a;
  color: #6fb7e2;
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  padding: 14px 18px;
  border-radius: 8px;
  margin: 12px 0 16px;
  word-break: break-all;
}

.modal-countdown {
  font-size: 0.78rem;
  color: #9ab0be;
  text-align: center;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

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

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ---- ローディングスピナー ---- */
.spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(240, 244, 248, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #dde8f0;
  border-top-color: #6fb7e2;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.inline-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  display: inline-block;
}

/* ---- ログイン画面 ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a2a3a 0%, #243a50 50%, #1a2a3a 100%);
}

.login-card {
  background: #fff;
  border-radius: 14px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1a2a3a;
  letter-spacing: 0.05em;
}

.login-logo p {
  font-size: 0.8rem;
  color: #7a9aaa;
  margin-top: 4px;
}

.login-card .btn-primary {
  width: 100%;
  justify-content: center;
  padding: 11px;
  font-size: 0.95rem;
  margin-top: 4px;
}

/* ---- サイト一覧・サイトカード ---- */
.site-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(26,42,58,0.07);
  border-top: 3px solid #6fb7e2;
  transition: transform 0.15s, box-shadow 0.15s;
}

.site-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(26,42,58,0.10);
}

.site-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a2a3a;
  margin-bottom: 6px;
}

.site-card p {
  font-size: 0.8rem;
  color: #6a8a9a;
  margin-bottom: 12px;
}

.sites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

/* ---- パスワード表示セル ---- */
.password-cell {
  font-family: monospace;
  font-size: 1rem;
  color: #2a7a4a;
  background: #f0fef4;
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-block;
}

/* ---- 空状態 ---- */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: #7a9aaa;
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 0.9rem;
}

/* ---- セパレーター ---- */
hr.divider {
  border: none;
  border-top: 1px solid #e8f0f5;
  margin: 20px 0;
}

/* ---- ページネーション ---- */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 16px;
}

.pagination button {
  padding: 6px 12px;
  border: 1px solid #c8d8e0;
  background: #fff;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  color: #3a5a70;
  transition: all 0.12s;
}

.pagination button:hover:not(:disabled) {
  background: #e8f4fc;
  border-color: #6fb7e2;
}

.pagination button.active {
  background: #6fb7e2;
  border-color: #6fb7e2;
  color: #fff;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---- レスポンシブ ---- */
@media (max-width: 768px) {
  .sidebar {
    width: 200px;
  }

  .main-content {
    margin-left: 200px;
    padding: 20px;
  }
}

@media (max-width: 580px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

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

  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  .menu-toggle {
    display: block !important;
  }

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

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

/* ハンバーガーメニューボタン（モバイル） */
.menu-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: #1a2a3a;
  color: #6fb7e2;
  border: none;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 1.2rem;
  cursor: pointer;
}
