/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* Navigation */
.navbar {
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  padding: 1rem 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: relative;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: bold;
  color: #007bff;
  text-decoration: none;
  z-index: 1001;
}

.nav-brand:hover {
  color: #0056b3;
}

/* Mobile hamburger button */
.nav-toggle {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
}

.hamburger-line {
  width: 25px;
  height: 3px;
  background-color: #333;
  margin: 3px 0;
  transition: 0.3s;
  border-radius: 2px;
}

.nav-toggle.active .hamburger-line:nth-child(1) {
  transform: rotate(-45deg) translate(-5px, 6px);
}

.nav-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active .hamburger-line:nth-child(3) {
  transform: rotate(45deg) translate(-5px, -6px);
}

/* Navigation menu */
.nav-menu {
  display: flex;
}

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

.nav-link {
  color: #6c757d;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.nav-link:hover {
  color: #007bff;
  background-color: #f8f9fa;
}

.nav-link-primary {
  background-color: #007bff;
  color: white !important;
}

.nav-link-primary:hover {
  background-color: #0056b3;
  color: white !important;
}

.nav-link-secondary {
  background-color: #6c757d;
  color: white !important;
}

.nav-link-secondary:hover {
  background-color: #545b62;
  color: white !important;
}

.nav-link-admin {
  background-color: #dc3545;
  color: white !important;
}

.nav-link-admin:hover {
  background-color: #c82333;
  color: white !important;
}

/* Authentication navigation */
.nav-user, .nav-auth {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 1px solid #dee2e6;
}

.nav-user-email {
  color: #495057;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Main content */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Alerts */
.alert {
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 0.25rem;
  border: 1px solid transparent;
}

.alert-success {
  color: #155724;
  background-color: #d4edda;
  border-color: #c3e6cb;
}

.alert-error {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
}

/* Forms */
.form-container {
  background: white;
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  max-width: 600px;
  margin: 0 auto;
}

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

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

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  font-size: 1rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
  outline: 0;
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
  appearance: none;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  margin-bottom: 0;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 0.25rem;
  transition: all 0.15s ease-in-out;
}

.btn-primary {
  color: #fff;
  background-color: #007bff;
  border-color: #007bff;
}

.btn-primary:hover {
  color: #fff;
  background-color: #0056b3;
  border-color: #004085;
}

.btn-secondary {
  color: #6c757d;
  background-color: #fff;
  border-color: #6c757d;
}

.btn-secondary:hover {
  color: #fff;
  background-color: #6c757d;
}

.btn-success {
  color: #fff;
  background-color: #28a745;
  border-color: #28a745;
}

.btn-success:hover {
  color: #fff;
  background-color: #218838;
  border-color: #1e7e34;
}

.btn-warning {
  color: #212529;
  background-color: #ffc107;
  border-color: #ffc107;
}

.btn-warning:hover {
  color: #212529;
  background-color: #e0a800;
  border-color: #d39e00;
}

.btn-danger {
  color: #fff;
  background-color: #dc3545;
  border-color: #dc3545;
}

.btn-danger:hover {
  color: #fff;
  background-color: #c82333;
  border-color: #bd2130;
}

.btn-outline {
  color: #6c757d;
  background-color: transparent;
  border-color: #6c757d;
}

.btn-outline:hover {
  color: #fff;
  background-color: #6c757d;
  border-color: #6c757d;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  border-radius: 0.25rem;
}

/* Error messages */
.field_with_errors {
  display: contents;
}

.field_with_errors .form-control {
  border-color: #dc3545;
}

.error-messages {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
  padding: 1rem;
  border-radius: 0.375rem;
  margin-bottom: 1.5rem;
}

.error-messages h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 600;
}

.error-messages ul {
  margin: 0;
  padding-left: 1.25rem;
}

.error-messages li {
  margin-bottom: 0.25rem;
}

/* File upload */
.file-upload {
  position: relative;
  display: inline-block;
  cursor: pointer;
  width: 100%;
}

