/* ============================================================
   Captain Randy and His Merry Fellows — Main Stylesheet
   Theme: Nautical / Navy, Gold, White
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --navy:      #0a1628;
  --navy-mid:  #122040;
  --navy-light:#1e3a5f;
  --gold:      #c9a84c;
  --gold-light:#e8c96a;
  --white:     #ffffff;
  --off-white: #f5f0e8;
  --grey-light:#e8e8e8;
  --grey:      #999;
  --red-danger:#c0392b;
  --green-ok:  #27ae60;
  --font-main: 'Georgia', serif;
  --font-ui:   'Helvetica Neue', Arial, sans-serif;
  --shadow:    0 4px 20px rgba(0,0,0,0.35);
  --radius:    8px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background-color: var(--navy);
  color: var(--white);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ---------- Nautical rope border utility ---------- */
.rope-border {
  border: 3px solid var(--gold);
  border-radius: var(--radius);
  position: relative;
}

/* ---------- Header / Nav ---------- */
.site-header {
  background: var(--navy-mid);
  border-bottom: 3px solid var(--gold);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-icon {
  font-size: 2rem;
  line-height: 1;
}

.logo-text {
  font-family: var(--font-main);
  color: var(--gold);
  font-size: 1.15rem;
  font-weight: bold;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.logo-text span {
  display: block;
  font-size: 0.7rem;
  color: var(--grey);
  font-style: italic;
  font-weight: normal;
  letter-spacing: 1px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.main-nav a {
  color: var(--white);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}

.main-nav a:hover,
.main-nav a.active {
  background: var(--gold);
  color: var(--navy);
  text-decoration: none;
}

.nav-logout {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold) !important;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  transition: background 0.2s, color 0.2s;
}

.nav-logout:hover {
  background: var(--gold);
  color: var(--navy) !important;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  background: none;
  border: none;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--gold);
  transition: all 0.3s;
}

/* ---------- Page Wrapper ---------- */
.page-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ---------- Hero Banner (auth pages) ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  background:
    linear-gradient(to bottom, rgba(10,22,40,0.85) 0%, rgba(10,22,40,0.95) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Cpath d='M0 30 Q15 0 30 30 Q45 60 60 30' stroke='%23c9a84c' stroke-width='0.5' fill='none' opacity='0.15'/%3E%3C/svg%3E")
    repeat;
}

.auth-card {
  background: var(--navy-mid);
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo-img {
  width: 200px;
  height: auto;
  display: block;
  margin: 0 auto 16px;
}

.auth-logo h1 {
  font-family: var(--font-main);
  color: var(--gold);
  font-size: 1.4rem;
  line-height: 1.3;
}

.auth-logo p {
  color: var(--grey);
  font-size: 0.8rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 4px;
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  color: var(--gold-light);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: var(--navy);
  border: 1.5px solid var(--navy-light);
  color: var(--white);
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font-ui);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--gold);
}

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
  font-family: var(--font-ui);
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--gold);
  color: var(--navy);
  width: 100%;
}

.btn-primary:hover { background: var(--gold-light); box-shadow: 0 4px 15px rgba(201,168,76,0.4); }

.btn-secondary {
  background: transparent;
  color: var(--gold);
  border: 1.5px solid var(--gold);
}

.btn-secondary:hover { background: rgba(201,168,76,0.1); }

.btn-danger {
  background: var(--red-danger);
  color: var(--white);
}

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

.btn-success {
  background: var(--green-ok);
  color: var(--white);
}

.btn-success:hover { background: #229954; }

.btn-sm {
  padding: 7px 14px;
  font-size: 0.82rem;
}

/* ---------- Alerts / Messages ---------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 0.9rem;
  display: none;
}

.alert.show { display: block; }

.alert-error   { background: rgba(192,57,43,0.2);  border: 1px solid var(--red-danger); color: #e74c3c; }
.alert-success { background: rgba(39,174,96,0.2);  border: 1px solid var(--green-ok);   color: #2ecc71; }
.alert-info    { background: rgba(201,168,76,0.15); border: 1px solid var(--gold);       color: var(--gold-light); }

/* ---------- Page Title ---------- */
.page-title {
  font-family: var(--font-main);
  color: var(--gold);
  font-size: 2rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title .icon { font-size: 1.8rem; }

.page-subtitle {
  color: var(--grey);
  margin-bottom: 36px;
  font-size: 0.95rem;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--navy-light);
  margin: 32px 0;
}

/* ---------- Dashboard Cards ---------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-top: 40px;
}

.dash-card {
  background: var(--navy-mid);
  border: 2px solid var(--navy-light);
  border-radius: 12px;
  padding: 32px 24px;
  text-align: center;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  display: block;
}

.dash-card:hover {
  border-color: var(--gold);
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(201,168,76,0.2);
  text-decoration: none;
}

.dash-card .card-icon { font-size: 3rem; display: block; margin-bottom: 16px; }
.dash-card h3 { font-family: var(--font-main); color: var(--gold); font-size: 1.2rem; margin-bottom: 8px; }
.dash-card p  { color: var(--grey); font-size: 0.88rem; }

/* ---------- Blog ---------- */
.blog-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 24px;
}

.post-list { display: flex; flex-direction: column; gap: 24px; }

.post-card {
  background: var(--navy-mid);
  border: 1px solid var(--navy-light);
  border-radius: 10px;
  padding: 28px 32px;
  transition: border-color 0.2s;
}

.post-card:hover { border-color: var(--gold); }

