/* === Admin Layout === */
.admin-wrap {
  display: flex;
  min-height: 100vh;
}
.admin-sidebar {
  width: 220px;
  background: var(--dark);
  color: var(--white);
  padding: 20px 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
}
.admin-sidebar h2 {
  padding: 0 20px 20px;
  font-size: 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  white-space: nowrap;
}
.admin-sidebar a {
  display: block;
  color: #ccc;
  text-decoration: none;
  padding: 12px 20px;
  font-size: 14px;
  transition: all .2s;
}
.admin-sidebar a:hover,
.admin-sidebar a.active {
  background: rgba(255,255,255,.1);
  color: var(--white);
}
.admin-main {
  flex: 1;
  margin-left: 220px;
  padding: 30px;
  background: var(--light);
  max-width: 100%;
  overflow-x: hidden;
}

/* === Admin Header === */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 10px;
}
.admin-header h1 { font-size: 22px; }

/* === Cards === */
.admin-card {
  background: var(--white);
  border-radius: 8px;
  padding: 25px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

/* === Stats Grid === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 25px;
}
.stat-card {
  background: var(--white);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-card .number { font-size: 36px; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 13px; color: var(--gray); margin-top: 5px; }

/* === Forms === */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  max-width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .2s;
  gap: 6px;
  white-space: nowrap;
}
.btn:hover { opacity: .9; }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-danger { background: #dc3545; color: var(--white); }
.btn-warning { background: #ffc107; color: #333; }
.btn-edit { background: #17a2b8; color: var(--white); }
.btn-sm { padding: 6px 14px; font-size: 12px; }

/* === Tables === */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: auto; }
table th, table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #eee; word-break: break-word; }
table th { background: #f8f8f8; font-weight: 600; white-space: nowrap; }
table tr:hover { background: #fafafa; }
table img { height: 50px; border-radius: 3px; }

/* Responsive column visibility classes */
.col-hide-mobile { /* visible by default */ }
.col-hide-tablet { /* visible by default */ }

/* === Alerts === */
.alert { padding: 12px 18px; border-radius: 6px; margin-bottom: 20px; font-size: 14px; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* === Login === */
.login-box {
  background: var(--white);
  padding: 40px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 380px;
}
.login-box h1 { text-align: center; margin-bottom: 25px; color: var(--primary); font-size: 22px; }

/* === Misc === */
.thumb-preview { max-width: 120px; margin-top: 8px; border-radius: 4px; border: 1px solid #ddd; }
.auto-thumb-info { font-size: 12px; color: #666; margin-top: 4px; }

/* Action buttons in table cells */
table td .btn { margin: 2px; }

/* ===========================
   RESPONSIVE - Large Tablet
   =========================== */
@media (max-width: 1200px) {
  .admin-main { padding: 20px; }
  .admin-card { padding: 20px; }
}

/* ===========================
   RESPONSIVE - Tablet
   =========================== */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  table th, table td { padding: 10px 10px; font-size: 13px; }
  .col-hide-tablet { display: none; }
}

/* ===========================
   RESPONSIVE - Mobile
   =========================== */
@media (max-width: 768px) {
  .admin-wrap { flex-direction: column; }

  /* Sidebar becomes compact horizontal scrollable top bar */
  .admin-sidebar {
    width: 100%;
    position: relative;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .admin-sidebar::-webkit-scrollbar {
    display: none;
  }
  .admin-sidebar h2 {
    padding: 10px 15px;
    margin: 0;
    border-bottom: none;
    border-right: 1px solid rgba(255,255,255,.1);
    font-size: 15px;
    flex-shrink: 0;
  }
  .admin-sidebar a {
    display: inline-flex;
    white-space: nowrap;
    padding: 10px 14px;
    font-size: 13px;
    flex-shrink: 0;
  }

  .admin-main {
    margin-left: 0;
    padding: 15px 12px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }
  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .admin-header h1 { font-size: 18px; }
  .stats-grid { grid-template-columns: 1fr; }
  .admin-card { padding: 15px; }

  /* Tables: hide non-essential columns on mobile */
  .col-hide-mobile { display: none; }
  table th, table td { padding: 8px 6px; font-size: 12px; }
  table td .btn { padding: 5px 10px; font-size: 11px; }
  .stat-card .number { font-size: 28px; }

  /* Full width buttons */
  .btn { padding: 10px 16px; }

  .login-box { padding: 25px 20px; }
}

/* ===========================
   RESPONSIVE - Small Mobile
   =========================== */
@media (max-width: 480px) {
  .admin-main { padding: 10px 8px; }
  .admin-card { padding: 12px 10px; }
  .admin-header h1 { font-size: 16px; }
  table th, table td { padding: 6px 4px; font-size: 11px; }
  table td .btn { padding: 4px 8px; font-size: 10px; margin: 1px; }
  .btn-sm { padding: 5px 10px; font-size: 11px; }
  .stat-card { padding: 14px; }
  .stat-card .number { font-size: 24px; }
  .stat-card .label { font-size: 11px; }
}
