/**
 * Public Site Styles - CMS v3.7.1
 * Enhanced UI/UX with modern gradients and visual polish
 * Now uses CSS variables for theming
 */

/* ==========================================================================
   Entity Color Variables (fallbacks)
   ========================================================================== */
:root {
    --color-primary: #14b8a6;
    --color-primary-hover: #0d9488;
    --color-secondary: #6366f1;
    --color-accent: #f59e0b;
    --color-primary-dark: #2dd4bf;
    --color-secondary-dark: #818cf8;
    --color-accent-dark: #fbbf24;
    --color-bg-dark: #0f172a;
    --color-primary-rgb: 20, 184, 166;
}

/* ==========================================================================
   Alpine.js Cloak
   ========================================================================== */
[x-cloak] {
    display: none !important;
}

/* ==========================================================================
   Smooth Scrolling
   ========================================================================== */
html {
    scroll-behavior: smooth;
}

/* ==========================================================================
   Glassmorphism Effects
   ========================================================================== */
.glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.glass-dark {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* ==========================================================================
   Enhanced Gradient Effects (using CSS variables)
   ========================================================================== */
.gradient-text {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 50%, var(--color-primary-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-bg {
    background: linear-gradient(-45deg, var(--color-primary-hover), var(--color-primary), var(--color-primary-hover));
    background-size: 400% 400%;
    animation: gradientShift 12s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    25% { background-position: 50% 100%; }
    50% { background-position: 100% 50%; }
    75% { background-position: 50% 0%; }
    100% { background-position: 0% 50%; }
}

/* New accent gradients */
.gradient-accent {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
}

.gradient-warm {
    background: linear-gradient(135deg, var(--color-accent) 0%, #f97316 50%, #ef4444 100%);
}

/* ==========================================================================
   Entity Color Utility Classes
   ========================================================================== */
.text-entity-primary { color: var(--color-primary); }
.text-entity-secondary { color: var(--color-secondary); }
.text-entity-accent { color: var(--color-accent); }
.bg-entity-primary { background-color: var(--color-primary); }
.bg-entity-secondary { background-color: var(--color-secondary); }
.bg-entity-accent { background-color: var(--color-accent); }
.border-entity-primary { border-color: var(--color-primary); }

/* Dark mode entity colors */
.dark .text-entity-primary { color: var(--color-primary-dark); }
.dark .text-entity-secondary { color: var(--color-secondary-dark); }
.dark .text-entity-accent { color: var(--color-accent-dark); }

/* Entity color hover states */
.hover\:text-entity-primary:hover { color: var(--color-primary); }
.hover\:bg-entity-primary:hover { background-color: var(--color-primary); }
.dark .hover\:text-entity-primary:hover { color: var(--color-primary-dark); }

/* Focus ring with entity color */
.focus\:ring-entity-primary:focus {
    --tw-ring-color: var(--color-primary);
}

/* ==========================================================================
   Enhanced Tool Card Hover Effects (using CSS variables)
   ========================================================================== */
.tool-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(var(--color-primary-rgb), 0.08), transparent);
    transition: left 0.6s;
}

.tool-card:hover::before {
    left: 100%;
}

.tool-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(var(--color-primary-rgb), 0.25),
                0 0 0 1px rgba(var(--color-primary-rgb), 0.1);
    border-color: rgba(var(--color-primary-rgb), 0.3);
}

/* Tool card icon enhancement */
.tool-card .tool-icon-wrapper {
    position: relative;
}

.tool-card .tool-icon-wrapper::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.3), rgba(6, 182, 212, 0.3));
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: -1;
}

.tool-card:hover .tool-icon-wrapper::after {
    opacity: 1;
}

/* ==========================================================================
   Enhanced Button Styles
   ========================================================================== */
.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 50%, #0f766e 100%);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px -3px rgba(var(--color-primary-rgb), 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px -5px rgba(var(--color-primary-rgb), 0.5);
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:active::after {
    width: 300px;
    height: 300px;
}

/* Secondary button style */
.btn-secondary {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #475569;
    transition: all 0.3s ease;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Enhanced Star Rating
   ========================================================================== */
.star-rating .star {
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.star-rating .star:hover,
.star-rating .star.active {
    color: #fbbf24;
    transform: scale(1.25);
    filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.5));
}

