/* Pizza Reviews PWA Styles */

/* CSS Variables for Consistent Theming */
:root {
  --primary-color: #e74c3c;
  --primary-dark: #c0392b;
  --secondary-color: #34495e;
  --accent-color: #f39c12;
  --background-color: #f9f7f2;
  --text-color: #2c3e50;
  --text-light: #7f8c8d;
  --white: #ffffff;
  --light-gray: #ecf0f1;
  --border-color: #ddd;
  --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.15);
  --border-radius: 8px;
  --font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
}

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

body {
  font-family: var(--font-family);
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
}

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

.hidden {
  display: none !important;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin-bottom: 0.5rem;
  font-weight: 600;
  line-height: 1.2;
}

h1 {
  font-size: 2.5rem;
}
h2 {
  font-size: 2rem;
}
h3 {
  font-size: 1.75rem;
}
h4 {
  font-size: 1.5rem;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--primary-dark);
}

/* Header */
.header {
  background: var(--white);
  box-shadow: var(--shadow-light);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
}

.logo a {
  color: inherit;
}

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

.nav-link {
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  transition: all 0.3s ease;
}

.nav-link:hover {
  background-color: var(--light-gray);
}

.nav-link.active {
  background-color: var(--primary-color);
  color: var(--white);
}

.auth-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-weight: 500;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--border-radius);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  background: transparent;
}

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

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

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

.btn-secondary:hover {
  background-color: #2c3e50;
  color: var(--white);
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Main Content */
.main {
  min-height: calc(100vh - 200px);
  padding: 2rem 0;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 3rem 0;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--accent-color)
  );
  color: var(--white);
  margin-bottom: 3rem;
  border-radius: var(--border-radius);
}

.hero h2 {
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  opacity: 0.9;
}

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

/* Search Section */
.search-section {
  margin-bottom: 2rem;
}

.search-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.search-bar input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
}

.filters {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.filters label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

/* Reviews Grid */
.reviews-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.review-card {
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-light);
  overflow: hidden;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.review-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.review-header {
  padding: 1rem;
  border-bottom: 1px solid var(--light-gray);
}

.review-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.review-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-light);
}

.review-rating {
  font-size: 1.1rem;
}

.review-content {
  padding: 1rem;
}

.review-text {
  margin-bottom: 1rem;
  line-height: 1.5;
}

.review-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
  margin-top: 1rem;
}

.review-image {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 4px;
}

.review-footer {
  padding: 1rem;
  border-top: 1px solid var(--light-gray);
  background: var(--light-gray);
}

.review-author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.author-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

/* Loading and Error States */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-light);
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 0.5rem;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

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

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-family: inherit;
  font-size: 1rem;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

.help-text {
  display: block;
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* Star Rating */
.star-rating {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 0.2rem;
}

.star-rating input {
  display: none;
}

.star-rating label {
  font-size: 2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: 0.3;
}

.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label {
  opacity: 1;
}

.rating-input {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.rating-text {
  font-size: 0.9rem;
  color: var(--text-light);
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type='checkbox'] {
  width: auto;
  margin: 0;
}

/* Submit Page */
.submit-page {
  max-width: 600px;
  margin: 0 auto;
}

.submit-form-container {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-light);
}

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

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--light-gray);
}

.image-preview {
  margin-top: 0.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.5rem;
}

.preview-image {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

/* Message Boxes */
.message-box {
  padding: 1.5rem;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
}

.message-box.success {
  background-color: #d5f4e6;
  border: 1px solid #27ae60;
  color: #27ae60;
}

.message-box.warning {
  background-color: #fdf2e9;
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
}

.message-box.error {
  background-color: #fdf2f2;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
}

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

/* Footer */
.footer {
  background: var(--secondary-color);
  color: var(--white);
  text-align: center;
  padding: 2rem 0;
  margin-top: 3rem;
}

.footer-links {
  margin-top: 1rem;
}

.footer-links a {
  color: var(--white);
  margin: 0 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 0.5rem;
  }

  .header .container {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 0.5rem;
  }

  .nav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .hero {
    padding: 2rem 1rem;
    margin-bottom: 2rem;
  }

  .hero h2 {
    font-size: 1.5rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .search-bar {
    flex-direction: column;
  }

  .reviews-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .filters {
    flex-direction: column;
    gap: 0.5rem;
  }

  .form-actions {
    flex-direction: column;
  }

  .result-actions {
    flex-direction: column;
  }

  .pagination {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 2rem;
  }
  h2 {
    font-size: 1.5rem;
  }

  .btn {
    padding: 0.5rem 1rem;
  }

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

  .submit-form-container {
    padding: 1rem;
  }
}

/* Auth-dependent visibility */
[data-auth-required] {
  display: block;
}

[data-auth-required-inverse] {
  display: none;
}

.auth-disabled [data-auth-required] {
  display: none;
}

.auth-disabled [data-auth-required-inverse] {
  display: block;
}
