/* ============================================
   dericBI Main Stylesheet - Consolidated
   All custom styles for responsiveness & UX
   ============================================ */

/* ===== ANIMATIONS ===== */
@keyframes slide {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

.animate-slide {
  animation: slide 20s linear infinite;
}

@keyframes dance {
  0% { transform: rotate(-8deg) scale(1) translateY(0); }
  20% { transform: rotate(8deg) scale(1.08) translateY(-2px); }
  40% { transform: rotate(-8deg) scale(1.12) translateY(2px); }
  60% { transform: rotate(8deg) scale(1.08) translateY(-2px); }
  80% { transform: rotate(-8deg) scale(1.05) translateY(2px); }
  100% { transform: rotate(8deg) scale(1) translateY(0); }
}

.dancing-badge {
  display: inline-block;
  animation: dance 1.2s infinite alternate cubic-bezier(.68,-0.55,.27,1.55);
  box-shadow: 0 0 8px 2px rgba(255, 193, 7, 0.3);
}

.pulse-animation {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(73, 160, 120, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(73, 160, 120, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(73, 160, 120, 0);
  }
}

/* ===== BUTTON HOVER EFFECTS ===== */
button, .fancy-btn, .glow-btn, a[class*="bg-["], a[class*="px-"] {
  transition: all 0.3s ease;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 375px) {
  button, .fancy-btn, .glow-btn, a[class*="bg-["], a[class*="px-"] {
    min-height: 44px;
  }
}

.fancy-btn {
  background-color: #f3f4f6 !important; /* gray-100 - very light, subtle */
  color: #6b7280 !important; /* gray-500 - softer text */
  border: 1px solid #e5e7eb !important; /* gray-200 - minimal border */
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  border-radius: 0.375rem !important; /* rounded */
  padding: 0.5rem 1rem;
  font-weight: 600;
}

.fancy-btn:hover, .glow-btn:hover {
  background-color: #fef3c7 !important; /* yellow-100 */
  color: #111827 !important; /* gray-900 */
  border-color: #fde047 !important; /* yellow-300 */
  box-shadow: 0 4px 14px 0 rgba(250, 204, 21, 0.3), 0 2px 6px 0 rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

button:hover {
  transform: translateY(-1px);
}

/* Enhanced button text visibility */
a[class*="bg-[#25D366"], a[class*="bg-[#2563EB"], a[class*="bg-[#7C3AED"], a[class*="bg-gray"] {
  font-weight: 700;
  letter-spacing: 0.015em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  border-radius: 1.5rem !important; /* Force rounded corners - 24px */
}

/* Disabled button styles */
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  font-weight: 700;
  border-radius: 1.5rem !important; /* Force rounded corners - 24px */
}

/* ===== CARD HOVER EFFECTS ===== */
.card, .list-card, .project-card {
  transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover, .list-card:hover, .project-card:hover {
  box-shadow: 0 4px 16px 0 #2563EB22, 0 0 8px #49A07833;
  transform: translateY(-2px) scale(1.02);
}

/* ===== NAVIGATION LINK EFFECTS ===== */
.nav-link {
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

.nav-link:hover {
  color: #facc15;
  text-shadow: 0 0 4px rgba(250, 204, 21, 0.4);
}

/* ===== FOOTER LINK STYLING ===== */
.footer-link {
  position: relative;
  transition: all 0.3s ease;
  display: inline-block;
  color: inherit;
}

.footer-link:hover {
  color: #49A078;
  transform: translateY(-1px);
  text-shadow: 0 0 4px rgba(250, 204, 21, 0.5);
}

/* ===== SOCIAL ICON EFFECTS ===== */
.group {
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.group:hover {
  transform: translateY(-2px);
  z-index: 5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.1);
  filter: brightness(1.05);
}

.group:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  filter: brightness(0.98);
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
/* Improve color contrast for better readability */
.text-gray-600 {
  color: #222 !important;
}

.text-gray-500 {
  color: #333 !important;
}

/* Visual indicator for images missing alt text */
img:not([alt]) {
  outline: 2px dashed #facc15;
}

/* ===== LINK ENHANCEMENTS ===== */
a:not(.group):not(.nav-link):not(.footer-link) {
  transition: all 0.2s ease;
  position: relative;
}

a:not(.group):not(.nav-link):not(.footer-link):hover {
  filter: brightness(1.05);
  text-decoration: underline;
}

/* ===== BASE RESPONSIVE FOUNDATION ===== */
/* Better responsive handling - prevent horizontal scroll */
html {
  height: 100%;
  scroll-behavior: smooth;
}

html, body {
  max-width: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

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

/* Prevent content overflow globally */
* {
  box-sizing: border-box;
  max-width: 100vw;
}

/* Main content area grows to push footer down */
main {
  flex: 1 0 auto;
  width: 100%;
}

/* Footer stays at bottom */
footer {
  flex-shrink: 0;
  width: 100%;
}

/* Safe area for notched phones (iPhone X+) */
@supports(padding: max(0px)) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ===== GRID & LAYOUT IMPROVEMENTS ===== */
/* Improve element distinction in grids */
.grid > a, .grid > div {
  position: relative;
  z-index: 1;
}

/* Enhanced readability for text within grid items */
.grid a span, .grid div span {
  display: block;
  width: 100%;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* Prevent text overflow utility */
.text-overflow-ellipsis {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Ultra-small screens (< 360px) - Galaxy Fold, etc. */
@media (max-width: 360px) {
  .text-xs {
    font-size: 0.75rem; /* WCAG minimum 12px for accessibility */
  }
  
  .h-14, .w-14 {
    height: 3rem;
    width: 3rem;
  }
  
  .gap-3 {
    gap: 0.5rem;
  }
  
  .py-2 {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
  }
  
  .px-3 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  
  /* Better wrapping for tiny screens */
  .flex {
    flex-wrap: wrap;
  }
  
  /* Ensure hamburger menu is always visible */
  #menu-toggle {
    display: block !important;
    margin-left: auto !important;
    font-size: 1.25rem !important;
  }
}

/* Hide brand name only on extremely small screens */
@media (max-width: 350px) {
  .brand-text {
    display: none;
  }
}

/* Small phones (< 480px) */
@media (max-width: 480px) {
  /* Add subtle borders to help distinguish elements */
  .grid > a, .grid > div {
    border-width: 1px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    margin-bottom: 4px;
  }
  
  /* Better icon/text ratio on small screens */
  .text-3xl.xs\:text-4xl {
    font-size: 1.75rem !important;
  }
  
  /* Add micro-spacing between congested elements */
  .gap-1 {
    gap: 0.375rem !important;
  }
  
  /* Improve contrast for better readability */
  .text-xs {
    font-weight: 500;
  }
}

/* Mobile chatbot adjustments */
@media (max-width: 640px) {
  #chatbot-toggle {
    bottom: 6rem !important;
  }
  
  #chatbot-container {
    bottom: 6rem !important;
  }
}

/* ===== COMPREHENSIVE RESPONSIVE BREAKPOINTS ===== */

/* Galaxy Fold & Ultra-Small (280px-320px) */
@media (max-width: 320px) {
  nav {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
  
  .max-w-7xl {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  
  h1 {
    font-size: 1.25rem !important;
    line-height: 1.3;
  }
  
  h2 {
    font-size: 1.1rem !important;
    line-height: 1.3;
  }
  
  /* Better button sizing on ultra-small screens */
  a[class*="px-4"], button[class*="px-4"] {
    padding-left: 0.875rem !important;
    padding-right: 0.875rem !important;
    font-size: 0.813rem !important;
  }
}

/* Small Mobile (321px-480px) */
@media (min-width: 321px) and (max-width: 480px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* Optimize button touch targets for mobile */
  a[class*="bg-["], button {
    min-height: 48px !important;
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
    font-size: 0.938rem !important;
    font-weight: 700 !important;
  }
  
  /* Ensure buttons stack nicely on small screens */
  .flex-wrap {
    gap: 0.625rem !important;
  }
}

/* Standard Mobile (481px-640px) */
@media (min-width: 481px) and (max-width: 640px) {
  nav {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* Comfortable button sizing for standard mobile */
  a[class*="bg-["], button {
    min-height: 46px !important;
    font-weight: 700 !important;
  }
}

/* Tablet Portrait (641px-768px) */
@media (min-width: 641px) and (max-width: 768px) {
  .container {
    max-width: 100%;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

/* Tablet Landscape (769px-1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .max-w-7xl {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* Desktop (1025px-1440px) */
@media (min-width: 1025px) and (max-width: 1440px) {
  .container, .max-w-7xl {
    max-width: 1200px;
  }
}

/* Large Desktop (1441px-1920px) */
@media (min-width: 1441px) and (max-width: 1920px) {
  .container, .max-w-7xl {
    max-width: 1400px;
  }
  
  body {
    font-size: 18px;
  }
}

/* Ultra-Wide & 4K (1921px+) */
@media (min-width: 1921px) {
  .container, .max-w-7xl {
    max-width: 1600px;
  }
  
  body {
    font-size: 20px;
  }
  
  /* Ensure footer stays at bottom on very large screens */
  main {
    min-height: calc(100vh - 200px);
  }
}

/* Height-based media queries for short screens */
@media (max-height: 600px) {
  section {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
  
  footer {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
  .h-\[140px\], .h-\[160px\], .h-\[180px\], .h-\[200px\] {
    height: 100px !important;
  }
}

/* ===== TESTIMONIAL DOTS ===== */
.testimonial-dot {
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.testimonial-dot:hover {
  transform: scale(1.2);
}

.testimonial-dot.active {
  background-color: #49A078;
}

/* ===== UTILITY CLASSES ===== */
.overflow-hidden {
  overflow: hidden;
}

/* ===== RESPONSIVE TEXT OVERFLOW PROTECTION ===== */
.text-overflow-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== RESPONSIVE CONTAINER IMPROVEMENTS ===== */
@media (max-width: 360px) {
  /* Extra small screens - ensure nothing overflows */
  * {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  
  /* Reduce padding on very small screens */
  section {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
  
  /* Ensure modals fit */
  .fixed.inset-0 > div {
    max-width: calc(100vw - 1rem) !important;
  }
}

/* ===== PREVENT HORIZONTAL SCROLL ===== */
body {
  overflow-x: hidden;
  max-width: 100vw;
}

html {
  overflow-x: hidden;
  max-width: 100vw;
}

/* ===== RESPONSIVE IMAGE OPTIMIZATION ===== */
img {
  max-width: 100%;
  height: auto;
}

/* ===== TOUCH-FRIENDLY BUTTONS ===== */
@media (hover: none) and (pointer: coarse) {
  button, a[class*="bg-"] {
    min-height: 44px;
    min-width: 44px;
  }
}

.break-words {
  word-wrap: break-word;
  overflow-wrap: break-word;
}
