
:root {
  --background-color: #121212;
  --surface-color: #1e1e1e;
  --primary-text-color: #e0e0e0;
  --secondary-text-color: #a0a0a0;
  --accent-color: #3A7DFF;
  --accent-hover-color: #5a9bff;
  --border-color: #333;
  --shadow-color: rgba(0, 0, 0, 0.2);
  --error-color: #cf6679;
  --success-color: #33FF57;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  color: var(--primary-text-color);
  line-height: 1.6;
}

#root {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

/* Header */
.header {
  padding: 1.5rem 0;
  background-color: rgba(18, 18, 18, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border-color);
}

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

.logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-text-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.language-switcher select {
  background-color: var(--surface-color);
  color: var(--primary-text-color);
  border: 1px solid var(--border-color);
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23a0a0a0' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 2rem;
}


.header-main-btn {
  background-color: var(--surface-color);
  color: var(--primary-text-color);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
}

.header-main-btn:hover {
  background-color: var(--accent-color);
  color: #fff;
}

.header-main-btn.active {
    background-color: var(--accent-color);
    color: #fff;
}

/* Main Content */
.main {
  flex-grow: 1;
  padding: 4rem 0;
}

#background-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-color: var(--background-color);
}

/* Hero Section */
.hero {
  text-align: center;
  margin-bottom: 5rem;
}

.hero h1 {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  background: linear-gradient(90deg, #fff, #a0a0a0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.25rem;
  color: var(--secondary-text-color);
  max-width: 600px;
  margin: 0 auto;
}

/* Products Section */
.products-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.products-header h2 {
  font-size: 2.5rem;
}

.add-product-btn {
  background-color: var(--accent-color);
  color: #fff;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: background-color 0.3s;
}

.add-product-btn:hover {
  background-color: var(--accent-hover-color);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

.product-card {
  background-color: var(--surface-color);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: transform 0.3s, box-shadow 0.3s, opacity 0.3s;
  display: flex;
  flex-direction: column;
  position: relative;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px var(--shadow-color);
}

.product-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-snapshot-wrapper {
    position: relative;
}

.product-snapshot {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #333;
  object-fit: cover;
  border-bottom: 1px solid var(--border-color);
}

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

.product-info h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--primary-text-color);
}

.product-info p {
  color: var(--secondary-text-color);
  flex-grow: 1;
}

.product-card-actions {
  padding: 0 1.5rem 1.5rem;
  display: flex;
  gap: 0.5rem;
}

.card-btn {
  flex: 1;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background-color: transparent;
  color: var(--secondary-text-color);
  transition: all 0.2s ease-in-out;
}
.card-btn.edit {
    border-color: var(--accent-color);
    color: var(--accent-color);
}
.card-btn.edit:hover {
    background-color: var(--accent-color);
    color: #fff;
}
.card-btn.delete {
    border-color: var(--error-color);
    color: var(--error-color);
}
.card-btn.delete:hover {
    background-color: var(--error-color);
    color: #fff;
}

/* Admin Feature Styles: Drag-drop & Hidden */
.product-card[draggable] {
    cursor: grab;
}
.product-card.dragging {
    opacity: 0.4 !important; /* important to override other opacity settings */
    cursor: grabbing;
    box-shadow: 0 15px 30px var(--shadow-color);
    border-color: var(--accent-color);
}
.product-card.drag-over {
    box-shadow: 0 0 0 2px var(--accent-color), 0 10px 20px var(--shadow-color);
}

.product-card.hidden-product {
    opacity: 0.6;
}

.hidden-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 18, 18, 0.7);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 700;
    z-index: 1;
    pointer-events: none;
    backdrop-filter: blur(2px);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  z-index: 1000;
  backdrop-filter: blur(5px);
  overflow-y: auto;
  padding: 2rem;
}

.modal-content {
  background: var(--surface-color);
  padding: 2rem;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 30px var(--shadow-color);
  display: flex;
  flex-direction: column;
}

