/* Zen-iOS Hybrid Design System */
:root {
  /* Core Colors */
  --bg-color: #F2F2F7; /* iOS System Gray */
  --bg-alt-color: #F9F9FB; /* Cold Gray */
  --primary-color: #1C1C1E; /* Deep Space Black */
  --secondary-color: #6B7280; /* Gray 500 */
  --accent-color: #1C1C1E;
  --border-color: rgba(229, 229, 234, 0.6);
  
  /* Glass & Physics */
  --glass-bg: rgba(255, 255, 255, 0.5); /* White/50 */
  --glass-blur: 50px;
  --dual-stroke: inset 0 0 0 1px rgba(255, 255, 255, 0.6), 0 0 0 1px rgba(229, 229, 234, 0.4);
  --shadow-depth: 0 24px 48px -12px rgba(0, 0, 0, 0.08);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
  
  /* Input & Interactive */
  --input-bg: rgba(243, 244, 246, 0.5); /* Gray-100/50 */
  --hover-overlay: rgba(255, 255, 255, 0.4);
  
  /* Typography */
  --font-main: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--primary-color);
  line-height: 1.6;
  min-height: 100vh;
}

/* ============ Login Page ============ */
body.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--bg-color);
  /* Subtle ambient background if needed, but keeping it clean as per "Base Layer" rule */
}

.login-container {
  width: 420px;
  padding: 48px; /* p-12 */
  
  /* Glass Material */
  background-color: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  
  /* Dual Stroke & Depth */
  box-shadow: var(--shadow-depth), var(--dual-stroke);
  border-radius: 40px;
  
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.login-container:hover {
  transform: translateY(-2px);
}

.login-header {
  text-align: center;
  margin-bottom: 40px;
}

.login-header h2 {
  color: var(--primary-color);
  font-size: 28px;
  font-weight: 800; /* ExtraBold */
  letter-spacing: -0.02em; /* Tracking-tight */
  margin-bottom: 8px;
}

.login-header p {
  color: var(--secondary-color);
  font-size: 14px;
  font-weight: 500;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-group {
  position: relative;
}

.form-group i {
  position: absolute;
  top: 50%;
  left: 20px;
  transform: translateY(-50%);
  color: var(--secondary-color);
  font-size: 16px;
  pointer-events: none;
  transition: color 0.2s;
  z-index: 10;
}

.form-group:focus-within i {
  color: var(--primary-color);
}

/* Input Styles - Recessed Look */
input[type="password"],
input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 16px 20px 16px 50px;
  
  background-color: var(--input-bg);
  border: 1px solid transparent; /* Clean look */
  border-radius: 16px; /* rounded-xl/2xl */
  
  /* Inner Shadow for "Moonlight Carving" effect */
  box-shadow: var(--shadow-inner);
  
  font-family: var(--font-main);
  font-size: 15px;
  color: var(--primary-color);
  font-weight: 500;
  
  transition: all 0.2s ease;
}

input[type="password"]:focus,
input[type="text"]:focus,
input[type="number"]:focus {
  outline: none;
  background-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05), var(--shadow-inner);
}

input::placeholder {
  color: rgba(107, 114, 128, 0.5); /* Gray 500 with opacity */
}