.post-meta {
  display: flex;
  gap: 18px;
  font-size: 0.8rem;
  color: var(--grey);
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.post-meta span { display: flex; align-items: center; gap: 4px; }

.post-card h2 {
  font-family: var(--font-main);
  color: var(--gold);
  font-size: 1.35rem;
  margin-bottom: 12px;
}

.post-body {
  color: var(--off-white);
  line-height: 1.75;
  white-space: pre-wrap;
}

.post-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--navy-light);
}

/* Blog modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--navy-mid);
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 36px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-header h2 { font-family: var(--font-main); color: var(--gold); }

.modal-close {
  background: none;
  border: none;
  color: var(--grey);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.modal-close:hover { color: var(--white); }

/* ---------- Gallery ---------- */
.gallery-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.gallery-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--navy-light);
  border: 2px solid var(--navy-light);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}

.gallery-item:hover { border-color: var(--gold); transform: scale(1.02); }

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item .delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(192,57,43,0.9);
  border: none;
  color: white;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
}

.gallery-item:hover .delete-btn { display: flex; }

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 300;
  align-items: center;
  justify-content: center;
}

.lightbox.open { display: flex; }

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border: 3px solid var(--gold);
  border-radius: var(--radius);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: var(--white);
  font-size: 2.5rem;
  cursor: pointer;
  line-height: 1;
}

/* ---------- Calendar ---------- */
.calendar-placeholder {
  background: var(--navy-mid);
  border: 2px dashed var(--gold);
  border-radius: 12px;
  padding: 60px 24px;
  text-align: center;
}

.calendar-placeholder p { color: var(--grey); margin-bottom: 8px; }
.calendar-placeholder code {
  display: block;
  background: var(--navy);
  color: var(--gold-light);
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin: 16px auto;
  max-width: 560px;
  text-align: left;
  white-space: pre-wrap;
}

.calendar-embed iframe {
  width: 100%;
  border: 2px solid var(--navy-light);
  border-radius: 10px;
}

/* ---------- Admin Panel ---------- */
.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 32px;
  border-bottom: 2px solid var(--navy-light);
  padding-bottom: 0;
  overflow-x: auto;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--grey);
  padding: 12px 20px;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: var(--font-ui);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover { color: var(--gold); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); font-weight: 600; }

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

.member-list { display: flex; flex-direction: column; gap: 12px; }

.member-row {
  background: var(--navy-mid);
  border: 1px solid var(--navy-light);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.member-info h4 { color: var(--white); font-size: 0.95rem; margin-bottom: 2px; }
.member-info p  { color: var(--grey); font-size: 0.82rem; }

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-pending  { background: rgba(201,168,76,0.2);  color: var(--gold-light); }
.status-approved { background: rgba(39,174,96,0.2);   color: #2ecc71; }
.status-rejected { background: rgba(192,57,43,0.2);   color: #e74c3c; }

.member-actions { display: flex; gap: 8px; }

/* Upload area */
.upload-area {
  border: 2px dashed var(--navy-light);
  border-radius: 10px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 24px;
}

.upload-area:hover, .upload-area.drag-over {
  border-color: var(--gold);
  background: rgba(201,168,76,0.05);
}

.upload-area p { color: var(--grey); margin-top: 10px; font-size: 0.9rem; }
.upload-area .upload-icon { font-size: 2.5rem; }

#file-input { display: none; }

/* Progress bar */
.progress-bar-wrap {
  background: var(--navy);
  border-radius: 20px;
  height: 8px;
  margin: 12px 0;
  overflow: hidden;
  display: none;
}

.progress-bar-wrap.show { display: block; }

.progress-bar {
  height: 100%;
  background: var(--gold);
  border-radius: 20px;
  transition: width 0.3s;
}

/* ---------- Spinner ---------- */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--grey);
}

.empty-state .icon { font-size: 3rem; display: block; margin-bottom: 12px; opacity: 0.4; }

/* ---------- Welcome banner ---------- */
.welcome-banner {
  background: linear-gradient(135deg, var(--navy-mid), var(--navy-light));
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 36px 40px;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}

.welcome-banner::before {
  content: '⚓';
  position: absolute;
  right: 30px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 6rem;
  opacity: 0.06;
}

.welcome-banner h2 {
  font-family: var(--font-main);
  color: var(--gold);
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.welcome-banner p { color: var(--off-white); font-size: 0.95rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy-mid);
  border-top: 2px solid var(--navy-light);
  text-align: center;
  padding: 20px;
  color: var(--grey);
  font-size: 0.82rem;
  margin-top: auto;
}

.site-footer span { color: var(--gold); }

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.text-gold   { color: var(--gold); }
.mt-16       { margin-top: 16px; }
.mt-24       { margin-top: 24px; }
.hidden      { display: none !important; }
.flex-end    { display: flex; justify-content: flex-end; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .main-nav {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 70px;
    left: 0; right: 0;
    background: var(--navy-mid);
    border-bottom: 2px solid var(--gold);
    padding: 16px;
    gap: 4px;
  }

  .main-nav.open { display: flex; }
  .main-nav a { width: 100%; text-align: left; padding: 12px 16px; }
  .hamburger { display: flex; }

  .auth-card { padding: 32px 24px; }

  .page-wrap { padding: 24px 16px 60px; }

  .page-title { font-size: 1.5rem; }

  .post-card { padding: 20px; }

  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

  .welcome-banner { padding: 24px; }
  .welcome-banner::before { display: none; }

  .member-row { flex-direction: column; align-items: flex-start; }
}
