/* Page-specific CSS for AI Generator */

/* CRITICAL: Force desktop navigation to show on large screens */
@media (min-width: 1024px) {
  .hidden[class*="lg:flex"] {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

/* Navigation Menu Animations */
@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-slide-down {
  animation: slide-down 0.2s ease-out forwards;
}

/* Mobile menu specific styles */
#mobile-menu {
  z-index: 50;
}

/* Force mobile menu to display vertically */
#mobile-menu .flex.flex-col {
  display: flex !important;
  flex-direction: column !important;
}

/* Force mobile menu links to display as blocks */
#mobile-menu a.menu-link {
  display: flex !important;
  width: 100% !important;
  flex-direction: row !important;
  align-items: center !important;
}

/* Menu hover effects */
.menu-link {
  position: relative;
  transition: all 0.15s ease-in-out;
}

.menu-link:hover {
  transform: translateY(-1px);
}

/* Mobile menu toggle button animations */
#mobile-menu-toggle .menu-icon {
  transition: transform 0.2s ease-in-out;
}

#mobile-menu-toggle[aria-expanded="true"] .menu-icon {
  transform: rotate(90deg);
}

/* Enhanced mobile menu styling */
#mobile-menu .border-l-4:hover {
  border-left-color: #fde047 !important;
  background-color: rgba(253, 224, 71, 0.1);
}



/* Mobile theme toggle button styling */
#mobile-theme-toggle {
  transition: all 0.15s ease-in-out;
}

#mobile-theme-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 4px 4px 0px 0px #000;
}

/* Responsive navigation adjustments */
@media (max-width: 1023px) {
  /* Force hide desktop navigation on mobile/tablet */
  nav .hidden.lg\\:flex,
  nav .hidden\\.lg\\:flex,
  .hidden.lg\\:flex {
    display: none !important;
  }
  
  /* Target specific desktop menu elements */
  nav > div > div > div.hidden.lg\\:flex {
    display: none !important;
  }
  
  /* Ensure mobile menu appears above other content */
  #mobile-menu {
    position: relative;
    z-index: 100;
  }
  
  /* Hide mobile menu toggle button animation when menu is open */
  .mobile-menu-open #mobile-menu-toggle .menu-icon {
    transform: rotate(90deg);
  }
}

@media (min-width: 1024px) {
  /* Ensure mobile menu is completely hidden on desktop */
  #mobile-menu {
    display: none !important;
  }
  
  /* Ensure mobile menu toggle is hidden on desktop */
  #mobile-menu-toggle {
    display: none !important;
  }
  
  /* Force show desktop navigation on large screens - override Tailwind's hidden class */
  .hidden.lg\\:flex {
    display: flex !important;
  }
  
  /* Additional fallback - target specific elements directly */
  nav div.hidden,
  header div.hidden {
    display: flex !important;
  }
  
  /* Debug - make sure all navigation elements are visible */
  nav * {
    visibility: visible !important;
  }
}

/* Fix text-white color issue - ensure white text is always white */
.text-white {
  color: #ffffff !important;
}

