/**
 * Enhanced Mobile and Tablet Optimization
 * 
 * This CSS file provides improved mobile and tablet experiences for the Yoga Tarot application.
 * It includes optimizations for:
 * - iPad and tablet displays
 * - Mobile devices
 * - Touch-friendly controls
 * - Stiky visibility
 * - Card and text sizing
 */

/* Tablet-specific optimizations (iPad, etc.) */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Improved card display for tablets */
    .yoga-card {
        width: var(--card-width-tablet);
        height: var(--card-height-tablet);
        margin: 0 auto;
    }
    
    /* Enhanced Stiky visibility on tablets */
    .stiky-container {
        width: 150px;
        height: 150px;
        bottom: 30px;
        left: 30px;
    }
    
    .sticky-yogi-wrapper {
        width: 400px;
        height: 400px;
    }
    
    /* Better touch targets for buttons */
    .btn, button, .nav-link {
        padding: 10px 16px;
        min-height: 44px;
        margin-bottom: 8px;
    }
    
    /* Improve reading layouts */
    .reading-container .row {
        margin: 0 auto;
        max-width: 90%;
    }
    
    /* Enhance practice screen */
    #sticky-yogi-practice {
        max-width: 220px;
        max-height: 220px;
    }
    
    /* Better spacing for card details */
    .card-detail-container {
        padding: 15px;
    }
    
    /* Enhanced breathing circle on tablets */
    .breathing-circle {
        width: 300px;
        height: 300px;
    }
    
    /* Improved guidance text visibility */
    .practice-narrative-text {
        font-size: 1.2rem;
        max-width: 90%;
        margin: 0 auto;
        padding: 15px;
    }
}

/* Mobile optimizations */
@media (max-width: 767px) {
    /* Reduce card size further on very small screens */
    @media (max-width: 375px) {
        :root {
            --card-width-mobile: 220px;
            --card-height-mobile: 387px;
        }
    }
    
    /* Enhanced Stiky for mobile screens */
    #sticky-yogi-practice svg {
        max-width: 120px;
        max-height: 120px;
        stroke-width: 4px; /* Thicker lines for better visibility */
    }
    
    /* Adjust breathing circle for better Stiky visibility */
    .breathing-circle {
        width: 200px;
        height: 200px;
    }
    
    /* Fix padding and margins */
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Better touch targets for controls */
    .btn, button, .nav-link, .card-link {
        padding: 12px 16px;
        min-height: 48px;
        margin-bottom: 8px;
        font-size: 1.1rem;
    }
    
    /* Improved practice controls */
    .practice-controls {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .practice-controls .btn {
        width: 100%;
        max-width: 280px;
    }
    
    /* Enhanced voice controls for better visibility */
    .voice-controls {
        width: 100%;
        max-width: 280px;
        margin: 10px auto;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    /* Better position for the floating Stiky */
    .stiky-container {
        bottom: 15px;
        left: 15px;
        width: 90px;
        height: 90px;
    }
    
    /* Enhanced daily card quick action buttons */
    .yoga-card .card-quick-actions {
        opacity: 1; /* Always visible on mobile */
        flex-direction: row;
        right: 50%;
        transform: translateX(50%);
        bottom: 10px;
    }
    
    .btn-card-action {
        width: 32px;
        height: 32px;
        font-size: 12px;
        margin: 0 5px;
        background-color: rgba(255, 255, 255, 0.9);
    }
    
    /* Improve daily card display */
    .daily-card-container {
        margin-bottom: 1.5rem;
    }
    
    /* Fix for button groups in the daily card info section */
    .daily-card-info .card-footer {
        flex-direction: column;
        gap: 15px;
    }
    
    .daily-card-info .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .daily-card-info .btn-group .btn {
        margin: 5px 0;
        width: 100%;
    }
    
    /* Ensure visible stroke width for Stiky */
    .stiky-container svg {
        stroke-width: 4px;
    }
    
    /* Improve speech bubble visibility */
    .stiky-joke {
        left: -40px;
        top: -40px;
        width: 180px;
        font-size: 13px;
        padding: 8px 12px;
        background-color: rgba(26, 26, 46, 0.9);
        border: 2px solid rgba(255, 255, 255, 0.4);
    }
    
    /* Ensure practice narrative is clearly visible */
    .practice-narrative-text {
        background: rgba(20, 30, 50, 0.9);
        font-size: 1.05rem;
        padding: 15px;
        margin: 0 auto;
        max-width: 100%;
    }
    
    /* Make card-reading preview more legible */
    .card-reading-preview {
        font-size: 1.05rem;
        text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.9);
    }
    
    /* Optimized loading screen */
    .yoga-mat {
        width: 280px !important;
        height: 140px !important;
    }
    
    .sticky-yogi-wrapper {
        width: 300px !important;
        height: 300px !important;
    }
}

/* Orientation-specific adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    /* Adjustments for landscape mode on small devices */
    .sticky-yogi-wrapper {
        width: 250px !important;
        height: 250px !important;
    }
    
    .yoga-mat {
        width: 250px !important;
        height: 125px !important;
    }
    
    .loading-title h1 {
        font-size: 1.8rem;
    }
    
    .loading-subtitle {
        font-size: 1rem;
    }
    
    /* For very short heights, even smaller */
    @media (max-height: 450px) {
        .sticky-yogi-wrapper {
            width: 200px !important;
            height: 200px !important;
        }
        
        .yoga-mat {
            width: 200px !important;
            height: 100px !important;
        }
    }
}

/* Touch friendly enhancements for all screen sizes */
.card, .btn, .nav-link, .dropdown-item, .form-control {
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
}

/* Enhanced practice visualization for all devices */
.breathing-circle {
    background: radial-gradient(circle at center, 
        rgba(138, 43, 226, 0.6), 
        rgba(138, 43, 226, 0.4)
    );
    box-shadow: 0 0 30px rgba(138, 43, 226, 0.6);
}

/* Make cosmic particles more visible */
.cosmic-particle {
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

/* Enhanced radiance effect around Stiky */
#sticky-yogi-practice::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    background: radial-gradient(
        circle at center,
        rgba(255, 255, 255, 0.8) 0%,
        rgba(200, 180, 255, 0.7) 30%,
        rgba(140, 100, 255, 0.5) 60%,
        transparent 100%
    );
    border-radius: 50%;
    z-index: -1;
    filter: blur(15px);
    pointer-events: none;
}

/* Fix for tablet navigation */
@media (min-width: 768px) and (max-width: 991px) {
    .navbar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .navbar-nav .nav-item {
        margin: 0 5px;
    }
}

/* Improved iPad Pro layout */
@media (min-width: 1024px) and (max-width: 1366px) {
    .container {
        max-width: 95%;
    }
    
    .card-deck .card {
        margin-bottom: 15px;
    }
}

/* Better scrolling experience */
* {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Ensure Stiky is visible on all screens */
.stiky-container.loading-active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}