/*
 * 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 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background-color: #ffffff;
  color: #333;
}

/* Page container */
.page-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0 40px;
  flex-wrap: wrap;
}

.logo {
  flex: 0 0 auto;
}

.logo-image {
  height: 180px;
  width: auto;
}

/* Navigation */
.main-nav {
  display: flex;
  gap: 30px;
  align-items: center;
  flex-wrap: wrap;
}

.nav-link {
  color: #999;
  text-decoration: none;
  font-size: 18px;
  font-weight: 400;
  transition: color 0.3s ease;
}

.nav-link:hover {
  color: #5bbfce;
}

.btn-logout {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}

/* Search */
.search-container {
  max-width: 600px;
  margin: 30px auto 20px;
}

.search-form {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 300px;
}

.search-input {
  width: 100%;
  padding: 12px 50px 12px 20px;
  border: 2px solid #ddd;
  border-radius: 25px;
  font-size: 16px;
  transition: all 0.3s ease;
  background-color: white;
}

.search-input:focus {
  outline: none;
  border-color: #5bbfce;
  box-shadow: 0 0 0 3px rgba(91, 191, 206, 0.1);
}

.search-button {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background-color: #5bbfce;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.search-button:hover {
  background-color: #4aa9b8;
}

.search-button svg {
  display: block;
}

