/* Group Wholesale Platform - Main Styles */

/* CSS Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f8fafc;
}

/* Layout Components */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Navigation */
.navbar {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem 0;
  /* position: sticky; */
  top: 0;
  z-index: 100;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  font-size: 1.25rem;
  font-weight: 600;
  color: #2563eb;
}

.nav-links {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.nav-links a {
  text-decoration: none;
  color: #64748b;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: #2563eb;
  background-color: #eff6ff;
}

.nav-links a.email:hover, .nav-links a.email:active, .nav-links a.email {
  transition: none;
  color: #64748b;
  background-color: transparent;
}

@media screen and (max-width: 500px) {
  .nav-links a.guest {
    padding: 0px;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  background: none;
}

.btn-primary {
  background-color: #2563eb;
  color: white;
  border-color: #2563eb;
}

.btn-primary:hover {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
}

.btn-outline {
  color: #2563eb;
  border-color: #2563eb;
}

.btn-outline:not(.lighthover):hover {
  background-color: #2563eb;
  color: white;
}

.btn-outline.lighthover:hover {
  background-color: #f4fcff;
}

.btn-danger {
  background-color: rgb(220, 159, 38);
  color: white;
  border-color: rgb(220, 159, 38);;
}

.btn-danger:hover {
  background-color: rgb(208, 150, 36);
  border-color: rgb(208, 150, 36);
}

.btn-purple {
  background: #a425eb;
  border-color: #a425eb;
  color: white;
}
.btn-purple:hover {
  background:rgb(157, 26, 233);
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.btn-large {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.btn-warning {
  background-color: #f59e0b;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.2s;
}

.btn-warning:hover {
  background-color: #d97706;
}

/* Forms */
.form-card {
  background: white;
  border-radius: 0.5rem;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-group {
  margin-bottom: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #374151;
}

input, textarea, select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* Page Layout */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 2rem 0;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #1f2937;
}

.page-actions {
  display: flex;
  gap: 1rem;
}

/* Cards and Grids */
.clubs-grid, .items-grid, .orders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.club-card, .item-card, .order-card {
  background: white;
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  transition: box-shadow 0.2s;
}

.club-card:hover, .item-card:hover, .order-card:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.club-header, .item-header, .order-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.club-header h3, .item-header h4, .order-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1f2937;
}

/* Status Badges */
.club-role, .club-policy, .item-status, .order-status {
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

.club-role.admin {
  background-color: #fef3c7;
  color: #92400e;
}

.club-role.member {
  background-color: #dbeafe;
  color: #1e40af;
}

.item-status.active, .status-active {
  background-color: #d1fae5;
  color: #065f46;
}

.item-status.inactive, .status-pending_approval {
  background-color: #fef3c7;
  color: #92400e;
}

.status-open {
  background-color: #dbeafe;
  color: #1e40af;
}

.status-locked, .status-placed {
  background-color: #fef3c7;
  color: #92400e;
}

.status-completed {
  background-color: #d1fae5;
  color: #065f46;
}

.status-cancelled, .status-revoked {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Authentication Forms */
.auth-form {
  max-width: 400px;
  margin: 2rem auto;
  background: white;
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.auth-form h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #1f2937;
}

.auth-link {
  text-align: center;
  margin-top: 1rem;
  color: #6b7280;
}

.auth-link a {
  color: #2563eb;
  text-decoration: none;
}

.auth-link a:hover {
  text-decoration: underline;
}

/* Messages */
.success-message, .error-message, .info-message {
  padding: 1rem;
  border-radius: 0.375rem;
  margin: 1rem 0;
}

.success-message {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.error-message {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.info-message {
  background-color: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #6b7280;
}

.empty-state h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: #374151;
}

.empty-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* Distributor Cards */
.distributors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.distributor-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s;
}

.distributor-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.distributor-card .card-header {
  margin-bottom: 1rem;
}

.distributor-card .card-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.distributor-card .card-header h3 a {
  color: #1f2937;
  text-decoration: none;
}

.distributor-card .card-header h3 a:hover {
  color: #3b82f6;
}

.distributor-card .card-body {
  margin-bottom: 1.5rem;
}

.distributor-card .card-body p {
  margin: 0.5rem 0;
  font-size: 0.875rem;
  color: #6b7280;
}

.distributor-card .card-body strong {
  color: #374151;
}

.distributor-card .card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.distributor-card .card-actions .btn {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
}

/* Loading States */
.loading {
  text-align: center;
  padding: 2rem;
  color: #6b7280;
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: inline;
}

.htmx-request .htmx-not-indicator {
  display: none;
}

/* Quantity Controls */
.quantity-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quantity-input {
  width: 80px;
  text-align: center;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal:empty {
  display: none;
}

.modal-content {
  background: white;
  border-radius: 0.5rem;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.5rem 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
}

.modal-form {
  padding: 1.5rem;
}

/* Landing Page */
.landing-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.landing-header {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem 0;
}

.landing-main {
  flex: 1;
}

.hero {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 4rem 0;
  text-align: center;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.25rem;
  margin-bottom: 2rem;
  opacity: 0.9;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.features {
  padding: 4rem 0;
  background: white;
}

.features h2 {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 3rem;
  color: #1f2937;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

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

.feature-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: #1f2937;
}

.cta {
  background: #f8fafc;
  padding: 4rem 0;
  text-align: center;
}

.cta h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: #1f2937;
}

.landing-footer {
  background: #1f2937;
  color: white;
  padding: 2rem 0;
  text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .page-actions {
    width: 100%;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .nav-links {
    flex-wrap: wrap;
  }
}
