/* ====================================================================
   ADMIN CONTROL PANEL - 100% RESPONSIVE STYLESHEET
   Flawless on Mobile, Tablet and Desktop
   ==================================================================== */
:root {
  --primary: #1A237E;
  --accent: #FF5252;
  --success: #00C853;
  --gold: #FBC503;
  --bg: #F4F6F9;
  --card-bg: #FFFFFF;
  --text: #212121;
}

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

body.admin-body {
  background-color: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  line-height: 1.4;
  overflow-x: hidden;
}

/* Admin Top Bar */
.admin-nav {
  background: var(--primary);
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.admin-nav h1 {
  font-size: clamp(1.1rem, 3.5vw, 1.35rem);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Reusable Buttons */
.admin-btn {
  padding: 7px 14px;
  border-radius: 4px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-size: 0.88rem;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  font-family: inherit;
}

.admin-btn-primary { background: #2962FF; color: white; }
.admin-btn-primary:hover { background: #0039CB; }

.admin-btn-success { background: var(--success); color: white; }
.admin-btn-success:hover { background: #009624; }

.admin-btn-danger { background: var(--accent); color: white; }
.admin-btn-danger:hover { background: #D50000; }

.admin-btn-warning { background: var(--gold); color: #111; }
.admin-btn-warning:hover { background: #E0AD00; }

/* Main Container */
.admin-container {
  max-width: 1100px;
  margin: 16px auto;
  padding: 0 10px;
}

/* Responsive Touch Horizontal Tabs */
.admin-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 2px solid #DDD;
  margin-bottom: 16px;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

.admin-tabs::-webkit-scrollbar {
  height: 4px;
}
.admin-tabs::-webkit-scrollbar-thumb {
  background: #CCC;
  border-radius: 2px;
}

.tab-btn {
  padding: 8px 16px;
  background: #E0E0E0;
  border: none;
  border-radius: 6px 6px 0 0;
  font-weight: 700;
  cursor: pointer;
  color: #555;
  font-size: clamp(0.82rem, 2.2vw, 0.92rem);
  flex-shrink: 0;
  font-family: inherit;
}

.tab-btn.active {
  background: #FFF;
  color: var(--primary);
  border-top: 3px solid var(--primary);
}

.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* Card Box */
.admin-card {
  background: var(--card-bg);
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  padding: clamp(12px, 2.5vw, 20px);
  margin-bottom: 18px;
}

.admin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  border-bottom: 1px solid #EEE;
  padding-bottom: 10px;
}

.admin-card-title {
  font-size: clamp(1.05rem, 3vw, 1.25rem);
  font-weight: 800;
  color: var(--primary);
}

/* Tables */
.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th, .admin-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid #EEE;
  font-size: 0.92rem;
}

.admin-table th {
  background: #F7F9FA;
  font-weight: 800;
  color: #333;
}

.admin-input-num {
  width: 65px;
  height: 38px;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 900;
  border: 2px solid #CCC;
  border-radius: 4px;
  font-family: inherit;
}

.admin-input-num:focus {
  border-color: #2962FF;
  outline: none;
}

.admin-input {
  padding: 8px 10px;
  border: 1px solid #CCC;
  border-radius: 4px;
  font-size: 0.92rem;
  width: 100%;
  font-family: inherit;
}

.admin-input:focus {
  border-color: var(--primary);
  outline: none;
}

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

.form-group label {
  display: block;
  font-weight: 700;
  margin-bottom: 5px;
  color: #333;
  font-size: 0.88rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 20px;
  background: #212121;
  color: white;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  z-index: 10000;
  display: none;
  font-weight: 700;
  font-size: 0.9rem;
}

.toast.show {
  display: block;
  animation: fadeIn 0.25s ease;
}

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

/* Login Box */
.login-box {
  max-width: 380px;
  margin: 60px auto;
  background: white;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  text-align: center;
}

.login-box h2 {
  font-size: 1.4rem;
  color: var(--primary);
  margin-bottom: 16px;
  font-weight: 800;
}

/* ====================================================================
   MOBILE ADAPTIVE RULES (<= 650px)
   Converts admin table rows into touch-friendly cards for mobile thumbs
   ==================================================================== */
@media screen and (max-width: 650px) {
  .admin-container { padding: 0 6px; }

  #admin-results-tbody, #admin-results-tbody tr, #admin-results-tbody td {
    display: block;
    width: 100%;
  }

  .admin-table thead {
    display: none;
  }

  #admin-results-tbody tr {
    background: #FFF;
    border: 1px solid #DDD;
    border-radius: 6px;
    margin-bottom: 10px;
    padding: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  }

  #admin-results-tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px dashed #EEE;
  }

  #admin-results-tbody td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.85rem;
    color: #555;
  }

  #admin-results-tbody td:first-child {
    display: block;
    border-bottom: 1px solid #E0E0E0;
    padding-bottom: 6px;
  }

  #admin-results-tbody td:first-child strong {
    font-size: 1rem;
    color: #1A237E;
  }

  #admin-results-tbody td:last-child {
    border-bottom: none;
    margin-top: 6px;
    justify-content: flex-end;
  }

  .admin-input-num {
    width: 75px;
    height: 40px;
  }
}
