/* Custom styles for LeetCode2Anki Plus website */

/* Nav links */
.nav-link {
    position: relative;
    color: #d1d5db;
    font-weight: 500;
    padding-bottom: 0.25rem;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: white;
}

.nav-link:after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: #14b8a6;
    transition: width 0.3s ease;
}

.nav-link:hover:after {
    width: 100%;
}

/* Installation Tabs */
.installation-tab {
    color: #9ca3af;
    border-color: transparent;
    transition: all 0.3s ease;
}

.installation-tab:hover {
    color: #d1d5db;
}

.installation-tab.active {
    color: #14b8a6;
    border-color: #14b8a6;
    font-weight: 600;
    position: relative;
}

.installation-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #14b8a6;
    animation: pulse 1.5s infinite;
}

.installation-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #1e293b;
    transition: background-color 0.3s ease;
}

.installation-tab.active .installation-number {
    background-color: #134e4a;
}

/* Demo Navigation Buttons */
.demo-nav-btn {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.demo-nav-btn.active {
    background-color: #14b8a6;
    transform: scale(1.2);
}

/* Animation for step cards */
.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: #14b8a6;
    color: white;
    border-radius: 50%;
    font-weight: bold;
    position: absolute;
    left: 0;
    top: 1rem;
    z-index: 10;
    transition: all 0.3s ease;
}

.step-card.active .step-number {
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(20, 184, 166, 0.5);
}

/* Animation Pulse */
.animation-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

/* Floating Cards */
.card-float {
    transition: transform 0.3s ease;
}

.card-float:hover {
    transform: translateY(-5px);
}

/* Improved floating cards styling */
.floating-cards {
    pointer-events: none; /* Allow clicking through when overlapping with content */
}

.floating-cards .js-tilt {
    pointer-events: auto; /* Re-enable pointer events for the cards themselves */
}

.leetcode-card {
    max-width: 110%; /* Increased from 100% */
    overflow: hidden; /* Prevent content overflow */
}

.leetcode-card pre {
    font-size: 0.88rem; /* Increased by 10% from 0.8rem */
    line-height: 1.4;
    max-height: 308px; /* Increased by 10% from 280px */
    overflow-y: auto; /* Allow vertical scrolling if needed */
}

/* Ensure proper display of the twoSum example function */
.leetcode-card pre code {
    display: block;
    padding: 0.55rem; /* Increased by 10% from 0.5rem */
    max-width: 100%;
    overflow-x: auto;
    white-space: pre;
    tab-size: 2;
}

/* Ensure line numbers don't cause horizontal overflow */
.line-numbers .line-numbers-rows {
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    padding-right: 0.55em; /* Increased by 10% from 0.5em */
}

/* Ensure anki card doesn't overlap */
.anki-card {
    max-width: 330px; /* Increased by 10% from 300px */
}

/* Feature Cards */
.feature-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
}

/* Installation Panel - Updated for better visibility */
.installation-panel {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
    transform: translateY(10px);
}

.installation-panel.active {
    display: block !important; /* Force display with !important */
    opacity: 1;
    transform: translateY(0);
}

/* Fix to make hidden truly hidden */
.installation-panel.hidden {
    display: none !important;
}

/* Add new progress bar styling */
.installation-progress {
    position: relative;
    height: 4px;
    background-color: #1e293b;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar {
    background-color: #14b8a6;
    height: 100%;
    width: 25%; /* Start with first step */
    transition: width 0.5s ease;
}

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

/* Copy Code Button */
.copy-code-btn {
    position: relative;
    text-decoration: none;
}

.copy-code-btn:after {
    content: '';
    position: absolute;
    width: 100%;
    height: 1px;
    bottom: -2px;
    left: 0;
    background-color: #14b8a6;
    transition: height 0.2s ease;
}

.copy-code-btn:hover:after {
    height: 2px;
}

/* Installation Images */
.installation-image {
    transition: transform 0.3s ease;
}

.installation-image:hover {
    transform: scale(1.03);
}