.info-modal-content {
    max-height: calc(100vh - 4rem);
}

.modal-content h2 {
  margin-bottom: 1.5rem;
  flex-shrink: 0;
}

.info-modal-body {
    overflow-y: auto;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.info-modal-body p {
    margin-bottom: 1rem;
    color: var(--secondary-text-color);
}

.info-modal-body p:last-child {
    margin-bottom: 0;
}


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

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--secondary-text-color);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  background-color: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--primary-text-color);
  font-size: 1rem;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.language-fieldset {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}
.language-fieldset legend {
    padding: 0 0.5rem;
    color: var(--secondary-text-color);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  flex-shrink: 0;
}

.modal-btn {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  font-weight: 500;
  transition: all 0.2s ease-in-out;
}

.modal-btn.primary {
  background-color: var(--accent-color);
  color: #fff;
}
.modal-btn.primary:hover {
    background-color: var(--accent-hover-color);
}
.modal-btn.primary:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
}

.modal-btn.secondary {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--secondary-text-color);
}

.modal-btn.secondary:hover {
    background-color: var(--border-color);
    color: var(--primary-text-color);
}

/* Toggle Switch Styles */
.form-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
}
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 30px;
  flex-shrink: 0;
}
.toggle-switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .4s;
  border-radius: 30px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--accent-color);
}
input:focus + .slider {
  box-shadow: 0 0 1px var(--accent-color);
}
input:checked + .slider:before {
  transform: translateX(22px);
}


/* Contact Modal Specifics */
.contact-modal-footer {
  margin-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
[dir="rtl"] .contact-modal-footer {
  flex-direction: row-reverse;
}

.contact-admin-btn {
    background: none;
    border: none;
    color: var(--secondary-text-color);
    font-size: 0.8rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.3s;
    padding: 0.5rem;
}
.contact-admin-btn:hover {
    opacity: 1;
}

.form-status-message {
    text-align: center;
    padding: 0.75rem;
    margin-top: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}
.form-status-message.success {
    background-color: rgba(51, 255, 87, 0.1);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}
.form-status-message.error {
    background-color: rgba(207, 102, 121, 0.1);
    color: var(--error-color);
    border: 1px solid var(--error-color);
}


/* Footer */
.footer {
    background-color: var(--background-color);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: auto;
    flex-shrink: 0;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.footer-links button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-family: inherit;
    color: var(--secondary-text-color);
    text-decoration: none;
    transition: color 0.3s;
    font-size: 0.9rem;
    cursor: pointer;
}

.footer-links button:hover {
    color: var(--primary-text-color);
}

.copyright {
    color: var(--secondary-text-color);
    font-size: 0.9rem;
}


/* RTL Support */
[dir="rtl"] {
  text-align: right;
}
[dir="rtl"] .header-content,
[dir="rtl"] .products-header,
[dir="rtl"] .product-card-actions,
[dir="rtl"] .footer-content {
  flex-direction: row-reverse;
}

[dir="rtl"] .language-switcher select {
  background-position: left 0.5rem center;
  padding-left: 2rem;
  padding-right: 1rem;
}

[dir="rtl"] .hero {
  text-align: right;
}
[dir="rtl"] .language-fieldset legend {
    margin-right: auto;
    margin-left: 0;
}
[dir="rtl"] .form-group label {
    text-align: right;
}
[dir="rtl"] .modal-actions {
  flex-direction: row-reverse;
}

/* Responsive */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2.5rem;
  }
  .hero p {
    font-size: 1.1rem;
  }
  .products-header {
      flex-direction: column;
      align-items: flex-start;
      gap: 1rem;
  }
  .products-header h2 {
      font-size: 2rem;
  }
  [dir="rtl"] .products-header {
      align-items: flex-end;
  }

  .footer-content {
      flex-direction: column;
      gap: 1.5rem;
  }
}