/*
=============================================================
File: global.css
Rev: 2.1
Date: 2025-11-09
Author: Gemini
Notes:
- Built from global.css Rev 2.0.
- CSS FIX: The previous fix for the view.php button alignment
  was not specific enough.
- ADDED: A new rule: `.rv-actions > .btn`. This rule
  targets the <a> buttons that are *direct children* of
  .rv-actions and forces them to align to the top
  (`flex-start`), matching the form wrapper. This should
  solve the alignment issue.
=============================================================
*/

/* Base styles */
:root {
  --text: #ffffff;
  --background: #0a0a0a;
  --border: #333;
  --primary: #007acc;
  --danger: #ff8484;
  --muted: #aaa;
}

body {
  background: var(--background);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  margin: 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  margin: 0 0 1rem 0;
}

/* Layout */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.maxw {
  max-width: 1200px;
  margin: 0 auto;
}

/* Recipe container */
.recipe-container {
  padding: 20px;
}

/* Forms */
.form-vertical {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-input, .form-select, .form-textarea {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.btn--primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn--primary:hover {
  background: #0066aa;
}

.btn--danger {
  background: var(--danger);
  color: #1a1a1a;
  border-color: var(--danger);
}

.btn--danger:hover {
  background: #ff6666;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
}

/* Recipe view layout */
.rv-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.rv-title {
  margin: 0;
  flex: 1;
}

.rv-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.rv-actions form {
  display: inline;
}

/* View page specific styles */
.rv-actions-inline-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  font-size: 13px;
  cursor: pointer;
}

.rv-actions-inline-checkbox input {
  margin: 0;
}

.rv-hint-panel {
  display: none;
  margin-top: 12px;
  text-align: right;
}

.rv-hint-form {
  display: inline-block;
  text-align: left;
}

.rv-hint-input {
  width: 400px;
  max-width: 100%;
  height: 40px;
  background: #0a0a0a;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 14px;
  margin-bottom: 8px;
  display: block;
  line-height: 40px;
}

.rv-hint-input::placeholder {
  color: var(--muted);
}

.rv-hint-buttons {
  text-align: right;
}

.rv-hint-buttons .btn + .btn {
  margin-left: 8px;
}

/* Legacy hint textarea (for backwards compatibility) */
.rv-hint-textarea {
  width: 600px;
  max-width: 100%;
  height: 40px;
  background: #0a0a0a;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  resize: none;
  font-family: inherit;
  margin-bottom: 8px;
  display: block;
  line-height: 1.2;
}

/* Grid system */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.card {
  background: #111;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
}

.card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.card-body {
  padding: 16px;
}

.card-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.card-meta {
  color: var(--muted);
  font-size: 14px;
}

.clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Recipe view layout */
.rv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-top: 24px;
}