/* Step Line */
.step-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 16px;
    width: 2px;
    background-color: #1e293b;
    z-index: 0;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .floating-cards {
        display: none;
    }
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 640px) {
    /* Smaller font sizes on mobile */
    h1 {
        font-size: 2.25rem; /* Smaller headings on mobile */
    }
    
    .installation-tab {
        font-size: 0.8rem; /* Smaller tab text */
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .installation-number {
        width: 20px;
        height: 20px;
        font-size: 0.75rem;
    }
    
    /* Adjust step numbers for mobile */
    .step-number {
        width: 28px;
        height: 28px;
        font-size: 0.875rem;
    }
    
    /* Ensure code blocks don't overflow */
    pre {
        max-width: 100%;
        overflow-x: auto;
    }
}

/* Tablet adjustments */
@media (min-width: 641px) and (max-width: 1024px) {
    .floating-cards {
        transform: scale(0.8);
        top: 15px;
        right: 5px;
    }
}

/* Touch device enhancements */
@media (hover: none) {
    /* Make touch targets larger */
    .nav-link, .demo-nav-btn, .installation-tab {
        padding: 0.5rem;
    }
    
    .copy-code-btn {
        padding: 0.35rem 0;
    }
    
    /* Reduce hover animations that can cause issues on touch */
    .feature-card:hover {
        transform: translateY(-2px);
    }
}

/* Adjust vertical spacing on small screens */
@media (max-height: 700px) {
    section {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }
    
    .hero-section {
        padding-top: 6rem;
    }
}

/* Better table display on small screens */
@media (max-width: 640px) {
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
    }
}

/* Fix for installation panel scroll on small screens */
.installation-panel {
    overflow-x: hidden;
}

/* Improve mobile menu */
.mobile-menu-link {
    display: block;
    width: 100%;
}

/* Fix FAQ items to maintain independent heights during expansion */
.faq-item {
    height: auto;
    align-self: flex-start;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    max-width: 100%;
    margin-bottom: 1rem;
}

/* Ensure collapsible content doesn't affect grid layout */
#faq .grid {
    align-items: flex-start;
}

/* Fix x-collapse transition to prevent affecting sibling elements */
[x-cloak][x-collapse] {
    height: auto !important;
    overflow: hidden;
    transition-property: height, opacity;
    transition-duration: 0.3s;
}

/* Fix table responsive issues */
.responsive-table-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.responsive-table-container table {
    width: 100%;
    table-layout: fixed;
}

/* On mobile, transform the table to vertical cards */
@media (max-width: 640px) {
    .responsive-table-container thead {
        display: none;
    }
    
    .responsive-table-container tbody tr {
        display: block;
        margin-bottom: 1rem;
        border-bottom: 1px solid #374151;
        background-color: #1e293b;
    }
    
    .responsive-table-container td {
        display: flex;
        padding: 0.75rem;
        text-align: right;
        border-bottom: 1px solid #374151;
    }
    
    .responsive-table-container td:last-child {
        border-bottom: none;
    }
    
    .responsive-table-container td::before {
        content: attr(data-label);
        width: 50%;
        text-align: left;
        font-weight: 600;
        color: #9ca3af;
    }
}

/* Fix installation tabs on mobile */
.installation-tabs-container {
    position: relative;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.installation-tabs-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.installation-tabs-wrapper {
    display: inline-flex;
    min-width: 100%;
    padding-bottom: 0.5rem;
}

/* Make learning resources section stand out */
.learning-resources-section {
    position: relative;
    overflow: hidden;
    border: 2px solid #14b8a6;
    border-radius: 0.75rem;
    background: linear-gradient(to right, rgba(20, 184, 166, 0.1), rgba(20, 184, 166, 0.05));
}

.learning-resources-section::before {
    content: "";
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, rgba(20, 184, 166, 0.3), transparent, rgba(59, 130, 246, 0.3));
    z-index: -1;
    animation: rainbow-border 6s linear infinite;
}

@keyframes rainbow-border {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Video demo section styles */
.video-demo-section {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

.video-demo-section iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1e293b;
    border-radius: 0.75rem;
    color: white;
}

.google-sheets-feature {
    position: relative;
    border-left: 4px solid #14b8a6;
    padding-left: 1.5rem;
    margin-left: 1rem;
}

.google-sheets-feature::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 0;
    width: 16px;
    height: 16px;
    background-color: #14b8a6;
    border-radius: 50%;
}