/* Ensure Tailwind classes work with CSS variables */
.bg-primary-500 { 
  background-color: var(--color-primary-500, #f97316) !important; 
}

.text-primary-500 { 
  color: var(--color-primary-500, #f97316) !important; 
}

.border-primary-500 { 
  border-color: var(--color-primary-500, #f97316) !important; 
}

/* Additional theme color overrides */
.bg-primary-600 { 
  background-color: var(--color-primary-600, #ea580c) !important; 
}

.text-primary-600 { 
  color: var(--color-primary-600, #ea580c) !important; 
}

.bg-primary-400 { 
  background-color: var(--color-primary-400, #fb923c) !important; 
}

.text-primary-400 { 
  color: var(--color-primary-400, #fb923c) !important; 
}

/* Theme Variables - fallback if not defined in Tailwind */
:root {
  --color-primary-400: #fb923c;
  --color-primary-500: #f97316;
  --color-primary-600: #ea580c;
}

/* Horizontal Card for Recent Generations - spans full width across both columns */
.card-brutalist-horizontal {
  @apply border-5 border-black bg-white p-6 shadow-[12px_12px_0px_0px_#000];
  /* Span full grid width on large screens */
  grid-column: 1 / -1;
}

/* Ensure generation history grid works properly */
#generation-history {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
  gap: 1rem !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

.dark .card-brutalist-horizontal {
  @apply bg-gray-900 border-white text-white;
  box-shadow: 12px 12px 0px 0px rgba(255, 255, 255, 0.5);
}

/* Recent Generations Grid Layout */
#generation-history {
  /* Grid layout is handled by Tailwind classes in HTML */
}

.history-item-grid {
  @apply border border-gray-300 dark:border-gray-600 rounded-lg overflow-hidden hover:shadow-lg cursor-pointer transition-all duration-200 bg-white dark:bg-gray-800;
  height: 260px !important; /* Fixed height to accommodate fixed image height */
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0; /* Allow shrinking */
  box-sizing: border-box !important;
  display: flex;
  flex-direction: column;
}

.history-item-grid img {
  @apply w-full object-cover cursor-pointer;
  height: 180px !important; /* Fixed height for all images */
  max-width: 100% !important;
  display: block !important;
  box-sizing: border-box !important;
  border-radius: 8px 8px 0 0; /* Rounded top corners */
  transition: transform 0.2s ease-in-out;
}

.history-item-grid img:hover {
  transform: scale(1.02);
}

.history-item-grid .content {
  @apply p-1.5;
  flex: 1; /* Take remaining space after fixed image height */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.history-item-grid .prompt {
  @apply text-xs font-medium text-gray-900 dark:text-gray-100 mb-1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.2;
  height: calc(1.2em * 2); /* 2 lines with tighter spacing */
  font-size: 11px; /* Smaller font size */
}

.history-item-grid .date {
  @apply text-xs text-gray-500 dark:text-gray-400;
  font-size: 10px; /* Smaller date font */
}

.history-item-grid .download-btn {
  @apply absolute top-1 right-1 bg-black bg-opacity-50 text-white px-1 py-1 rounded text-xs hover:bg-opacity-75 transition-all;
  font-size: 10px;
  line-height: 1;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  #generation-history {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
  }
}

@media (max-width: 768px) {
  #generation-history {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    gap: 0.75rem !important;
  }
}

@media (max-width: 640px) {
  #generation-history {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
  }
  
  .history-item-grid {
    width: 100% !important;
    max-width: 100% !important;
    height: 220px !important; /* Smaller height on mobile */
  }
  
  .history-item-grid img {
    height: 140px !important; /* Smaller image height on mobile */
  }
}
  
  .history-item-grid .prompt {
    font-size: 9px;
    -webkit-line-clamp: 1;
    height: calc(1.2em * 1); /* 1 line on mobile */
  }
  
  .history-item-grid .date {
    font-size: 8px;
  }
  
  .history-item-grid .content {
    @apply p-1;
  }
}

/* Accessibility: reduced motion */
@media (prefers-reduced-motion: reduce) {
  #user-dropdown,
  #mobile-user-dropdown,
  #mobile-menu,
  .menu-link,
  #mobile-menu-toggle .menu-icon,
  #theme-toggle,
  #mobile-theme-toggle {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}

/* Accessibility: focus visible outline for keyboard users */
:focus-visible {
  outline: 2px dashed #000 !important;
  outline-offset: 2px !important;
}
.dark :focus-visible {
  outline-color: #fff !important;
} 

/* Site logo styles */
.site-logo {
  width: 35px !important;
  height: 35px !important;
  object-fit: contain;
  transition: opacity 0.15s ease;
}

.site-logo:hover {
  opacity: 0.8;
}

/* Logo link container */
.logo-link {
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  text-decoration: none !important;
  transition: opacity 0.15s ease;
}

.logo-link:hover {
  opacity: 0.8;
}

/* Ensure logo is properly sized on mobile */
@media (max-width: 640px) {
  .site-logo {
    width: 30px !important;
    height: 30px !important;
  }
  
  .logo-link {
    gap: 0.5rem !important;
  }
  
  .logo-link h1 {
    font-size: 1.25rem !important; /* text-xl on mobile */
  }
}

/* ==================== AI GENERATOR PAGE SPECIFIC STYLES ==================== */

/* Navigation responsive display controls */
@media (min-width: 1024px) {
  #desktop-nav,
  #desktop-controls,
  .hidden.lg\:flex {
    display: flex !important;
    visibility: visible !important;
  }
}

@media (max-width: 1023px) {
  #desktop-nav,
  #desktop-controls {
    display: none !important;
  }
}

/* User dropdown menu animations and positioning */
#user-dropdown {
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  transform: translateY(-10px);
  right: 0 !important;
  left: auto !important;
  transform: translateX(0) !important;
  background: white !important;
  border: 3px solid black !important;
}

#user-dropdown.hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
}

#user-dropdown:not(.hidden) {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* User dropdown responsive sizing */
@media (max-width: 1024px) {
  #user-dropdown {
    width: 18rem !important;
    max-width: calc(100vw - 1rem) !important;
  }
}

@media (max-width: 640px) {
  #user-dropdown {
    right: -1rem;
    width: calc(100vw - 2rem) !important;
    max-width: 280px !important;
    width: 16rem !important;
    max-width: calc(100vw - 0.5rem) !important;
    right: 0.25rem !important;
  }
}

