/* Custom CSS for additional styling */

/* CRITICAL: Force component isolation */
.tool-section {
    display: none;
}

.tool-section.active {
    display: block !important;
}

#landing-section {
    display: block;
}
.converter-card {
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.converter-card:hover {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Drag and drop styling */
#upload-area.dragover {
    border-color: #8b5cf6;
    background-color: rgba(139, 92, 246, 0.1);
    transform: scale(1.02);
}

/* Animated glow effect */
.converter-card {
    position: relative;
    overflow: hidden;
}

.converter-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #8b5cf6, #ec4899, #f59e0b, #10b981);
    background-size: 400% 400%;
    border-radius: 1rem;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
    animation: gradient-border 4s ease infinite;
}

.converter-card:hover::before {
    opacity: 0.7;
}

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

/* Global Land Unit Converter - Collapsible Regions */
.region-section {
    margin-bottom: 1rem;
}

.region-toggle {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.region-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.region-toggle:active {
    transform: translateY(0);
}

.region-content {
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: max-height, opacity;
}

/* Banner Ad Consistency - Desktop and Mobile */

/* Desktop Banner Positioning */

/* Mobile Banner Styling */
@media (max-width: 1024px) {

    /* Mobile banner placement below tool content */
    .tool-section 
}

/* Development Ad Placeholders */

/* Ensure AdSense placeholders are visible */

/* Component page specific banner styling */
.component-page 

.region-content.collapsed {
    max-height: 0 !important;
    opacity: 0 !important;
    overflow: hidden;
}

.region-content.expanded {
    opacity: 1 !important;
    overflow: visible;
}

.chevron {
    transition: transform 0.2s ease;
    display: inline-block;
    line-height: 1;
}

/* Mobile optimizations for collapsible regions */
@media (max-width: 768px) {
    .region-toggle {
        padding: 1rem;
    }
    
    .region-toggle h3 {
        font-size: 1rem;
    }
    
    .region-content .grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 0.75rem;
    }
    
    .chevron {
        font-size: 1.25rem;
    }
}

/* Enhanced Mobile Button Sizes for Touch Accessibility */
@media (max-width: 768px) {
    /* Primary action buttons minimum 48px height */
    button, 
    input[type="submit"], 
    input[type="button"],
    .btn {
        min-height: 48px !important;
        padding: 12px 16px !important;
        font-size: 16px !important;
    }
    
    /* Mobile menu button enhanced touch target */
    #mobile-menu-btn {
        min-height: 48px !important;
        min-width: 48px !important;
        padding: 12px !important;
    }
    
    /* Authentication buttons */
    .auth-btn {
        min-height: 48px !important;
        padding: 12px 24px !important;
        font-size: 16px !important;
    }
    
    /* Cookie consent button */
    .cookie-consent-btn {
        min-height: 48px !important;
        padding: 12px 24px !important;
        font-size: 16px !important;
    }
    
    /* Tool action buttons */
    .tool-section button {
        min-height: 48px !important;
        padding: 12px 24px !important;
        font-size: 16px !important;
    }
    
    /* Input fields for better touch interaction */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="url"],
    input[type="number"],
    textarea,
    select {
        min-height: 48px !important;
        padding: 12px 16px !important;
        font-size: 16px !important;
    }
    
    /* File upload areas */
    input[type="file"] {
        min-height: 48px !important;
        padding: 12px !important;
    }
    
    /* Navigation links */
    .nav-link,
    .mobile-nav-link {
        min-height: 48px !important;
        padding: 12px 16px !important;
        display: flex !important;
        align-items: center !important;
    }
}

/* Smooth card hover animations for land converter */
.bg-white.hover\:scale-105:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Focus states for accessibility */
.region-toggle:focus {
    outline: none;
    ring: 2px;
    ring-color: #3b82f6;
    ring-offset: 2px;
}

/* Enhanced unit count badge */
.region-toggle .text-gray-500 {
    background: rgba(107, 114, 128, 0.1);
    padding: 0.125rem 0.5rem;
    border-radius: 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Enhanced Instagram DP Resizer Styling */
#dp-upload-area {
    position: relative;
    transition: all 0.3s ease;
}

#dp-upload-area:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

#dp-upload-area.dragover {
    border-color: #ec4899;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.1), rgba(147, 51, 234, 0.1));
    transform: scale(1.02);
    box-shadow: 0 12px 30px rgba(236, 72, 153, 0.2);
}

/* Canvas responsive styling */
#dp-canvas {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    #dp-canvas {
        width: 240px;
        height: 240px;
    }
}

/* Toggle switch styling */
#watermark-toggle:checked + div,
#background-option:checked + div {
    background-color: #8b5cf6;
}

#watermark-toggle:checked + div .dot,
#background-option:checked + div .dot {
    transform: translateX(1.5rem);
    background-color: white;
}