.file-upload input[type=file] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.file-upload-label {
  display: block;
  padding: 2rem;
  border: 2px dashed #ced4da;
  border-radius: 0.5rem;
  background: #f8f9fa;
  text-align: center;
  color: #6c757d;
  cursor: pointer;
  transition: all 0.2s;
}

.file-upload-text {
  color: #6c757d;
}

.file-upload:hover .file-upload-label,
.file-upload-label.has-file {
  border-color: #007bff;
  background: #e3f2fd;
}

.file-upload-label.has-file .file-upload-text {
  color: #007bff;
}

/* Page headers */
.page-header {
  margin-bottom: 2rem;
  text-align: center;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header .header-content {
  flex: 1;
  text-align: left;
}

.page-header .header-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 300;
  color: #495057;
  margin-bottom: 0.5rem;
}

.page-subtitle {
  font-size: 1.1rem;
  color: #6c757d;
}

/* Filter section */
.filter-section {
  background: white;
  padding: 1.5rem;
  margin-bottom: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.filter-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.filter-label {
  font-weight: 500;
  color: #495057;
  white-space: nowrap;
}

.filter-select {
  padding: 0.5rem 1rem;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  background-color: white;
  font-size: 1rem;
  min-width: 200px;
}

.filter-select:focus {
  outline: 0;
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Zines container */
.zines-container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Updated zine grid for thumbnails */
.zines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

/* Zine card styling */
.zine-card {
  background: white;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.zine-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.zine-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.zine-thumbnail {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.thumbnail-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}

.zine-card:hover .thumbnail-image {
  transform: scale(1.05);
}

.zine-info {
  padding: 1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.zine-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #333;
  line-height: 1.3;
}

.zine-creator {
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 0.5rem;
  font-style: italic;
}

.zine-meta {
  font-size: 0.875rem;
  color: #888;
  margin-top: auto;
}

.zine-category {
  display: inline-block;
  background: #e3f2fd;
  color: #1976d2;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.category-badge {
  display: inline-block;
  background: #e3f2fd;
  color: #1976d2;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.zine-link {
  color: #007bff;
  text-decoration: none;
  font-weight: 500;
}

.zine-link:hover {
  text-decoration: underline;
}

.zine-date {
  color: #999;
}

.zine-description {
  font-size: 0.875rem;
  color: #666;
  margin: 0.5rem 0 0 0;
  line-height: 1.4;
}

.zine-unavailable {
  color: #dc3545;
  font-style: italic;
}

.unavailable-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}

.unavailable-text {
  color: white;
  font-weight: 600;
  text-align: center;
  padding: 0.5rem;
}

/* Infinite scroll loading */
.load-more-trigger {
  margin: 3rem 0;
  text-align: center;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-spinner p {
  margin: 0;
  color: #6c757d;
  font-size: 0.875rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #6c757d;
}

.empty-state h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: #495057;
}

.empty-state p {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.empty-state .btn {
  margin: 0.25rem;
}

/* Tables */
.table {
  width: 100%;
  margin-bottom: 1rem;
  background-color: transparent;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.75rem;
  vertical-align: top;
  border-bottom: 1px solid #dee2e6;
}

.table th {
  font-weight: 600;
  color: #495057;
  background-color: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
}

.table-thumbnail {
  width: 60px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.pending {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.status-badge.approved {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

/* Dashboard specific styles */
.dashboard-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  text-align: center;
  min-width: 150px;
  flex: 1;
}

.stat-card h3 {
  font-size: 2rem;
  color: #007bff;
  margin-bottom: 0.5rem;
}

.stat-card p {
  color: #6c757d;
  margin: 0;
}

.dashboard-actions {
  margin-bottom: 2rem;
}

.dashboard-actions .btn {
  margin-right: 1rem;
}

.zines-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.zines-header h2 {
  color: #495057;
  margin: 0;
}

.view-toggle {
  display: flex;
  gap: 0.5rem;
}

.view-btn {
  padding: 0.5rem 1rem;
  border: 1px solid #dee2e6;
  background: white;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.view-btn.active,
.view-btn:hover {
  background: #007bff;
  color: white;
  border-color: #007bff;
}

.user-zines {
  margin-bottom: 2rem;
}

.zines-table {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  overflow: hidden;
  overflow-x: auto;
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Admin specific styles */
.admin-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card.pending {
  border-left: 4px solid #ffc107;
}

.stat-card.approved {
  border-left: 4px solid #28a745;
}

.stat-card.total {
  border-left: 4px solid #007bff;
}

.stat-card.pending h3 {
  color: #ffc107;
}

.stat-card.approved h3 {
  color: #28a745;
}

.stat-card.total h3 {
  color: #007bff;
}

.admin-content h2 {
  color: #495057;
  margin-bottom: 1.5rem;
}

.admin-table {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  overflow: hidden;
  overflow-x: auto;
}

.admin-table .table {
  margin: 0;
  min-width: 800px;
}

.admin-table .table th,
.admin-table .table td {
  padding: 1rem;
  white-space: nowrap;
}

.pending-row {
  background-color: #fff9e6;
}

.admin-thumbnail {
  width: 60px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
}

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

/* Zine detail page specific styles */
.zine-content {
  margin-bottom: 2rem;
}

.zine-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pdf-viewer {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  padding: 1rem;
  margin-bottom: 2rem;
}

.pdf-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  justify-content: center;
}

.pdf-embed {
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  overflow: hidden;
}

.pdf-embed iframe {
  border: none;
  display: block;
}

.zine-actions {
  text-align: center;
  margin-top: 2rem;
}

/* Edit page specific styles */
.current-file {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 0.5rem;
  margin-bottom: 2rem;
}

.current-file h4 {
  margin-bottom: 1rem;
  color: #495057;
}

.file-info {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.file-thumbnail img {
  max-width: 150px;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.file-details {
  flex: 1;
}

.file-details p {
  margin-bottom: 0.5rem;
}

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

/* Pagination */
.pagination-container {
  margin-top: 2rem;
  text-align: center;
}

/* Auth forms */
.auth-links {
  margin-top: 2rem;
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid #dee2e6;
}

.auth-links a {
  color: #007bff;
  text-decoration: none;
  margin: 0 0.5rem;
  font-weight: 500;
}

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

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-check-input {
  margin: 0;
}

.form-check-label {
  margin: 0;
  cursor: pointer;
}

.text-muted {
  color: #6c757d !important;
}

.form-text {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: #6c757d;
}

/* Media queries */
@media (max-width: 1024px) {
  /* Mobile navigation */
  .nav-toggle {
    display: flex;
  }

  .nav-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100vh;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: left 0.3s ease;
    z-index: 1000;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  }

  .nav-menu.active {
    left: 0;
  }

  /* Prevent body scroll when mobile menu is open */
  body.nav-open {
    overflow: hidden;
  }

  .nav-links {
    flex-direction: column;
    gap: 2rem;
    text-align: center;
  }

  .nav-user, .nav-auth {
    flex-direction: column;
    gap: 1rem;
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    padding-top: 0;
    border-top: none;
  }

  .nav-user-email {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #495057;
    font-weight: 600;
  }

  .nav-link {
    font-size: 1.2rem;
    padding: 1rem 2rem;
  }

  /* Other mobile styles */
  .filter-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .filter-select {
    width: 100%;
  }

  .zines-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
  }

  .zine-info {
    padding: 0.75rem;
  }

  .main-content {
    padding: 1rem;
  }

  .page-header {
    text-align: center;
    flex-direction: column;
  }

  .page-header .header-content {
    text-align: center;
  }

  .dashboard-stats {
    flex-direction: column;
  }

  .pdf-controls {
    flex-direction: column;
    align-items: center;
  }

  .pdf-embed iframe {
    height: 600px;
  }

  .file-info {
    flex-direction: column;
  }

  .file-thumbnail img {
    max-width: 100%;
  }

  .admin-stats {
    flex-direction: column;
  }

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

  .action-buttons {
    justify-content: center;
  }

  .admin-actions {
    justify-content: center;
  }

  .admin-table .table th,
  .admin-table .table td {
    padding: 0.5rem;
    font-size: 0.875rem;
  }
}
