/* Custom styles for mobile responsiveness */

/* Hero gradient background */
.hero-gradient {
    background: linear-gradient(135deg, #3B82F6 0%, #10B981 100%);
}

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
}

/* Touch optimization for interactive elements */
.touch-manipulation {
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* AdSense container responsive styles - Optimized */
.adsense-container {
    max-width: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    min-height: 90px;
    position: relative;
}

.adsense-container ins {
    min-width: 300px;
    min-height: 90px;
}

/* Ad loading placeholder */
.adsense-container::before {
    content: '';
    display: block;
    width: 100%;
    height: 90px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: adLoading 1.5s infinite;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.adsense-container ins.adsbygoogle[data-loaded="true"] + ::before {
    display: none;
}

@keyframes adLoading {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Different ad sizes for optimal display */
.adsense-container.banner {
    min-height: 90px;
}

.adsense-container.rectangle {
    min-height: 250px;
}

.adsense-container.in-article {
    min-height: 120px;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 10px;
}

/* Mobile ad optimizations */
@media (max-width: 640px) {
    .adsense-container {
        min-height: 80px;
    }
    
    .adsense-container ins {
        min-width: 280px;
        min-height: 80px;
    }
    
    .adsense-container::before {
        height: 80px;
    }
}

/* Fast loading skeleton */
.ad-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Mobile-specific button adjustments */
@media (max-width: 640px) {
    /* Increase touch targets for mobile */
    button, a, input, select {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Improve form spacing on mobile */
    input, select {
        padding: 12px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Better mobile table display */
    .table-responsive {
        font-size: 14px;
    }
    
    /* Optimize mobile navigation */
    #mobile-menu {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-in-out;
    }
    
    #mobile-menu.show {
        max-height: 300px;
    }
}

/* Tablet-specific adjustments */
@media (min-width: 641px) and (max-width: 1024px) {
    /* Tablet-specific styles */
    .container-padding {
        padding-left: 24px;
        padding-right: 24px;
    }
}

/* Focus states for better accessibility */
button:focus,
input:focus,
select:focus,
a:focus {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

/* Animation for tab switching */
.tab-content {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.tab-content.active {
    opacity: 1;
    transform: translateY(0);
}

/* Mobile-optimized form layouts */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 640px) {
    .form-row {
        flex-direction: row;
        align-items: center;
        gap: 16px;
    }
}

/* Responsive grid for subject/semester inputs */
.input-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .input-grid {
        grid-template-columns: 2fr 1fr 1fr auto;
        align-items: center;
        gap: 16px;
    }
}

/* Mobile-friendly delete buttons */
.delete-btn {
    background: #EF4444;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    min-height: 40px;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-btn:hover {
    background: #DC2626;
}

/* Responsive text sizes */
@media (max-width: 640px) {
    .text-responsive-sm {
        font-size: 0.875rem;
    }
    
    .text-responsive-base {
        font-size: 1rem;
    }
    
    .text-responsive-lg {
        font-size: 1.125rem;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Error states */
.input-error {
    border-color: #EF4444 !important;
    box-shadow: 0 0 0 1px #EF4444;
}

/* Success states */
.input-success {
    border-color: #10B981 !important;
    box-shadow: 0 0 0 1px #10B981;
}

/* Mobile navigation improvements */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.mobile-nav-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Improved mobile spacing */
.mobile-spacing {
    padding: 16px;
}

@media (min-width: 640px) {
    .mobile-spacing {
        padding: 24px;
    }
}

@media (min-width: 1024px) {
    .mobile-spacing {
        padding: 32px;
    }
}

/* Prevent horizontal scroll on mobile */
body {
    overflow-x: hidden;
}

/* Better mobile table scrolling */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobile-optimized result displays */
.result-card {
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    margin: 16px 0;
}

@media (min-width: 640px) {
    .result-card {
        padding: 24px;
        margin: 24px 0;
    }
}

/* FAQ accordion animations */
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, padding 0.3s ease-in-out;
}

.faq-answer.show {
    max-height: 200px;
    padding-top: 16px;
}

/* Mobile-first responsive utilities */
.hide-mobile {
    display: none;
}

@media (min-width: 640px) {
    .hide-mobile {
        display: block;
    }
    
    .show-mobile {
        display: none;
    }
}

/* Improve mobile form validation */
.validation-message {
    font-size: 0.875rem;
    margin-top: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    display: none;
}

.validation-message.error {
    color: #EF4444;
    background: #FEE2E2;
    display: block;
}

.validation-message.success {
    color: #10B981;
    background: #D1FAE5;
    display: block;
}

/* Mobile keyboard optimization */
@media (max-width: 640px) {
    /* Prevent zoom when focusing inputs on iOS */
    input[type="text"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Enhanced mobile touch areas */
.touch-target {
    min-height: 48px;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile-optimized animations */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