/* Notification animations */
.notification-enter {
    transform: translateX(100%);
    opacity: 0;
}

.notification-enter-active {
    transform: translateX(0);
    opacity: 1;
    transition: all 0.3s ease;
}

.notification-exit {
    transform: translateX(0);
    opacity: 1;
}

.notification-exit-active {
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
}

/* Enhanced upload area animations */
.upload-content {
    transition: all 0.3s ease;
}

#dp-upload-area:hover .upload-content {
    transform: translateY(-3px);
}

#dp-upload-area.dragover .upload-content {
    transform: scale(1.05);
}

/* Preview grid responsiveness */
@media (max-width: 768px) {
    #dp-preview .grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    #dp-upload-area {
        padding: 2rem 1rem;
    }
    
    #dp-upload-area h4 {
        font-size: 1rem;
    }
    
    #dp-upload-area .text-5xl {
        font-size: 3rem;
    }
}

/* Removed duplicate rule - using unified rule above */

/* Enhanced toggle switch hover and active states */
label:hover #watermark-toggle + div,
label:hover #background-option + div {
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

#watermark-toggle:checked + div,
#background-option:checked + div {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
}

#watermark-toggle:focus + div,
#background-option:focus + div {
    outline: 2px solid #8b5cf6;
    outline-offset: 2px;
}

/* Ensure proper alignment on all screen sizes */
@media (max-width: 768px) {
    .inline-flex {
        flex-wrap: nowrap;
    }
}

/* Progress bar glow */
#progress-bar {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
    animation: progress-glow 2s ease-in-out infinite alternate;
}

@keyframes progress-glow {
    from { box-shadow: 0 0 20px rgba(139, 92, 246, 0.6); }
    to { box-shadow: 0 0 30px rgba(236, 72, 153, 0.8); }
}

.nav-link {
    position: relative;
    transition: all 0.3s ease;
}

.nav-link:hover::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #8b5cf6, #f59e0b);
    border-radius: 1px;
}

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

/* Mobile Layout Fixes - Update 1 */
@media (max-width: 375px) {
    /* Tool card improvements */
    .converter-card {
        padding: 1rem;
        margin: 0.5rem;
    }
    
    /* Button spacing and visibility */
    .tool-card button,
    .converter-card button {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        margin-top: 0.5rem;
        min-height: 44px; /* Touch-friendly minimum */
    }
    
    /* Try Now buttons */
    button[data-target] {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }
    
    /* Convert buttons */
    .btn-primary,
    .bg-gradient-to-r {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
        min-height: 44px;
    }
    
    /* Result sections */
    .result-section {
        padding: 1rem;
        margin-top: 1rem;
    }
    
    /* Form elements */
    input[type="text"],
    input[type="number"],
    select,
    textarea {
        padding: 0.75rem;
        font-size: 1rem;
        min-height: 44px;
    }
    
    /* Container padding */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Grid adjustments */
    .grid {
        gap: 1rem;
    }
    
    /* Tool sections */
    .tool-section {
        padding: 1rem;
    }
}

/* Tool Grid Centering - Update 2 */
.tools-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.tools-grid .grid {
    justify-items: center;
    align-items: stretch;
}

/* AdSense Banner Improvements - Update 3 */

/* Landing page banner - single vertical */

/* Component page vertical banners only */

/* Mobile AdSense adjustments */
@media (max-width: 768px) {

    /* Hide all horizontal banners on mobile */

    /* Ensure ad placeholders are visible in development */
    
}

/* Lazy loading improvements */

/* Loading animation */
.loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: .5;
    }
}

