/* ============= Variables & Root Styles ============= */

:root {
  --form-element-valid-border-color: #d4af37;
  --form-element-invalid-border-color: #dc3545;
  --form-element-disabled-opacity: 0.5;
  
  /* Luxury color palette */
  --color-navy: #1a2a3a;
  --color-burgundy: #6b2c3e;
  --color-gold: #d4af37;
  --color-cream: #f5f1e8;
  --color-dark-wood: #3e2723;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Georgia', 'Garamond', serif;
  background: linear-gradient(135deg, rgba(26, 42, 58, 0.85) 0%, rgba(62, 39, 35, 0.85) 100%), url('loch-lomond.jpg') center/cover fixed;
  background-attachment: fixed;
  color: #e0e0e0;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

#app {
  width: 100%;
  min-height: 100vh;
}

.app-container {
  width: 100%;
  min-height: 100vh;
}

/* ============= Navigation ============= */

nav {
  background: rgba(26, 42, 58, 0.95);
  border-bottom: 3px solid var(--color-gold);
  padding: 1rem 1.5rem;
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

nav > ul {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

nav > ul:first-child {
  flex: 1;
}

nav > ul:last-child {
  flex: 1;
  justify-content: flex-end;
}

nav strong {
  color: var(--color-gold);
  font-size: 1.1rem;
  letter-spacing: 2px;
}

/* ============= Countdown Display ============= */

.countdown-display {
  text-align: center;
  flex: 1;
}

.countdown-label {
  font-size: 0.9rem;
  color: #a0a0a0;
  margin-bottom: 0.25rem;
  letter-spacing: 1px;
}

.countdown-time {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-gold);
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
}

/* ============= User Info in Navbar ============= */

.user-info-nav {
  text-align: right;
  font-size: 0.9rem;
  line-height: 1.4;
}

.user-info-nav strong {
  font-size: 1rem;
  color: #e0e0e0;
  display: block;
}

.email-small {
  color: #a0a0a0;
  font-style: italic;
}

.role-small {
  margin-top: 0.25rem;
  font-size: 0.85rem;
}

nav ul li:last-child button {
  margin: 0;
}

/* ============= Container & Layout ============= */

main.container {
  max-width: 1400px;
  padding: 1.5rem 1.5rem;
  margin: 0 auto;
}

article {
  background: rgba(51, 51, 51, 0.7);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 8px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  margin-bottom: 1.5rem;
}

article h1 {
  color: var(--color-gold);
  border: none;
  margin-bottom: 0.5rem;
}

article h2, article h3 {
  color: var(--color-gold);
  border-bottom: 2px solid rgba(212, 175, 55, 0.5);
  padding-bottom: 0.5rem;
}

article p {
  color: #d0d0d0;
  line-height: 1.6;
}

/* ============= Login Page ============= */

.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 2rem;
}

.login-card {
  max-width: 450px;
  text-align: center;
  padding: 3rem 2rem;
}

.login-card h1 {
  font-size: 2.8rem;
  color: var(--color-gold);
  letter-spacing: 3px;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.login-card > p {
  font-size: 1rem;
  color: #a0a0a0;
  margin-bottom: 2.5rem;
  font-style: italic;
}

/* ============= Custom Sign-In Button ============= */

.btn-signin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--color-gold) 0%, #c9a227 100%);
  color: var(--color-navy);
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
  text-decoration: none;
}

.btn-signin:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(212, 175, 55, 0.5);
  background: linear-gradient(135deg, #e6c547 0%, #d4af37 100%);
}

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

/* ============= Google Sign-In Button ============= */

#google_button_container {
  margin-top: 1rem;
}

#google_button_container div {
  display: flex;
  justify-content: center;
}

#google_button_container button {
  min-width: 200px;
}

/* ============= Logout Button ============= */

.btn-logout {
  background: transparent;
  color: var(--color-gold);
  border: 2px solid var(--color-gold);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Georgia', serif;
}