.clear-search {
  color: #999;
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.clear-search:hover {
  color: #5bbfce;
  text-decoration: underline;
}

.search-results-header {
  max-width: 1400px;
  margin: 0 auto 20px;
  padding: 15px 20px;
  background-color: #f8f9fa;
  border-left: 4px solid #5bbfce;
  border-radius: 4px;
}

.search-results-header p {
  margin: 0;
  color: #333;
  font-size: 16px;
}

.search-results-header strong {
  color: #5bbfce;
}

/* Product Gallery */
.product-gallery {
  margin-top: 40px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.gallery-item:focus {
  outline: 3px solid #5bbfce;
  outline-offset: 2px;
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
}

.product-info {
  padding: 15px;
  background: white;
}

.product-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0 0 8px 0;
}

.product-price {
  font-size: 20px;
  font-weight: 700;
  color: #5bbfce;
  margin: 0;
}

.empty-gallery {
  text-align: center;
  padding: 60px 20px;
}

.empty-gallery p {
  font-size: 18px;
  color: #666;
  margin-bottom: 20px;
}

.empty-category {
  text-align: center;
  padding: 60px 20px;
}

.empty-category p {
  font-size: 18px;
  color: #666;
  margin-bottom: 20px;
}

.category-cell {
  text-transform: capitalize;
  color: #5bbfce;
  font-weight: 500;
}

/* Content section */
.content-section {
  margin-top: 40px;
  padding: 40px 0;
}

.content-section h1 {
  font-size: 36px;
  color: #333;
  margin-bottom: 20px;
}

.content-section p {
  font-size: 18px;
  color: #666;
  line-height: 1.6;
}

/* Responsive design */
@media (max-width: 1200px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  .logo-image {
    height: 120px;
  }

  .main-nav {
    gap: 15px;
    font-size: 16px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
}

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

  .main-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* Admin CMS Styles */
.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 15px;
  padding-bottom: 0;
  border-bottom: none;
}

.admin-header > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-header h1 {
  font-size: 32px;
  color: #333;
  margin: 0;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
}

.btn-primary {
  background-color: #5bbfce;
  color: white;
}

.btn-primary:hover {
  background-color: #4aa9b8;
}

.btn-secondary {
  background-color: #999;
  color: white;
}

.btn-secondary:hover {
  background-color: #777;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  display: inline-block;
  text-align: center;
  vertical-align: middle;
}

.btn-edit {
  background-color: #5bbfce;
  color: white;
  text-decoration: none;
}

.btn-edit:hover {
  background-color: #4aa9b8;
  color: white;
}

.btn-delete {
  background-color: #e74c3c;
  color: white;
  display: inline-block;
  vertical-align: middle;
}

.btn-delete:hover {
  background-color: #c0392b;
  color: white;
}

/* Alerts */
.alert {
  padding: 15px 20px;
  border-radius: 4px;
  margin-bottom: 20px;
}

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

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

.filter-form {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 200px;
}

.filter-group label {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.filter-select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  background-color: white;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

.filter-select:focus {
  outline: none;
  border-color: #5bbfce;
}

.filter-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Products Table */
.products-table {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

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

.products-table thead {
  background-color: #f8f9fa;
}

.products-table th {
  padding: 15px;
  text-align: left;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #dee2e6;
}

.products-table td {
  padding: 15px;
  border-bottom: 1px solid #dee2e6;
  vertical-align: middle;
}

.products-table tr:hover {
  background-color: #f8f9fa;
}

.product-image-cell {
  width: 120px;
}

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

.no-image {
  width: 80px;
  height: 80px;
  background-color: #f0f0f0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #999;
}

.description-cell {
  max-width: 300px;
}

.tags-cell {
  max-width: 200px;
}

.tag-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-badge {
  display: inline-block;
  padding: 4px 10px;
  background-color: #5bbfce;
  color: white;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.no-tags {
  color: #999;
  font-style: italic;
  font-size: 14px;
}

.price-cell {
  font-weight: 600;
  color: #333;
}

.actions-cell {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.products-table td.actions-cell {
  border-bottom: none;
}

.actions-cell form {
  margin: 0;
  display: inline-block;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 16px;
}

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

.product-form {
  margin: 0;
}

.form-group {
  margin-bottom: 25px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.3s ease;
}

.form-control:focus {
  outline: none;
  border-color: #5bbfce;
}

textarea.form-control {
  resize: vertical;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 35px;
}

.form-text {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: #666;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background-color: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #5bbfce;
}

.checkbox-item label {
  margin: 0;
  font-weight: 400;
  cursor: pointer;
  user-select: none;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 30px;
}

/* Error Messages */
.error-messages {
  background-color: #f8d7da;
  color: #721c24;
  padding: 15px 20px;
  border-radius: 4px;
  margin-bottom: 25px;
  border: 1px solid #f5c6cb;
}

.error-messages h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.error-messages ul {
  margin: 0;
  padding-left: 20px;
}

.error-messages li {
  margin-bottom: 5px;
}

/* Current Image Preview */
.current-image {
  margin-bottom: 15px;
}

.preview-image {
  display: block;
  border-radius: 4px;
  border: 2px solid #ddd;
  margin-bottom: 10px;
}

/* Category Management */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.category-card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.category-info h3 {
  font-size: 20px;
  color: #333;
  margin-bottom: 10px;
}

.category-slug {
  font-size: 14px;
  color: #999;
  font-family: monospace;
  margin-bottom: 8px;
}

.category-count {
  font-size: 14px;
  color: #666;
  margin-bottom: 15px;
}

.category-actions {
  display: flex;
  gap: 8px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #eee;
}

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

/* Authentication Pages */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.auth-card {
  background: white;
  border-radius: 12px;
  padding: 40px;
  max-width: 450px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-logo {
  height: 80px;
  width: auto;
  margin-bottom: 20px;
}

.auth-header h1 {
  font-size: 28px;
  color: #333;
  margin-bottom: 10px;
}

.auth-header p {
  color: #666;
  font-size: 14px;
}

.auth-form {
  margin-bottom: 20px;
}

.auth-form .form-group {
  margin-bottom: 20px;
}

.btn-block {
  width: 100%;
  padding: 12px;
  font-size: 16px;
}

.auth-footer {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.auth-footer p {
  margin: 0;
  color: #666;
  font-size: 14px;
}

.auth-link {
  color: #5bbfce;
  text-decoration: none;
  font-weight: 500;
}

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

/* User badge */
.badge-current {
  display: inline-block;
  padding: 2px 8px;
  background-color: #5bbfce;
  color: white;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
  margin-left: 8px;
}

/* ========================================
   TRIX EDITOR STYLES
   ======================================== */

/* Trix Toolbar */
trix-toolbar {
  background-color: #f8f9fa;
  border: 1px solid #ddd;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  padding: 10px;
}

trix-editor {
  min-height: 200px;
  max-height: 500px;
  overflow-y: auto;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 0 0 4px 4px;
  background-color: white;
}

trix-editor:focus {
  outline: none;
  border-color: #5bbfce;
}

/* Trix content styling */
trix-editor h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 10px;
}

trix-editor ul,
trix-editor ol {
  padding-left: 20px;
  margin-bottom: 10px;
}

trix-editor a {
  color: #5bbfce;
  text-decoration: underline;
}

trix-editor blockquote {
  border-left: 4px solid #5bbfce;
  padding-left: 15px;
  margin: 15px 0;
  color: #666;
}

/* ========================================
   PRODUCT MODAL STYLES
   ======================================== */

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

/* Modal Container */
.modal-container {
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  background: white;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal-overlay.is-visible .modal-container {
  transform: scale(1);
}

/* Modal Content */
.modal-content {
  position: relative;
}

.modal-body {
  padding: 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

/* Close Button */
.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.modal-close:hover {
  background: #f8f9fa;
  transform: rotate(90deg);
}

.modal-close svg {
  color: #333;
}

/* Modal Image */
.modal-image {
  width: 100%;
}

.modal-image img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

/* Modal Info */
.modal-info {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-title {
  font-size: 32px;
  font-weight: 600;
  color: #333;
  margin: 0;
  line-height: 1.2;
}

.modal-meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-category {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.category-link {
  color: #5bbfce;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

.category-link:hover {
  color: #4aa9b8;
  text-decoration: underline;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-price {
  font-size: 36px;
  font-weight: 700;
  color: #5bbfce;
  margin: 0;
}

.modal-description {
  font-size: 16px;
  line-height: 1.6;
  color: #666;
}

/* Rich text content in modal */
.modal-description h1,
.modal-description h2,
.modal-description h3 {
  color: #333;
  margin-bottom: 10px;
  line-height: 1.3;
}

.modal-description h1 {
  font-size: 24px;
}

.modal-description h2 {
  font-size: 20px;
}

.modal-description h3 {
  font-size: 18px;
}

.modal-description p {
  margin-bottom: 15px;
}

.modal-description ul,
.modal-description ol {
  margin-bottom: 15px;
  padding-left: 25px;
}

.modal-description li {
  margin-bottom: 5px;
}

.modal-description a {
  color: #5bbfce;
  text-decoration: underline;
}

.modal-description a:hover {
  color: #4aa9b8;
}

.modal-description blockquote {
  border-left: 4px solid #5bbfce;
  padding-left: 20px;
  margin: 20px 0;
  font-style: italic;
  color: #666;
}

.modal-description strong {
  font-weight: 600;
  color: #333;
}

.modal-description em {
  font-style: italic;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .modal-body {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 30px 20px;
  }

  .modal-title {
    font-size: 24px;
  }

  .modal-price {
    font-size: 28px;
  }

  .modal-close {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
  }

  .modal-container {
    max-height: 95vh;
  }
}

@media (max-width: 480px) {
  .modal-overlay {
    padding: 10px;
  }

  .modal-body {
    padding: 20px 15px;
    gap: 20px;
  }

  .modal-title {
    font-size: 20px;
  }

  .modal-description {
    font-size: 14px;
  }
}
