/* ========================================
  共通スタイル - king of ATTENDA
  ======================================== */

:root {
  --primary-color: #3498db;
  --primary-hover: #2980b9;
  --danger-color: #e74c3c;
  --danger-hover: #c0392b;
  --success-color: #27ae60;
  --warning-color: #f39c12;
  --text-color: #333;
  --text-light: #666;
  --border-color: #ddd;
  --bg-color: #f5f5f5;
  --white: #fff;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --sidebar-width: 220px;
  --sidebar-bg: #2c3e50;
}

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

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
}

a {
  color: var(--primary-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ========================================
  レイアウト
  ======================================== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ========================================
  ログイン画面
  ======================================== */

.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
  background: var(--white);
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 400px;
}

.login-box h1 {
  text-align: center;
  margin-bottom: 30px;
  color: var(--text-color);
  font-size: 24px;
}

/* ========================================
  サイドバーレイアウト
  ======================================== */

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--white);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h1 {
  font-size: 16px;
  color: var(--white);
  margin: 0;
  line-height: 1.3;
}

.sidebar-header .app-name {
  font-size: 20px;
  font-weight: bold;
  color: #3498db;
}

.sidebar-nav {
  padding: 20px 0;
}

.sidebar-nav a {
  display: block;
  padding: 12px 20px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: all 0.2s;
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  text-decoration: none;
}

.sidebar-nav a.active {
  background: rgba(52, 152, 219, 0.3);
  color: var(--white);
  border-left: 3px solid var(--primary-color);
}

.sidebar-nav .logout-btn {
  color: rgba(231, 76, 60, 0.8);
  margin-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 20px;
}

.sidebar-nav .logout-btn:hover {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.1);
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  background: var(--bg-color);
}

/* ========================================
  コンテンツエリア
  ======================================== */

.content {
  padding: 20px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.page-title {
  font-size: 20px;
  color: var(--text-color);
}

/* ========================================
  カード
  ======================================== */

.card {
  background: var(--white);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

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

.card-title {
  font-size: 16px;
  font-weight: bold;
}

/* ========================================
  フォーム
  ======================================== */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: var(--text-color);
}

.form-group label .required {
  color: var(--danger-color);
  margin-left: 4px;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-control::placeholder {
  color: #aaa;
}

select.form-control {
  cursor: pointer;
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* フォームグリッド（3列） */
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.form-grid .form-group {
  margin-bottom: 0;
}

.form-grid .form-group.full-width {
  grid-column: 1 / -1;
}

/* ========================================
  ボタン
  ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: bold;
  text-align: center;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
  line-height: 1;
  vertical-align: middle;
  box-sizing: border-box;
  height: 38px;
}

.btn-primary {
  background-color: var(--primary-color);
  color: var(--white);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  text-decoration: none;
}

.btn-danger {
  background-color: var(--danger-color);
  color: var(--white);
}

.btn-danger:hover {
  background-color: var(--danger-hover);
}

.btn-secondary {
  background-color: #6c757d;
  color: var(--white);
}

.btn-secondary:hover {
  background-color: #5a6268;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  line-height: 1;
  height: 28px;
}

.btn-block {
  display: block;
  width: 100%;
}

/* ========================================
  テーブル
  ======================================== */

.table-wrapper {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
}

.table th,
.table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.table th {
  background: #f8f9fa;
  font-weight: bold;
  color: var(--text-color);
  white-space: nowrap;
}

.table tbody tr:hover {
  background-color: #f8f9fa;
}

.table .actions {
  white-space: nowrap;
}

.table .actions a,
.table .actions button {
  margin-right: 8px;
}

.table .actions a:last-child,
.table .actions button:last-child {
  margin-right: 0;
}

/* ========================================
  検索・フィルター
  ======================================== */

.search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-box .form-control {
  flex: 1;
  min-width: 200px;
}

.search-box select.form-control {
  flex: 0 0 200px;
}

.search-box .btn {
  flex-shrink: 0;
}

/* ========================================
  ページネーション
  ======================================== */

.pagination {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 20px;
}

.pagination a,
.pagination span {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-color);
  text-decoration: none;
}

.pagination a:hover {
  background-color: var(--bg-color);
  text-decoration: none;
}

.pagination .active {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--white);
}

.pagination .disabled {
  color: #aaa;
  cursor: not-allowed;
}

/* ========================================
  モーダル
  ======================================== */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

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

.modal {
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h2 {
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-light);
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-color);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 20px;
  border-top: 1px solid var(--border-color);
}

/* ========================================
  ダッシュボード
  ======================================== */

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--white);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
  text-align: center;
}

.stat-card .stat-number {
  font-size: 36px;
  font-weight: bold;
  color: var(--primary-color);
}

.stat-card .stat-label {
  color: var(--text-light);
  margin-top: 5px;
}

/* ========================================
  アラート・メッセージ
  ======================================== */

.alert {
  padding: 15px 20px;
  border-radius: 4px;
  margin-bottom: 20px;
}

.alert-success {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.alert-danger {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.alert-warning {
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  color: #856404;
}

/* ========================================
  ユーティリティ
  ======================================== */

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-10 {
  margin-top: 10px;
}

.mt-20 {
  margin-top: 20px;
}

.mb-10 {
  margin-bottom: 10px;
}

.mb-20 {
  margin-bottom: 20px;
}

.deleted-row {
  background-color: #f8d7da !important;
  opacity: 0.7;
}

.badge {
  display: inline-block;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: bold;
  border-radius: 4px;
  line-height: 1;
  height: 28px;
  vertical-align: middle;
  box-sizing: border-box;
}

.badge-danger {
  background-color: var(--danger-color);
  color: var(--white);
}

.badge-success {
  background-color: var(--success-color);
  color: var(--white);
}