@media (max-width: 768px) {
  .rv-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

.rv-media {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rv-hero {
  border-radius: 8px;
  overflow: hidden;
}

.rv-hero-img {
  width: 100%;
  height: auto;
  display: block;
}

.rv-thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.rv-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.rv-thumb:hover,
.rv-thumb.is-active {
  border-color: var(--primary);
}

.rv-meta {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.rv-meta strong {
  color: var(--text);
}

/* Lists */
.rv-ingredients {
  list-style: none;
  padding: 0;
  margin: 0 0 32px 0;
}

.rv-ingredients li {
  padding: 8px 0;
  border-bottom: 1px solid #222;
}

.rv-instructions {
  padding-left: 24px;
  margin: 0;
}

.rv-instructions li {
  padding: 8px 0;
  line-height: 1.6;
}

/* Edit page layout */
.rv-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-top: 24px;
}

@media (max-width: 768px) {
  .rv-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* Utility classes */
.mt-12 { margin-top: 12px; }
.mt-6 { margin-top: 6px; }
.text-12 { font-size: 12px; }
.text-faint { color: #666; }
.text-muted { color: var(--muted); }

/* Admin/Debug styles */
.panel {
  background: #111;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin: 20px 0;
}

.code {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  background: #1a1a1a;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
}

.debug {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.kv {
  background: #1a1a1a;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 12px;
  font-family: monospace;
  color: #ccc;
}

.debug textarea,
.panel textarea {
  width: 100%;
  min-height: 120px;
  background: #1a1a1a;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  font-family: monospace;
  font-size: 13px;
  resize: vertical;
}

/* Progress bar styles */
.progress-page {
  background: var(--background);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: #333;
  border-radius: 3px;
  overflow: hidden;
  margin: 16px 0;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Processing notification styles */
.processing-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: inherit;
}

.processing-message {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 30px;
  text-align: center;
  max-width: 400px;
}

.processing-title {
  margin: 0 0 15px 0;
  color: #fff;
}

.processing-text {
  margin: 0;
  color: #ccc;
}

.processing-progress {
  margin-top: 20px;
}

.processing-progress-bar {
  width: 100%;
  height: 4px;
  background: #333;
  border-radius: 2px;
  overflow: hidden;
}

.processing-progress-fill {
  width: 100%;
  height: 100%;
  background: #007acc;
  animation: pulse 1.5s ease-in-out infinite alternate;
}

@keyframes pulse {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* Auto-resize textarea styles */
.js-autosize {
  transition: height 0.2s ease;
}

/* Delete page styles */
.form-actions {
  margin-top: 20px;
}

.form-actions .btn + .btn {
  margin-left: 12px;
}

/* Notice styles */
.notice {
  background: #2a1a1a;
  border: 1px solid #aa4444;
  border-radius: 6px;
  padding: 16px;
  margin: 16px 0;
  color: #ffaaaa;
}

/* Page styles */
.page {
  max-width: 600px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* Table styles */
.table-wrap {
  overflow: auto;
  margin: 20px 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: #111;
}

.table th,
.table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  background: #1a1a1a;
  font-weight: 600;
  color: var(--text);
}

.table td {
  color: var(--muted);
}

/* Header and navigation */
.header {
  background: var(--background);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
}

.nav-brand {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.nav-container {
  position: relative;
}

.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--text);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Hamburger menu - working version */
.hamburger-toggle {
  display: none;
}

.hamburger-icon {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  padding: 8px;
}

.hamburger-line {
  width: 24px;
  height: 2px;
  background: var(--text);
  margin: 3px 0;
  transition: 0.3s;
}

.hamburger-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  min-width: 160px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hamburger-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hamburger-items a {
  color: var(--text);
  text-decoration: none;
  padding: 12px 16px;
  border-radius: 4px;
  transition: background-color 0.2s;
  font-size: 16px;
}

.hamburger-items a:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Show hamburger menu when toggle is checked */
.hamburger-toggle:checked ~ .hamburger-menu {
  display: block;
}

/* Hamburger animation when checked */
.hamburger-toggle:checked ~ .hamburger-icon .hamburger-line:nth-child(1) {
  transform: rotate(-45deg) translate(-5px, 6px);
}

.hamburger-toggle:checked ~ .hamburger-icon .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger-toggle:checked ~ .hamburger-icon .hamburger-line:nth-child(3) {
  transform: rotate(45deg) translate(-5px, -6px);
}

/* ===== HAMBURGER TOGGLE START ===== */
/* * OPTION A: Desktop buttons, mobile hamburger (CURRENT DEFAULT)
 * OPTION B: Hamburger on ALL screen sizes
 * * To switch options:
 * - Comment out the ENTIRE option you don't want
 * - Uncomment the ENTIRE option you do want
 */

/* OPTION A: Desktop buttons, mobile hamburger (CURRENT DEFAULT) */
.hamburger-icon {
  display: none;
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  
  .hamburger-icon {
    display: flex;
  }
}

/* OPTION B: Always show hamburger on ALL screen sizes (uncomment to use) */
/*
.nav-links {
  display: none;
}
.hamburger-icon {
  display: flex;
}
*/
/* ===== HAMBURGER TOGGLE END ===== */

/* Upload form styles */
.upload-method-selector {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px;
  background: #111;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.upload-method-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 6px;
  transition: background-color 0.2s;
  font-size: 16px;
}

.upload-method-option:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.upload-method-option input[type="radio"] {
  margin: 0;
}

.upload-form-section {
  margin-top: 16px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .rv-topbar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  
  .rv-actions {
    justify-content: center;
  }
  
  .rv-hint-input {
    width: 100%;
  }
  
  .upload-method-selector {
    flex-direction: column;
    gap: 12px;
  }
}

/* FIX FOR VIEW.PHP BUTTON ALIGNMENT */
.rv-actions .rv-form-wrapper {
  align-self: flex-start;
}
/* This targets the <a> buttons directly */
.rv-actions > .btn {
  align-self: flex-start;
}