/* Mobile user dropdown menu */
#mobile-user-dropdown {
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  transform: translateY(-10px);
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  transform-origin: top right !important;
  right: 0 !important;
  left: auto !important;
  top: calc(100% + 0.75rem) !important;
  margin-top: 0 !important;
  background: #ffffff !important;
}

#mobile-user-dropdown.hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
}

#mobile-user-dropdown:not(.hidden) {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Mobile user dropdown responsive sizing */
@media (max-width: 1024px) {
  #mobile-user-dropdown {
    width: 18rem !important;
    max-width: calc(100vw - 1rem) !important;
  }
}

@media (max-width: 640px) {
  #mobile-user-dropdown {
    width: auto !important;
    max-width: calc(100vw - 1rem) !important;
    right: 0.5rem !important;
  }
}

/* Mobile menu scroll */
#mobile-menu {
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
}

/* User dropdown header styling */
#user-dropdown .p-3.border-b-3.bg-orange-500,
#mobile-user-dropdown .p-3.border-b-3.bg-orange-500 {
  background: #f97316 !important;
  background-color: #f97316 !important;
  color: white !important;
  display: block !important;
  width: 100% !important;
}

#user-dropdown .p-3.border-b-3.bg-orange-500 p,
#mobile-user-dropdown .p-3.border-b-3.bg-orange-500 p {
  background: transparent !important;
  display: block !important;
  width: 100% !important;
  margin-bottom: 2px !important;
  float: none !important;
  clear: both !important;
  color: #ffffff !important;
}

#user-dropdown .p-3.border-b-3.bg-orange-500 .text-yellow-300 {
  color: #fde047 !important;
}

/* User dropdown content area styling */
#user-dropdown .p-2,
#mobile-user-dropdown .p-2 {
  display: block !important;
  width: 100% !important;
}

#user-dropdown .p-2 > *,
#mobile-user-dropdown .p-2 > * {
  display: block !important;
  width: 100% !important;
  margin-bottom: 4px !important;
}

#user-dropdown .p-2,
#user-dropdown .p-2 a,
#user-dropdown .p-2 span,
#user-dropdown .p-2 p,
#mobile-user-dropdown .p-2,
#mobile-user-dropdown .p-2 a,
#mobile-user-dropdown .p-2 span,
#mobile-user-dropdown .p-2 p {
  color: #000000 !important;
}

/* Menu item links - keep icons and text on same line */
#user-dropdown a,
#mobile-user-dropdown a {
  display: flex !important;
  align-items: center !important;
  white-space: nowrap !important;
  width: 100% !important;
}

#user-dropdown a span,
#mobile-user-dropdown a span {
  display: inline !important;
  width: auto !important;
  margin-bottom: 0 !important;
  float: none !important;
  clear: none !important;
}

/* Points area - maintain horizontal layout */
#user-dropdown .flex.items-center,
#mobile-user-dropdown .flex.items-center {
  display: flex !important;
  align-items: center !important;
}

#user-dropdown .flex.items-center span,
#mobile-user-dropdown .flex.items-center span {
  display: inline !important;
  width: auto !important;
  margin-bottom: 0 !important;
}

/* Ensure menu container has no float interference */
#user-dropdown > div,
#mobile-user-dropdown > div {
  float: none !important;
}

#user-dropdown .p-2 > div,
#mobile-user-dropdown .p-2 > div {
  float: none !important;
}

/* Dark mode user dropdown styling */
.dark #user-dropdown {
  background: #ffffff !important;
}

.dark #user-dropdown .p-2,
.dark #user-dropdown .p-2 a,
.dark #user-dropdown .p-2 span,
.dark #user-dropdown .p-2 p {
  color: #000000 !important;
}

/* Button styling fixes */
#user-dropdown .bg-red-500 {
  background-color: #ef4444 !important;
  color: white !important;
}

a.btn-brutalist-secondary {
  background-color: #facc15 !important;
  color: #000000 !important;
  border: 3px solid #000000 !important;
}

a.btn-brutalist-secondary:hover {
  background-color: #facc15 !important;
  color: #000000 !important;
}

/* AI Generator result container styling */
#result-container {
  min-height: 16rem;
  max-height: 70vh;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

#result-container img {
  width: 100%;
  height: auto;
  display: block;
  max-height: calc(70vh - 6rem);
  object-fit: contain;
  flex-shrink: 0;
}

#result-image {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#result-image .mt-3 {
  margin-top: 0.75rem;
  flex-shrink: 0;
}

#generation-history {
  min-height: 232px;
} 