/* ==========================================================================
   Enhanced FAQ Accordion
   ========================================================================== */
.faq-item .faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-item.open .faq-answer {
    max-height: 1000px;
}

.faq-item.open .faq-icon {
    transform: rotate(180deg);
}

.faq-item {
    transition: all 0.3s ease;
    border-radius: 1rem;
}

.faq-item:hover {
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.05), rgba(6, 182, 212, 0.03));
    border-color: rgba(var(--color-primary-rgb), 0.2);
}

.faq-item.open {
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.08), rgba(6, 182, 212, 0.05));
    border-color: rgba(var(--color-primary-rgb), 0.3);
    box-shadow: 0 4px 15px -3px rgba(var(--color-primary-rgb), 0.15);
}

/* ==========================================================================
   Enhanced Prose Styling
   ========================================================================== */
.prose {
    max-width: none;
}

.prose h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: #0f766e;
    position: relative;
    padding-left: 1rem;
}

.prose h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.25rem;
    bottom: 0.25rem;
    width: 4px;
    background: linear-gradient(180deg, var(--color-primary), var(--color-primary-hover));
    border-radius: 2px;
}

.prose h3 {
    font-size: 1.375rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: #115e59;
}

.prose p {
    margin-bottom: 1.25rem;
    line-height: 1.8;
}

.prose ul,
.prose ol {
    margin-bottom: 1.25rem;
    padding-left: 1.75rem;
}

.prose li {
    margin-bottom: 0.625rem;
}

.prose a {
    color: var(--color-primary-hover);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
    background: linear-gradient(to right, rgba(var(--color-primary-rgb), 0.1), rgba(var(--color-primary-rgb), 0.1));
    background-size: 0% 100%;
    background-repeat: no-repeat;
}

.prose a:hover {
    border-bottom-color: var(--color-primary);
    background-size: 100% 100%;
}

/* ==========================================================================
   Enhanced Input Focus Effects
   ========================================================================== */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.15),
                0 0 0 1px rgba(var(--color-primary-rgb), 0.3);
    border-color: var(--color-primary) !important;
}

/* ==========================================================================
   Floating Label Effect
   ========================================================================== */
.float-label {
    position: relative;
}

.float-label input:focus + label,
.float-label input:not(:placeholder-shown) + label {
    transform: translateY(-1.5rem) scale(0.85);
    color: var(--color-primary-hover);
}

/* ==========================================================================
   Enhanced Modern Scrollbar
   ========================================================================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: linear-gradient(180deg, #f1f5f9, #e2e8f0);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--color-primary), var(--color-primary-hover));
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--color-primary-hover), #0f766e);
}

/* ==========================================================================
   Tool Container
   ========================================================================== */
.tool-container {
    min-height: 300px;
    border-radius: 1.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

/* ==========================================================================
   Enhanced Pulse Animation for CTA
   ========================================================================== */
.pulse-glow {
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(var(--color-primary-rgb), 0.5), 0 4px 15px -3px rgba(var(--color-primary-rgb), 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(var(--color-primary-rgb), 0), 0 4px 15px -3px rgba(var(--color-primary-rgb), 0.4); }
}

/* ==========================================================================
   Enhanced Loading Skeleton
   ========================================================================== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 37%, #f0f0f0 63%);
    background-size: 400% 100%;
    animation: skeleton 1.4s ease infinite;
    border-radius: 0.5rem;
}

@keyframes skeleton {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ==========================================================================
   Category Buttons Enhanced
   ========================================================================== */
.category-btn {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: #64748b;
    border: 1px solid rgba(148, 163, 184, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-btn:hover {
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.1), rgba(6, 182, 212, 0.05));
    color: var(--color-primary-hover);
    border-color: rgba(var(--color-primary-rgb), 0.3);
    transform: translateY(-1px);
}

.category-btn.active-category {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px -3px rgba(var(--color-primary-rgb), 0.4);
}

/* Sort buttons */
.sort-btn {
    background: transparent;
    color: #64748b;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.sort-btn:hover {
    background: rgba(var(--color-primary-rgb), 0.1);
    color: var(--color-primary-hover);
}

.sort-btn.active-sort {
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.15), rgba(6, 182, 212, 0.1));
    color: var(--color-primary-hover);
    font-weight: 600;
}