/* Gradient text animation */
@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.animate-gradient {
    background-size: 200% 200%;
    animation: gradient 3s ease infinite;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(145deg, #8b5cf6, #f59e0b);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(145deg, #7c3aed, #d97706);
}

/* Mobile responsiveness improvements */
@media (max-width: 768px) {
    .tool-card {
        margin-bottom: 2rem;
    }
    
    .grid {
        grid-template-columns: 1fr;
    }
    
    /* Hide navigation on mobile */
    .nav-link {
        display: none;
    }
    
    /* Improve mobile header */
    h1 {
        font-size: 1.5rem !important;
    }
    
    /* Improve mobile hero text */
    .text-4xl {
        font-size: 2rem !important;
    }
    
    .text-6xl {
        font-size: 2.5rem !important;
    }
    
    /* Better mobile spacing */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Mobile menu button - ensure visibility and touch-friendly */
    #mobile-menu-btn {
        display: flex !important;
        min-height: 48px !important;
        min-width: 48px !important;
        padding: 12px !important;
        touch-action: manipulation;
        background-color: transparent;
        border: none;
        cursor: pointer;
    }
    
    #mobile-menu-btn:hover {
        background-color: rgba(139, 92, 246, 0.1);
        border-radius: 8px;
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    .grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .tool-card {
        padding: 1.5rem;
    }
    
    /* Stack currency dropdowns vertically on very small screens */
    #currency .grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

/* Button hover effects */
button:hover {
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

button:active {
    transform: translateY(0);
}

/* File input styling */
input[type="file"] + label:hover {
    background-color: rgba(139, 92, 246, 0.05);
    border-color: #8b5cf6;
}

/* Result animations */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

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

/* === AdSense Integration === */
/* Base ad visibility */

/* Development mode - show placeholders, hide ads */
body[data-env="development"] 

body[data-env="development"] 

/* Only show vertical ad placeholders in development */
body[data-env="development"] 

/* Mobile ad placeholder visibility - hide horizontal, show only sidebar verticals */
@media (max-width: 768px) {
    body[data-env="development"] 
    
    /* Only vertical placeholders for desktop view */
    body[data-env="development"] 
}

/* Clean responsive ad styling */

/* === Responsive Sidebar Ads === */

/* Landing Page - Right Sidebar Ad */

    /* Ensure ad placeholders are visible on mobile in development */
    body[data-env="development"] 
    
    /* Only show vertical sidebar placeholders */
    body[data-env="development"] 
}

/* Premium users - hide all ads */
body[data-user-plan="standard"] 

/* Ensure main content doesn't overlap with sidebar ads on desktop */
@media (min-width: 1024px) {
    /* Add padding to main sections to avoid ad overlap */
    .tool-section .container,
    main.container {
        padding-left: 200px;
        padding-right: 200px;
    }
    
    /* Landing page adjustments */
    body > .container {
        padding-left: 200px;
        padding-right: 200px;
    }
}

/* =====================================================
   AdSense Banner Layout Fixes - Vertical Positioning
   ===================================================== */

/* Base AdSense banner styling */

/* Vertical Left AdSense Banner for Landing Page */

/* Vertical Right AdSense Banner for Component Pages */

/* AdSense banner hover effects */

/* AdSense banner responsive adjustments */
@media (max-width: 1400px) {

}

@media (max-width: 1200px) {

    /* Remove padding adjustments when banners are hidden */
    .tool-section .container,
    main.container,
    body > .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

/* Landing page specific banner positioning */
.landing-page 

/* Component pages banner positioning */
.component-page 

/* Ensure banners don't interfere with navigation */

/* AdSense placeholder styling for development */

/* Smooth transitions for banner visibility */

/* =====================================================
   QR Generator AdSense Banner Positioning
   ===================================================== */

/* QR Generator specific left banner positioning */

/* QR Generator specific right banner positioning */

/* QR Generator bottom banner positioning */

/* QR Generator banner hover effects */

/* QR Generator responsive banner adjustments */
@media (max-width: 1400px) {

}

@media (max-width: 1200px) {

}

@media (max-width: 768px) {
    
}

@media (max-width: 480px) {
    
}

/* =====================================================
   QR Generator Component Layout Fixes
   ===================================================== */

/* QR Generator Canvas Container */
#qr-generator-section .min-h-[280px] {
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* QR Canvas Positioning */
#qr-canvas {
    max-width: 100%;
    max-height: 250px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* QR Generator Grid Layout */
#qr-generator-section .grid {
    gap: 2rem;
}

@media (max-width: 1024px) {
    #qr-generator-section .grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* QR Generator Responsive Layout */
@media (max-width: 768px) {
    #qr-generator-section .converter-card {
        padding: 1.5rem;
    }
    
    #qr-generator-section .grid {
        gap: 1rem;
    }
    
    #qr-canvas {
        max-height: 200px;
    }
}

/* QR Generator Button Spacing */
#qr-generator-section .flex.gap-4 {
    flex-wrap: wrap;
    gap: 1rem;
}

#qr-generator-section .flex.gap-4 button {
    flex: 1;
    min-width: 120px;
}

/* QR Generator Template Buttons */
#qr-generator-section .grid.grid-cols-2 {
    gap: 0.5rem;
}

@media (max-width: 640px) {
    #qr-generator-section .grid.grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}

/* Ensure QR generator doesn't get pushed by AdSense banners */
@media (min-width: 1200px) {
    #qr-generator-section .container {
        max-width: calc(100% - 200px);
        margin-left: auto;
        margin-right: auto;
    }
}

/* =====================================================
   Mobile AdSense Banner Adjustments
   ===================================================== */

/* Hide vertical banners on mobile devices to prevent screen coverage */
@media (max-width: 1024px) {
    
}

/* Mobile-only banner adjustments for component pages */
@media (max-width: 768px) {
    /* Hide all vertical AdSense banners on mobile */

    /* Ensure component pages have full width on mobile */
    .tool-section .container {
        max-width: 100% !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

/* Ultra-mobile adjustments */
@media (max-width: 480px) {
    .tool-section .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}
