/* Admin Dashboard Styles */

/* Layout */
.admin-layout {
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  background: #1f2937;
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  width: 260px;
  height: 100vh;
  overflow: hidden; /* サイドバー全体はスクロールしない */
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.3);
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-header .logo {
  font-size: 1.25rem;
}

.sidebar-header .badge {
  font-size: 0.625rem;
  padding: 0.25rem 0.5rem;
  background: var(--color-primary);
  border-radius: 9999px;
  text-transform: uppercase;
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 80px); /* ヘッダーの高さを引いた残り */
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.sidebar-nav-main {
  flex: 1;
}

.sidebar-nav-bottom {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 0 1rem 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.25rem;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.2s;
  font-size: 0.875rem;
}

.nav-item:hover {
  color: white;
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: white;
  background: rgba(255, 255, 255, 0.1);
  border-left: 3px solid var(--color-primary);
}

/* 工事中メニュー用バッジ */
.nav-item.nav-item-wip {
  opacity: 0.6;
}

.nav-item .nav-label-text {
  flex: 1;
}

.nav-item .nav-badge {
  font-size: 0.6rem;
  padding: 0.15rem 0.4rem;
  background: #f59e0b;
  color: #000;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.sidebar-footer {
  padding: 1rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Main Content */
.admin-main {
  margin-left: 260px;
  padding: 2rem;
  background: #f3f4f6;
  min-height: 100vh;
  width: calc(100% - 260px);
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.admin-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

.header-buttons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-buttons .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* User Menu */
.user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.user-menu:hover {
  box-shadow: var(--shadow-md);
}

.user-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  position: relative;
}

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

.stat-icon-blue { background: #dbeafe; color: #2563eb; }
.stat-icon-green { background: #d1fae5; color: #059669; }
.stat-icon-red { background: #fee2e2; color: #dc2626; }
.stat-icon-yellow { background: #fef3c7; color: #d97706; }

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--color-text-light);
}

.stat-change {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.stat-change.positive {
  background: #d1fae5;
  color: #059669;
}

.stat-change.negative {
  background: #fee2e2;
  color: #dc2626;
}

/* Charts */
.charts-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.chart-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.chart-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.chart-period {
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  background: white;
}

.chart-container {
  height: 250px;
  position: relative;
}

/* Simple Bar Chart (CSS only) */
.simple-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 200px;
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
}

.chart-bar {
  flex: 1;
  margin: 0 2px;
  background: var(--color-primary);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.3s ease;
}

.chart-bar:hover {
  background: var(--color-primary-dark);
}

/* Content Row */
.content-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.content-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.view-all {
  font-size: 0.8rem;
  color: var(--color-primary);
}

/* Image List */
.image-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.image-list-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  transition: background 0.2s;
}

.image-list-item:hover {
  background: var(--color-bg-alt);
}

.image-list-thumb {
  width: 60px;
  height: 45px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.image-list-info {
  flex: 1;
}

.image-list-title {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.125rem;
}

.image-list-stats {
  font-size: 0.75rem;
  color: var(--color-text-light);
}

/* Activity List */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.activity-item {
  display: flex;
  gap: 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.activity-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-icon.download { background: #dbeafe; color: #2563eb; }
.activity-icon.like { background: #fee2e2; color: #dc2626; }
.activity-icon.follow { background: #d1fae5; color: #059669; }

.activity-content {
  flex: 1;
}

.activity-text {
  font-size: 0.875rem;
  margin-bottom: 0.125rem;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--color-text-light);
}

/* Responsive */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .admin-sidebar {
    position: fixed;
    left: -260px;
    z-index: 100;
    transition: left 0.3s;
  }

  .admin-sidebar.open {
    left: 0;
  }

  .admin-main {
    margin-left: 0;
    width: 100%;
  }

  .charts-row,
  .content-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .admin-main {
    padding: 1rem;
  }
}
