/* ========================================================
   AZARIN ADMIN CONSOLE - STYLESHEET
   Clean, Modern, Dark Slate Developer/Admin Dashboard
   ======================================================== */

:root {
  --admin-bg: #090d16;
  --admin-sidebar-bg: #0d131f;
  --admin-card: #131b2c;
  --admin-card-inner: #0f1624;
  --admin-border: #1e293b;
  --admin-border-focus: #38bdf8;
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-glow: rgba(2, 132, 199, 0.25);

  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-indigo: #6366f1;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --font-sans: 'Inter', 'Noto Sans JP', -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--admin-bg);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ========================================================
   Auth Modal (Login Gate)
   ======================================================== */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(9, 13, 22, 0.95);
  backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  text-align: center;
}

.auth-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.auth-icon-wrap svg {
  width: 26px;
  height: 26px;
}

.auth-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.auth-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.auth-input-group {
  margin-bottom: 1.25rem;
  text-align: left;
}

.auth-input-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.auth-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--admin-card-inner);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 1rem;
  font-family: var(--font-mono);
  outline: none;
  transition: border-color 0.2s;
}

.auth-input:focus {
  border-color: var(--admin-border-focus);
}

.auth-error {
  color: var(--accent-rose);
  font-size: 0.82rem;
  margin-top: 0.5rem;
  display: none;
}

.auth-hint {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-top: 1rem;
}

/* ========================================================
   Admin Layout (Left: Editor, Right: Preview)
   ======================================================== */
.admin-layout {
  display: flex !important;
  flex-direction: row !important;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Main Form Area (Left) */
.admin-editor {
  flex: 1 1 52%;
  width: 52%;
  min-width: 360px;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2rem 2.25rem 4rem;
  border-right: 1px solid var(--admin-border);
  box-sizing: border-box;
  background-color: var(--admin-bg);
}

@media (max-width: 768px) {
  .admin-layout {
    flex-direction: column !important;
  }
  .admin-editor {
    flex: 1 1 100%;
    width: 100%;
    min-width: 100%;
    height: auto;
    padding: 1.25rem 1rem 3rem;
  }
}

/* Top Bar */
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--admin-border);
}

.admin-branding {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-logo-badge {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}

.admin-page-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.admin-top-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Section Cards */
.form-section {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.75rem;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--admin-border);
}

.sec-title {
  font-size: 1.02rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}

.sec-title svg {
  width: 18px;
  height: 18px;
  color: var(--accent-cyan);
}

/* Form Controls */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--admin-card-inner);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--admin-border-focus);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
}

/* Switch & Toggle */
.toggle-switch-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
}

.toggle-switch-label {
  font-size: 0.88rem;
  font-weight: 600;
}

.toggle-switch-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--admin-border);
  transition: 0.3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Range Slider */
.range-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.range-input {
  flex: 1;
  accent-color: var(--accent-cyan);
}

.range-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cyan);
  min-width: 45px;
  text-align: right;
}

/* Link Editor Items */
.links-editor-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.link-editor-item {
  background: var(--admin-card-inner);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  position: relative;
}

.link-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.link-editor-title {
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.link-editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

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

.btn-remove-link {
  background: transparent;
  border: none;
  color: var(--accent-rose);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-remove-link:hover {
  background: rgba(244, 63, 94, 0.15);
}

/* Action Buttons */
.btn-admin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-admin-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px var(--primary-glow);
}

.btn-admin-primary:hover {
  background: var(--primary-hover);
}

.btn-admin-secondary {
  background: var(--admin-card-inner);
  border-color: var(--admin-border);
  color: var(--text-main);
}

.btn-admin-secondary:hover {
  background: var(--admin-border);
}

.btn-admin-success {
  background: #059669;
  color: #fff;
}

.btn-admin-success:hover {
  background: #047857;
}

.btn-admin-danger {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.4);
  color: var(--accent-rose);
}

.btn-admin-danger:hover {
  background: rgba(244, 63, 94, 0.25);
}

.btn-admin svg {
  width: 15px;
  height: 15px;
}

.floating-save-bar {
  position: sticky;
  bottom: 1.5rem;
  background: rgba(19, 27, 44, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 100;
}

/* ========================================================
   Preview Area (Right Half)
   ======================================================== */
.admin-preview {
  flex: 1 1 48%;
  width: 48%;
  min-width: 360px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #05080e;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .admin-preview {
    flex: 1 1 100%;
    width: 100%;
    min-width: 100%;
    height: 75vh;
  }
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--admin-sidebar-bg);
  border-bottom: 1px solid var(--admin-border);
}

.preview-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.preview-badge {
  font-size: 0.65rem;
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-emerald);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.preview-device-toggle {
  display: flex;
  gap: 0.25rem;
  background: var(--admin-card-inner);
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--admin-border);
}

.device-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
}

.device-btn.active, .device-btn:hover {
  background: var(--admin-border);
  color: var(--text-main);
}

.device-btn svg {
  width: 14px;
  height: 14px;
}

.preview-frame-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: radial-gradient(circle at center, #111827 0%, #030712 100%);
  overflow: hidden;
}

.preview-iframe {
  width: 100%;
  height: 100%;
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  background: #0a0c10;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
  transition: width 0.3s ease;
}

.preview-iframe.device-mobile {
  max-width: 390px;
  border-radius: 36px;
  border: 8px solid #27272a;
}

.preview-iframe.device-tablet {
  max-width: 768px;
}

/* Toast */
.admin-toast {
  position: fixed;
  bottom: 2rem;
  left: 25%;
  transform: translateX(-50%) translateY(100px);
  background: #064e3b;
  border: 1px solid var(--accent-emerald);
  color: #ecfdf5;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 999999;
}

.admin-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* GitHub Deploy Button & Status Box */
.btn-admin-github {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-size: 0.95rem;
  padding: 0.75rem 1.4rem;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-admin-github:hover:not(:disabled) {
  filter: brightness(1.15);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
}

.btn-admin-github:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.deploy-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.deploy-status-box {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--admin-card-inner);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  display: none;
  line-height: 1.6;
}

.deploy-status-box.show {
  display: block;
}

.deploy-status-box.success {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.1);
  color: #a7f3d0;
}

.deploy-status-box.error {
  border-color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.1);
  color: #fecdd3;
}

.deploy-status-box a {
  color: var(--accent-cyan);
  text-decoration: underline;
  font-weight: 600;
}

