/* Custom Styles for PatternSoft Website */

/* Theme toggle: show only one icon (sun in light, moon in dark) */
#theme-toggle .fa-sun,
#footer-theme-toggle .fa-sun {
    display: block;
}
html.dark #theme-toggle .fa-sun,
html.dark #footer-theme-toggle .fa-sun {
    display: none !important;
}
#theme-toggle .fa-moon,
#footer-theme-toggle .fa-moon {
    display: none;
}
html.dark #theme-toggle .fa-moon,
html.dark #footer-theme-toggle .fa-moon {
    display: block !important;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #F7F9FB;
}

.dark ::-webkit-scrollbar-track {
    background: #1A202C;
}

::-webkit-scrollbar-thumb {
    background: #A0AEC0;
    border-radius: 5px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #4A5568;
}

::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

/* Header Shadow on Scroll */
header.scrolled {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Glass Morphism Effect */
.glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.dark .glass {
    background: rgba(45, 55, 72, 0.8);
}

/* Code Block Styling */
pre {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
}

code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
}

/* Animation for fade-in on scroll */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Focus Styles for Accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #4A90E2;
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

/* Skip Link for Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.sr-only:focus {
    position: absolute;
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* FAQ Section Styling */
details summary {
    list-style: none;
}

details summary::-webkit-details-marker {
    display: none;
}

details[open] summary {
    border-bottom: 1px solid;
    border-color: rgba(226, 232, 240, 0.5);
}

.dark details[open] summary {
    border-color: rgba(74, 85, 104, 0.5);
}

details summary:focus {
    outline: 2px solid #4A90E2;
    outline-offset: -2px;
    border-radius: 0.5rem;
}

/* Print Styles */
@media print {
    header,
    footer,
    #back-to-top {
        display: none;
    }
}

/* Ensure proper contrast for accessibility */
.text-text-muted-light {
    color: #A0AEC0;
}

.dark .text-text-muted-dark {
    color: #718096;
}

/* Button Hover Effects */
.btn-primary {
    background: linear-gradient(to right, #4A90E2, #50E3C2);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(74, 144, 226, 0.3);
}

/* Card Hover Effects */
.card-hover {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Mobile Menu Animation */
#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

#mobile-menu.open {
    max-height: 500px;
}

/* Back to Top Button */
#back-to-top {
    transition: opacity 0.3s ease;
}

#back-to-top.show {
    opacity: 1;
    pointer-events: all;
}

/* Table Responsive */
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Ensure images are responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Header logo - replace inline style */
.header-logo {
    max-width: min(50%, 200px);
}

/* Header Responsive Adjustments */
@media (max-width: 640px) {
    header nav {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    #header .flex.items-center.space-x-2 {
        min-width: 0;
    }
}

/* Prevent header squashing at medium breakpoints */
@media (min-width: 768px) and (max-width: 1023px) {
    header nav {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .header-logo {
        max-width: 45% !important;
    }
    
    .header-logo img {
        height: 2rem !important;
    }
    
    .header-logo span {
        font-size: 0.875rem !important;
    }
}

/* Extra small screens - hide text, show only logo */
@media (max-width: 360px) {
    .header-logo span {
        display: none !important;
    }
    
    .header-logo {
        max-width: 40% !important;
    }
}

/* Prevent squashing at tablet sizes */
@media (min-width: 640px) and (max-width: 767px) {
    .header-logo {
        max-width: 48% !important;
    }
}

/* Selection Color */
::selection {
    background-color: #4A90E2;
    color: white;
}

::-moz-selection {
    background-color: #4A90E2;
    color: white;
}
