/* DashboardSEO Component Styles */

/* CSS Variables for consistent theming - inherited from DashboardHome */
:root {
  /* Color Palette - Professional Dark Theme */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --bg-active: #475569;

  /* Accent Colors */
  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-secondary: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;

  /* Text Colors */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-inverse: #1e293b;

  /* Border Colors */
  --border-primary: #334155;
  --border-secondary: #475569;
  --border-accent: #3b82f6;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Transitions */
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* SEO Section */
.seoSection {
  padding: var(--spacing-xl);
  max-width: 1200px;
  margin: 0 auto;
}

.sectionHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-xl);
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.sectionHeader h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

/* Error Message */
.errorMessage {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--accent-danger);
  color: var(--accent-danger);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: var(--spacing-lg);
}

/* Styled Message Alert */
.messageAlert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: var(--spacing-lg);
  animation: slideIn 0.3s ease-out;
}

.messageAlert.success {
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--accent-secondary);
  color: var(--accent-secondary);
}

.messageAlert.error {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--accent-danger);
  color: var(--accent-danger);
}

.messageAlert.warning {
  background-color: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--accent-warning);
  color: var(--accent-warning);
}

.messageClose {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: var(--spacing-xs);
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.messageClose:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Loading State */
.loadingState {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-2xl);
  color: var(--text-secondary);
  font-size: 1.125rem;
}

/* Page Selector */
.pageSelector {
  background-color: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
  box-shadow: var(--shadow-sm);
}

.pageSelector h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-lg);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.pageOptions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-md);
}

.pageOption {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  background-color: var(--bg-hover);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  font-size: 0.9rem;
  font-weight: 500;
}

.pageOption:hover {
  background-color: var(--bg-active);
  border-color: var(--border-secondary);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.pageOption.active {
  background: linear-gradient(
    135deg,
    var(--accent-primary),
    var(--accent-primary-hover)
  );
  border-color: var(--accent-primary);
  color: white;
  box-shadow: var(--shadow-md);
}

.pageOption.active:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Form Container */
.formContainer {
  background-color: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-sm);
}

/* Form Styles */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
}

.formSection {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  padding: var(--spacing-lg);
  background-color: var(--bg-hover);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-primary);
  transition: var(--transition-fast);
}

.formSection:hover {
  border-color: var(--border-secondary);
  box-shadow: var(--shadow-sm);
}

.formSection h4 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--spacing-md) 0;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border-primary);
}

.formGroup {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.formGroup label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--spacing-xs);
}

.formGroup input,
.formGroup textarea,
.formGroup select {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: var(--transition-fast);
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}

.formGroup input:focus,
.formGroup textarea:focus,
.formGroup select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background-color: var(--bg-tertiary);
}

.formGroup textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.formGroup small {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
  margin-top: var(--spacing-xs);
}

/* Error States */
.formGroup input.error,
.formGroup textarea.error,
.formGroup select.error {
  border-color: var(--accent-danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.errorText {
  font-size: 0.75rem;
  color: var(--accent-danger);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

/* Button Styles */
.btnPrimary {
  background: linear-gradient(
    135deg,
    var(--accent-primary),
    var(--accent-primary-hover)
  );
  color: white;
  border: none;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 0.9rem;
}

.btnPrimary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btnPrimary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btnSecondary {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-secondary);
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 0.9rem;
}

.btnSecondary:hover {
  background-color: var(--bg-active);
  border-color: var(--border-accent);
}

/* Responsive Design */
@media (max-width: 768px) {
  .seoSection {
    padding: var(--spacing-md);
  }

  .sectionHeader {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-md);
  }

  .pageOptions {
    grid-template-columns: 1fr;
  }

  .pageOption {
    justify-content: center;
    text-align: center;
  }

  .formContainer {
    padding: var(--spacing-md);
  }

  .formSection {
    padding: var(--spacing-md);
  }

  .form {
    gap: var(--spacing-lg);
  }
}

@media (max-width: 480px) {
  .seoSection {
    padding: var(--spacing-sm);
  }

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

  .pageSelector h3 {
    font-size: 1.125rem;
  }

  .formSection h4 {
    font-size: 1rem;
  }

  .formGroup input,
  .formGroup textarea {
    padding: var(--spacing-sm);
  }
}

/* Animation for smooth transitions */
.formContainer {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Focus indicators for accessibility */
.pageOption:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.formGroup input:focus-visible,
.formGroup textarea:focus-visible,
.formGroup select:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Hover effects for better UX */
.formGroup input:hover,
.formGroup textarea:hover,
.formGroup select:hover {
  border-color: var(--border-secondary);
}

/* Character count styling for inputs with maxLength */
.formGroup input[maxlength]:focus + small::after,
.formGroup textarea[maxlength]:focus + small::after {
  content: " (" attr(value) "/" attr(maxlength) ")";
  color: var(--text-muted);
  font-weight: normal;
}

/* Success state for valid inputs */
.formGroup input:valid:not(:placeholder-shown),
.formGroup textarea:valid:not(:placeholder-shown) {
  border-color: var(--accent-secondary);
}

/* Form Grid Layout */
.formGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-lg);
}

@media (min-width: 768px) {
  .formGrid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Full width for textareas and certain fields */
  .formGrid .formGroup:has(textarea),
  .formGrid .formGroup:has(input[placeholder*="description"]),
  .formGrid .formGroup:has(input[placeholder*="keywords"]) {
    grid-column: 1 / -1;
  }
}

/* Desktop Save Button */
.desktopSaveBtn {
  display: flex;
}

/* Sticky Save Button for Mobile */
.stickySaveButton {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(
    to top,
    var(--bg-secondary) 0%,
    var(--bg-secondary) 70%,
    transparent 100%
  );
  padding: var(--spacing-md) var(--spacing-lg) var(--spacing-lg);
  z-index: 100;
  display: none;
  border-top: 1px solid var(--border-primary);
  backdrop-filter: blur(10px);
}

.stickySaveButton button {
  width: 100%;
  justify-content: center;
  padding: var(--spacing-md) var(--spacing-lg);
  font-size: 1rem;
  font-weight: 600;
}

/* Show sticky button on mobile, hide desktop button */
@media (max-width: 768px) {
  .desktopSaveBtn {
    display: none;
  }

  .stickySaveButton {
    display: block;
  }
}
