/* ============================================
   LastCork Global Styles
   Dark theme with wine accents
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --card: #0f3460;
  --primary: #8B0000;
  --primary-hover: #a00000;
  --accent: #C9A84C;
  --accent-hover: #d4b85c;
  --text: #e8e8e8;
  --text-muted: #8892b0;
  --border: rgba(255, 255, 255, 0.08);
  --radius-card: 8px;
  --radius-sm: 4px;
  --transition: 0.2s ease;
  --font-body: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-heading: Georgia, 'Playfair Display', serif;
  --max-width: 1200px;
  --sidebar-width: 260px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.5rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--accent-hover); }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

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

ul, ol { list-style: none; }

/* --- Utility --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-center { text-align: center; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
  color: #fff;
}

.btn-accent {
  background: var(--accent);
  color: #1a1a2e;
}
.btn-accent:hover {
  background: var(--accent-hover);
  color: #1a1a2e;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

.btn-block {
  display: flex;
  width: 100%;
}

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

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color var(--transition);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
}
.form-input::placeholder { color: var(--text-muted); opacity: 0.6; }

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

.form-error {
  color: #e74c3c;
  font-size: 0.8125rem;
  margin-top: 0.375rem;
}

.form-hint {
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin-top: 0.375rem;
}

/* --- Cards --- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.card-flat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
}

/* --- Tables --- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--surface);
}

th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.badge-accent {
  background: rgba(201, 168, 76, 0.15);
  color: var(--accent);
}

.badge-primary {
  background: rgba(139, 0, 0, 0.2);
  color: #e06060;
}

.badge-success {
  background: rgba(39, 174, 96, 0.15);
  color: #27ae60;
}

.badge-muted {
  background: rgba(136, 146, 176, 0.15);
  color: var(--text-muted);
}

/* --- Header/Nav --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1rem 0;
  transition: background var(--transition), backdrop-filter var(--transition);
}

.site-header.scrolled {
  background: rgba(26, 26, 46, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.logo:hover { color: var(--accent); }
.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav-links a {
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: color var(--transition);
}
.nav-links a:hover { color: var(--text); }

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

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.5rem;
  font-size: 1.5rem;
  line-height: 1;
}

@media (max-width: 768px) {
  .nav-toggle { display: block; }

  .nav-links,
  .nav-actions {
    display: none;
  }

  .site-header.nav-open .nav-links,
  .site-header.nav-open .nav-actions {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .site-header.nav-open .header-inner {
    flex-wrap: wrap;
  }
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0 2rem;
  margin-top: 4rem;
}

.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
}

.footer-brand p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.75rem;
  max-width: 300px;
}

.footer-col h4 {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.footer-col a {
  display: block;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 0.25rem 0;
}
.footer-col a:hover { color: var(--text); }

.footer-bottom {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }
  .footer-brand {
    grid-column: 1 / -1;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .footer-inner {
    grid-template-columns: 1fr;
  }
}

/* --- Auth Pages (login/signup) --- */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}

.auth-card h1 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.auth-card .subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.auth-card .form-group:last-of-type {
  margin-bottom: 1.5rem;
}

.auth-links {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.auth-links a {
  color: var(--accent);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* --- Alert Messages --- */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: none;
}
.alert.visible { display: block; }
.alert-error {
  background: rgba(231, 76, 60, 0.12);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.25);
}
.alert-success {
  background: rgba(39, 174, 96, 0.12);
  color: #27ae60;
  border: 1px solid rgba(39, 174, 96, 0.25);
}

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

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

.btn .spinner {
  width: 16px;
  height: 16px;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* --- Selection --- */
::selection {
  background: rgba(139, 0, 0, 0.4);
  color: var(--text);
}