.btn-logout:hover {
  background: var(--color-gold);
  color: var(--color-navy);
}

/* ============= Main Page Content ============= */

.main-page {
  min-height: 100vh;
}

.user-card {
  text-align: center;
  padding: 2rem;
}

.user-card h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  border: none;
}

.user-card p {
  margin: 0.5rem 0;
  font-size: 1.1rem;
}

/* ============= Members Section & Table ============= */

.members-section {
  padding: 1.5rem;
}

.members-section h3 {
  margin-top: 0;
}

/* ============= Bottles Section ============= */

.bottles-section {
  padding: 1.5rem;
}

.bottles-section h3 {
  margin-top: 0;
  font-size: 1.2rem;
  color: var(--color-gold);
  border-bottom: 2px solid rgba(212, 175, 55, 0.5);
  padding-bottom: 0.5rem;
}

/* ============= Admin Button ============= */

.btn-admin {
  background: linear-gradient(135deg, var(--color-gold) 0%, #c9a227 100%);
  border: none;
  color: var(--color-navy);
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Georgia', serif;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

.btn-admin:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #e6c547 0%, #d4af37 100%);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.btn-admin:active {
  transform: translateY(0);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

table thead {
  background: rgba(212, 175, 55, 0.1);
  border-bottom: 2px solid var(--color-gold);
}

table th {
  color: var(--color-gold);
  padding: 0.7rem 0.8rem;
  text-align: left;
  font-weight: 600;
  letter-spacing: 1px;
  font-size: 0.9rem;
}

table td {
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
  color: #d0d0d0;
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
}

table tbody tr {
  transition: background-color 0.2s ease;
}

table tbody tr:hover {
  background: rgba(212, 175, 55, 0.05);
}

table td strong {
  color: #f0f0f0;
}

/* ============= Admin Panel ============= */

.admin-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.admin-top-row > article {
  margin-bottom: 0;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}

.admin-users-section {
  padding: 1.5rem;
}

.admin-users-section h3 {
  margin-top: 0;
  font-size: 1.2rem;
  color: var(--color-gold);
  border-bottom: 2px solid rgba(212, 175, 55, 0.5);
  padding-bottom: 0.5rem;
}

.admin-form-section {
  padding: 1.5rem;
}

.admin-form-section h3 {
  margin-top: 0;
  font-size: 1.2rem;
  color: var(--color-gold);
  border-bottom: 2px solid rgba(212, 175, 55, 0.5);
  padding-bottom: 0.5rem;
}

.admin-form-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.admin-form-actions button {
  width: auto;
}

.btn-cancel {
  background: transparent !important;
  color: #a0a0a0 !important;
  border: 1px solid #a0a0a0 !important;
}

.btn-cancel:hover {
  color: #e0e0e0 !important;
  border-color: #e0e0e0 !important;
}

.btn-edit,
.btn-delete {
  padding: 0.3rem 0.8rem !important;
  font-size: 0.85rem !important;
  margin: 0 !important;
}

.btn-delete {
  background: transparent !important;
  color: #dc3545 !important;
  border: 1px solid #dc3545 !important;
}

.btn-delete:hover {
  background: #dc3545 !important;
  color: #fff !important;
}

.btn-edit {
  background: transparent !important;
  color: var(--color-gold) !important;
  border: 1px solid var(--color-gold) !important;
}

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

.actions-cell {
  display: flex;
  gap: 0.5rem;
}

.btn-back {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  background: linear-gradient(135deg, var(--color-gold) 0%, #c9a227 100%);
  color: var(--color-navy);
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
  font-family: 'Georgia', serif;
  transition: all 0.3s ease;
}

.btn-back:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.form-error {
  color: #dc3545 !important;
  margin-top: 0.5rem;
}

.form-success {
  color: #28a745 !important;
  margin-top: 0.5rem;
}

/* ============= Pico CSS Overrides ============= */

button, input[type="button"], input[type="reset"], input[type="submit"] {
  background-color: var(--color-gold);
  border-color: var(--color-gold);
  color: var(--color-navy);
  font-family: 'Georgia', serif;
  font-weight: 600;
}

button:hover, 
input[type="button"]:hover, 
input[type="reset"]:hover, 
input[type="submit"]:hover {
  background-color: #e6c547;
  border-color: #e6c547;
}

input, textarea, select {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(212, 175, 55, 0.3);
  color: #e0e0e0;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--color-gold);
  background-color: rgba(212, 175, 55, 0.05);
}

/* ============= Responsive Design ============= */

@media (max-width: 768px) {
  .admin-top-row {
    grid-template-columns: 1fr;
  }

  main.container {
    padding: 1rem 0.5rem;
  }

  article {
    padding: 1.5rem;
  }

  .login-card {
    padding: 2rem 1.5rem;
  }

  .login-card h1 {
    font-size: 2rem;
  }

  .login-card > p {
    font-size: 0.9rem;
  }

  nav {
    padding: 1rem 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
  }

  nav > ul {
    flex: 0 1 auto;
    gap: 1rem;
  }

  nav > ul:last-child {
    justify-content: flex-start;
  }

  nav strong {
    font-size: 1.1rem;
  }

  .countdown-display {
    flex: 0 1 100%;
    order: 2;
  }

  .countdown-time {
    font-size: 1.4rem;
  }

  .user-info-nav {
    text-align: left;
  }

  main.container {
    padding: 1.5rem 1.5rem;
  }

  table {
    font-size: 0.9rem;
  }

  table th, table td {
    padding: 0.7rem 0.5rem;
  }

  .user-card h2 {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .login-card h1 {
    font-size: 1.8rem;
  }

  .btn-signin {
    font-size: 0.9rem;
    padding: 0.65rem 1rem;
  }

  nav {
    padding: 1rem 1rem;
    gap: 0.75rem;
  }

  nav > ul {
    gap: 0.75rem;
  }

  .countdown-time {
    font-size: 1.2rem;
  }

  .countdown-label {
    font-size: 0.8rem;
  }

  .user-info-nav {
    font-size: 0.8rem;
  }

  main.container {
    padding: 1rem 1rem;
  }

  table {
    font-size: 0.85rem;
  }

  table th, table td {
    padding: 0.6rem 0.4rem;
  }
}

/* ============= Search Dropdown ============= */

.search-wrapper {
  position: relative;
  margin-bottom: 1rem;
}

.search-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.search-row input,
.search-row button {
  margin-bottom: 0 !important;
}

.search-input {
  flex: 1;
}

.btn-search {
  white-space: nowrap;
  padding: 0.5rem 1rem;
  width: auto;
  font-size: 0.85rem;
}

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(26, 42, 58, 0.98);
  border: 1px solid var(--color-gold);
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 400px;
  overflow-y: auto;
}

.search-dropdown::-webkit-scrollbar {
  width: 8px;
}

.search-dropdown::-webkit-scrollbar-track {
  background: rgba(26, 42, 58, 0.5);
}

.search-dropdown::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.4);
  border-radius: 4px;
}

.search-dropdown::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 175, 55, 0.6);
}

.search-result {
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
  transition: background 0.15s ease;
}

.search-result:last-child {
  border-bottom: none;
}

.search-result:hover {
  background: rgba(212, 175, 55, 0.15);
}

.search-result strong {
  display: block;
  color: #f0f0f0;
  font-size: 0.9rem;
}

.search-result-details {
  display: block;
  font-size: 0.8rem;
  color: #a0a0a0;
  margin-top: 0.15rem;
}

.search-hint {
  padding: 0.5rem 0.8rem;
  font-size: 0.8rem;
  color: #a0a0a0;
  font-style: italic;
  text-align: center;
  border-top: 1px solid rgba(212, 175, 55, 0.15);
}