/* Button Styles */
button {
  border: none;
  cursor: pointer;
  font-family: var(--font-main);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

button[type="submit"],
.primary-btn {
  width: 100%;
  padding: 16px;
  
  background-color: var(--primary-color);
  color: #FFFFFF;
  
  border-radius: 16px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  
  /* Subtle shadow for button */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

button[type="submit"]:hover,
.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(24px); /* backdrop-blur-3xl approx */
}

button:active,
.primary-btn:active {
  transform: scale(0.98);
}

/* Messages */
.lockout-message, .warning-message {
  padding: 16px;
  border-radius: 16px;
  text-align: center;
  font-size: 14px;
  margin-bottom: 24px;
  font-weight: 500;
  
  /* Glass effect for messages too */
  backdrop-filter: blur(10px);
}

.lockout-message {
  background-color: rgba(231, 76, 60, 0.1);
  color: #c0392b;
  border: 1px solid rgba(231, 76, 60, 0.2);
}

.warning-message {
  background-color: rgba(243, 156, 18, 0.1);
  color: #d35400;
  border: 1px solid rgba(243, 156, 18, 0.2);
}

/* ============ Query Page ============ */
body.query-page {
  padding: 40px 20px;
  background-color: var(--bg-color);
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px; /* p-12 */
  
  /* Glass Material */
  background-color: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  
  /* Dual Stroke & Depth */
  box-shadow: var(--shadow-depth), var(--dual-stroke);
  border-radius: 48px; /* rounded-[40px] to [50px] */
}

.header {
  text-align: center;
  margin-bottom: 48px;
  position: relative;
}

.header h2 {
  color: var(--primary-color);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}

.subtitle {
  color: var(--secondary-color);
  font-size: 16px;
  font-weight: 500;
}

/* Form Elements */
.input-group {
  margin-bottom: 32px;
  position: relative;
}

.input-group label {
  display: block;
  margin-bottom: 12px;
  
  /* Label Specs: Uppercase, Tracking-widest, Bold, 10px */
  font-size: 11px; /* Slightly larger for readability, but close to 10px */
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 700;
  color: var(--secondary-color);
}

.input-group > i {
  position: absolute;
  top: 48px; /* Adjusted for label height + padding */
  left: 20px;
  color: var(--secondary-color);
  z-index: 10;
  pointer-events: none;
}

.input-group:focus-within > i {
  color: var(--primary-color);
}

/* Dropdowns */
.custom-dropdown {
  position: relative;
}

.custom-dropdown input[readonly] {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23949CA4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 20px center;
  background-size: 16px;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  width: 100%;
  
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1), 0 0 0 1px rgba(229, 229, 234, 0.4);
  
  z-index: 100;
  display: none;
  padding: 8px;
  animation: slideDown 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.dropdown-menu.show {
  display: block;
}

.option-item {
  padding: 12px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--primary-color);
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.1s;
}

.option-item:hover {
  background-color: #F1F5F9;
}

.option-item input[type="checkbox"] {
  margin-right: 12px;
  width: 18px;
  height: 18px;
  accent-color: var(--primary-color);
  border-radius: 4px;
}

/* Buttons */
.button-container {
  margin-top: 48px;
}

.primary-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  padding: 18px;
}

/* Results Area */
.results-container {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid rgba(211, 218, 223, 0.5);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.results-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.results-title i {
  color: var(--secondary-color);
}

.copy-btn {
  padding: 10px 20px;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--primary-color);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.copy-btn:hover {
  background-color: #fff;
  border-color: var(--secondary-color);
  transform: translateY(-1px);
}

.copy-btn:active {
  transform: scale(0.98);
}

/* Code/Results Block */
#results {
  background-color: #2D333B; /* Darker, cooler grey */
  color: #E6EDF3;
  padding: 24px;
  border-radius: 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  min-height: 200px;
  
  /* Inner shadow for depth */
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.05);
  
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
}

#results.empty {
  background-color: rgba(232, 241, 248, 0.3);
  color: var(--secondary-color);
  border: 2px dashed var(--border-color);
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-main);
  font-style: normal;
  font-weight: 500;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 40px;
  gap: 16px;
}

.pagination button {
  padding: 12px 24px;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--primary-color);
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination button:hover:not(:disabled) {
  background-color: #fff;
  border-color: var(--secondary-color);
  transform: translateY(-1px);
}

.pagination button:active:not(:disabled) {
  transform: scale(0.98);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-info {
  font-weight: 600;
  color: var(--secondary-color);
  font-size: 14px;
  padding: 0 10px;
}

/* Toast */
#copySuccess {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  
  background-color: rgba(46, 204, 113, 0.9);
  backdrop-filter: blur(10px);
  
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  box-shadow: 0 10px 30px rgba(46, 204, 113, 0.3);
  
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
  
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1000;
}

#copySuccess.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 32px;
    border-radius: 32px;
  }
  
  .login-container {
    width: 90%;
    padding: 32px;
  }
  
  h2 {
    font-size: 28px;
  }
}

/* Loading & States */
.spinner {
  border: 3px solid rgba(65, 73, 83, 0.1);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border-left-color: var(--primary-color);
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading {
  text-align: center;
  padding: 48px;
  color: var(--secondary-color);
  background-color: rgba(232, 241, 248, 0.3);
  border-radius: 20px;
  border: 1px dashed var(--border-color);
}

.loading .status {
  font-size: 14px;
  font-weight: 500;
}

#results.error {
  color: #c0392b;
  background-color: rgba(231, 76, 60, 0.05);
  border: 1px solid rgba(231, 76, 60, 0.2);
  font-family: var(--font-main);
  box-shadow: none;
}