/* Enhanced FAQ section */
.faq-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    max-width: 100%;
    margin-bottom: 1rem;
}

/* Modify the existing hover effect for better sequential display */
.faq-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
}

/* Improve FAQ content styling with better padding */
.faq-item [x-show] {
    padding-bottom: 2.5rem; /* Added more padding at the bottom */
    padding-top: 0.75rem; /* Add top padding for better spacing */
    transition: all 0.5s ease-in-out; /* Make transition more noticeable */
}

/* Improve collapse animation */
[x-collapse] {
    transition: height 0.5s ease-in-out, opacity 0.5s ease-in-out, padding 0.5s ease-in-out !important;
    overflow: hidden !important;
}

/* Add smooth entrance for content */
.faq-item [x-show] p, 
.faq-item [x-show] code,
.faq-item [x-show] ul,
.faq-item [x-show] ol,
.faq-item [x-show] li {
    transition: transform 0.5s ease, opacity 0.5s ease;
}

/* Fix for Alpine.js x-collapse animation */
[x-collapse] {
    overflow: hidden !important;
    transition-property: height !important;
    height: 0 !important;
}

[x-collapse].x-collapse-active {
    height: auto !important;
    transition: height 0.5s ease-in-out !important; /* Slow down transition */
}

/* Add indicator for FAQ item hover/focus */
.faq-item button:hover,
.faq-item button:focus {
    background-color: rgba(255, 255, 255, 0.05); /* Subtle highlight on hover */
    transition: background-color 0.3s ease;
}

/* Add transition for the arrow in FAQ items */
.faq-item button svg {
    transition: transform 0.5s ease-in-out; /* Slow down arrow rotation */
}

/* Fix for Alpine.js x-collapse animation */
[x-collapse] {
    overflow: hidden !important;
    transition-property: height !important;
    height: 0 !important;
}

[x-collapse].x-collapse-active {
    height: auto !important;
}

/* Fix table display on mobile */
@media (max-width: 640px) {
    /* Better table display - transform into vertical cards instead of horizontal scrolling */
    .responsive-table-container {
        margin: 0 -1rem; /* Negative margin to align with container padding */
    }
    
    .responsive-table-container table {
        table-layout: auto;
        border-collapse: separate;
        border-spacing: 0;
    }
    
    .responsive-table-container tbody tr {
        margin-bottom: 1.5rem;
        box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
        display: block;
    }
    
    .responsive-table-container td::before {
        font-weight: 700;
        margin-right: 1rem;
    }
}

/* Fix the scrolling installation tabs */
.installation-tabs-container {
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    padding-bottom: 4px; /* Prevent cut-off */
}

.installation-tabs-container::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome/Safari/Opera */
}

.installation-tab {
    min-width: max-content; /* Prevent too narrow tabs */
    margin-right: 0.5rem;
}

/* Fix for desktop scrollbar showing in tab container */
@media (min-width: 768px) {
    .installation-tabs-container {
        overflow-x: visible;
        overflow-y: visible;
    }
}

/* Fix for Alpine.js Collapse Plugin - Update x-collapse styles to fix animation */
[x-collapse] {
    transition: height 0.5s ease-in-out, opacity 0.5s ease-in-out !important;
    overflow: hidden !important;
    height: 0;
}

[x-collapse].x-collapse-active {
    height: auto;
}

/* Improve FAQ content styling with better padding */
.faq-item [x-show] {
    padding-bottom: 2.5rem; /* Added more padding at the bottom */
    padding-top: 0.75rem; /* Add top padding for better spacing */
    transition: all 0.5s ease-in-out; /* Make transition more noticeable */
}

/* Prevent duplicate animations due to multiple x-collapse transitions */
.faq-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    max-width: 100%; 
    margin-bottom: 1rem;
}

/* Add specific style for the FAQ content to prevent height issues */
.faq-item [x-collapse] {
    display: block;
    width: 100%;
}