/* ==========================================================================
   Section Decorative Elements
   ========================================================================== */
.section-decoration {
    position: absolute;
    pointer-events: none;
}

.section-decoration.top-right {
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(var(--color-primary-rgb), 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.section-decoration.bottom-left {
    bottom: -50px;
    left: -50px;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.08) 0%, transparent 70%);
    border-radius: 50%;
}

/* ==========================================================================
   Dark Mode Styles
   ========================================================================== */
html.dark {
    color-scheme: dark;
}

/* Dark mode gradient override */
.dark .gradient-bg {
    background: linear-gradient(-45deg, #134e4a, #115e59, #0f766e, #0d4a47, #042f2e);
    background-size: 400% 400%;
}

/* Dark mode cards */
.dark .tool-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: #334155;
}

.dark .tool-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 25px 50px -12px rgba(var(--color-primary-rgb), 0.2),
                0 0 0 1px rgba(var(--color-primary-rgb), 0.15);
}

/* Dark mode inputs */
.dark input,
.dark textarea,
.dark select {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: #475569;
    color: #f1f5f9;
}

.dark input:focus,
.dark textarea:focus,
.dark select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.2),
                0 0 0 1px rgba(var(--color-primary-rgb), 0.4);
}

.dark input::placeholder,
.dark textarea::placeholder {
    color: #94a3b8;
}

/* Dark mode header/footer */
.dark header {
    background: rgba(15, 23, 42, 0.95);
    border-color: rgba(51, 65, 85, 0.5);
}

/* Dark mode prose content */
.dark .prose {
    color: #cbd5e1;
}

.dark .prose h1,
.dark .prose h2,
.dark .prose h3,
.dark .prose h4 {
    color: #f1f5f9;
}

.dark .prose h2::before {
    background: linear-gradient(180deg, #2dd4bf, var(--color-primary));
}

.dark .prose a {
    color: #2dd4bf;
}

.dark .prose strong {
    color: #f1f5f9;
}

.dark .prose code {
    background: #334155;
    color: #f1f5f9;
}

.dark .prose blockquote {
    border-color: var(--color-primary);
    color: #94a3b8;
}

/* Dark mode FAQ */
.dark .faq-item {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: #334155;
}

.dark .faq-item:hover {
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.08), rgba(6, 182, 212, 0.05));
    border-color: rgba(var(--color-primary-rgb), 0.25);
}

.dark .faq-item .faq-question {
    color: #f1f5f9;
}

/* Dark mode category buttons */
.dark .category-btn {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    color: #cbd5e1;
    border-color: rgba(71, 85, 105, 0.5);
}

.dark .category-btn:hover {
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.2), rgba(6, 182, 212, 0.1));
    color: #5eead4;
    border-color: rgba(var(--color-primary-rgb), 0.4);
}

.dark .category-btn.active-category {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    color: white;
    border-color: transparent;
}

/* Dark mode sort buttons */
.dark .sort-btn {
    color: #94a3b8;
}

.dark .sort-btn:hover {
    background: rgba(var(--color-primary-rgb), 0.15);
    color: #5eead4;
}

.dark .sort-btn.active-sort {
    background: rgba(var(--color-primary-rgb), 0.2);
    color: #2dd4bf;
}

/* Dark mode scrollbar */
.dark ::-webkit-scrollbar-track {
    background: linear-gradient(180deg, #1e293b, #0f172a);
}

.dark ::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--color-primary), #0f766e);
}

/* Dark mode tool container */
.dark .tool-container {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

/* ==========================================================================
   Hover Card Shine Effect
   ========================================================================== */
.shine-effect {
    position: relative;
    overflow: hidden;
}

.shine-effect::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to right,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
    transform: rotate(30deg);
    transition: transform 0.6s;
}

.shine-effect:hover::after {
    transform: rotate(30deg) translateX(100%);
}
