/* Enhanced Responsive Styles for Iframe Optimization */

/* Base iframe container styles */
.tracker-iframe-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    background: transparent;
}

.tracker-iframe {
    display: block;
    border: none;
    border-radius: 0;
    background: transparent;
    transition: height 0.3s ease;
}

/* Desktop optimizations (1200px and above) */
@media (min-width: 1200px) {
    .tracker-iframe {
        height: 85vh !important;
        min-height: 700px !important;
        max-height: none !important;
    }
    
    .tracker-embed-wrapper {
        padding: 10px;
        margin: 0;
    }
    
    .tracking-container {
        max-width: 1400px;
        margin: 0 auto;
        padding: 0 20px;
    }
}

/* Large desktop (1600px and above) */
@media (min-width: 1600px) {
    .tracker-iframe {
        height: 90vh !important;
        max-height: none !important;
    }
}

/* Standard desktop (992px to 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .tracker-iframe {
        height: 80vh !important;
        min-height: 600px !important;
        max-height: none !important;
    }
    
    .tracker-embed-wrapper {
        padding: 8px;
    }
}

/* Tablet landscape (768px to 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .tracker-iframe {
        height: 65vh !important;
        min-height: 480px !important;
        max-height: 700px !important;
    }
    
    .tracker-embed-wrapper {
        padding: 12px;
    }
    
    .tracker-controls {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .tracker-actions {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .tracker-btn {
        flex: 1;
        min-width: 120px;
        max-width: 140px;
    }
}

/* Tablet portrait and large mobile (481px to 767px) - Enhanced */
@media (min-width: 481px) and (max-width: 767px) {
    .tracker-section {
        padding: var(--spacing-2xl) 0;
    }
    
    .tracker-container {
        padding: 0 var(--spacing-md);
    }
    
    .tracker-title {
        font-size: 1.75rem !important;
        text-align: center;
    }
    
    .tracker-description {
        text-align: center;
        font-size: 1rem;
        padding: 0;
    }
    
    .tracker-embed-container {
        border-radius: 16px;
        overflow: hidden;
        box-shadow: 0 12px 48px rgba(0, 102, 204, 0.15);
        margin: 0;
    }
    
    .tracker-iframe {
        height: 65vh !important;
        min-height: 450px !important;
        max-height: 700px !important;
        width: 100%;
        border: none;
        background: #ffffff;
    }
    
    .tracker-status-bar {
        flex-direction: column;
        gap: var(--spacing-md);
        padding: var(--spacing-md);
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(12px);
        border-radius: 12px;
        margin-bottom: var(--spacing-md);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    }
    
    .status-indicator {
        justify-content: center;
    }
    
    .tracker-controls {
        justify-content: center;
        gap: var(--spacing-sm);
        flex-wrap: wrap;
    }
    
    .tracker-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
        border-radius: 10px;
        box-shadow: 0 3px 12px rgba(0, 102, 204, 0.2);
        min-width: 120px;
    }
    
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }
    
    .tracker-footer {
        flex-direction: column;
        gap: var(--spacing-lg);
        text-align: center;
        padding: var(--spacing-lg);
        border-radius: 12px;
    }
    
    .footer-stats {
        justify-content: space-around;
        gap: var(--spacing-lg);
    }
}

/* Mobile devices (480px and below) - Enhanced for beautiful iframe display */
@media (max-width: 480px) {
    .tracker-section {
        padding: var(--spacing-xl) 0;
    }
    
    .tracker-container {
        padding: 0 var(--spacing-sm);
    }
    
    .tracker-header {
        margin-bottom: var(--spacing-lg);
    }
    
    .tracker-title {
        font-size: 1.5rem !important;
        line-height: 1.3;
        text-align: center;
        margin-bottom: var(--spacing-sm);
    }
    
    .tracker-description {
        font-size: 0.9rem;
        text-align: center;
        padding: 0;
        margin-bottom: var(--spacing-md);
    }
    
    .tracker-embed-container {
        margin: 0 -10px;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 8px 32px rgba(0, 102, 204, 0.15);
        border: none;
        background: #ffffff;
    }
    
    .tracker-iframe {
        height: 70vh !important;
        min-height: 400px !important;
        max-height: 650px !important;
        width: 100%;
        border: none;
        border-radius: 0;
        background: #f8f9fa;
        display: block;
    }
    
    .tracker-status-bar {
        flex-direction: column;
        gap: var(--spacing-sm);
        padding: var(--spacing-sm);
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        border-radius: 10px;
        margin: 0 var(--spacing-xs) var(--spacing-sm);
        box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
    }
    
    .status-indicator {
        justify-content: center;
    }
    
    .status-dot {
        width: 10px;
        height: 10px;
    }
    
    .status-text {
        font-size: 0.85rem;
        font-weight: 600;
    }
    
    .tracker-controls {
        justify-content: center;
        gap: var(--spacing-xs);
    }
    
    .tracker-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
        border-radius: 8px;
        min-width: auto;
        flex: none;
        box-shadow: 0 2px 8px rgba(0, 102, 204, 0.2);
    }
    
    .tracker-btn span {
        display: none;
    }
    
    .tracker-btn i {
        margin: 0;
        font-size: 1.1rem;
    }
    
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
        margin-top: var(--spacing-md);
    }
    
    .info-card {
        padding: var(--spacing-sm);
        border-radius: 10px;
        text-align: center;
    }
    
    .info-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        margin-bottom: var(--spacing-xs);
    }
    
    .info-card h4 {
        font-size: 0.9rem;
        margin-bottom: var(--spacing-xs);
    }
    
    .info-card p {
        font-size: 0.8rem;
        line-height: 1.4;
    }
    
    .tracker-footer {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
        padding: var(--spacing-md);
        margin: var(--spacing-sm) var(--spacing-xs) 0;
        border-radius: 10px;
    }
    
    .footer-stats {
        justify-content: space-around;
        gap: var(--spacing-md);
        width: 100%;
    }
    
    .stat-mini {
        flex: 1;
    }
    
    .stat-value {
        font-size: 1.3rem;
        margin-bottom: 2px;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .powered-by {
        font-size: 0.8rem;
    }
    
    .info-title {
        font-size: 0.8rem;
    }
    
    .info-value {
        font-size: 1.2rem;
    }
    
    .info-description {
        font-size: 0.7rem;
    }
}

/* Extra small mobile (320px and below) - Enhanced */
@media (max-width: 320px) {
    .tracker-section {
        padding: var(--spacing-lg) 0;
    }
    
    .tracker-title {
        font-size: 1.3rem !important;
        line-height: 1.2;
    }
    
    .tracker-description {
        font-size: 0.8rem;
        margin-bottom: var(--spacing-sm);
    }
    
    .tracker-embed-container {
        margin: 0 -8px;
        border-radius: 10px;
    }
    
    .tracker-iframe {
        height: 60vh !important;
        min-height: 350px !important;
        max-height: 450px !important;
    }
    
    .tracker-status-bar {
        padding: var(--spacing-xs);
        margin: 0 var(--spacing-xs) var(--spacing-xs);
    }
    
    .status-text {
        font-size: 0.75rem;
    }
    
    .tracker-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-xs);
    }
    
    .info-card {
        padding: var(--spacing-xs);
    }
    
    .info-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .info-card h4 {
        font-size: 0.8rem;
    }
    
    .info-card p {
        font-size: 0.7rem;
    }
    
    .tracker-footer {
        padding: var(--spacing-sm);
        gap: var(--spacing-sm);
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
}

/* Landscape orientation optimizations */
@media (max-height: 600px) and (orientation: landscape) {
    .tracker-iframe {
        height: 80vh !important;
        min-height: 300px !important;
    }
    
    .tracking-header {
        padding: 10px 0;
    }
    
    .tracking-title {
        font-size: 1.5rem;
    }
    
    .tracking-description {
        font-size: 0.9rem;
    }
}

/* High DPI/Retina display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
    .tracker-iframe {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print styles */
@media print {
    .tracker-controls,
    .tracker-info {
        display: none;
    }
    
    .tracker-iframe {
        height: 500px !important;
        border: 1px solid #ccc;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .tracker-iframe {
        transition: none;
    }
    
    .loading-spinner {
        animation: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .tracker-iframe-container {
        background: #2c3e50;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    
    .tracker-iframe {
        background: #34495e;
    }
    
    .tracker-controls {
        background: rgba(44, 62, 80, 0.95);
        color: #ecf0f1;
    }
}

/* Accessibility improvements */
@media (prefers-contrast: high) {
    .tracker-iframe-container {
        border: 2px solid #000;
    }
    
    .tracker-controls {
        border: 1px solid #000;
        background: #fff;
        color: #000;
    }
}

/* Focus styles for keyboard navigation */
.tracker-iframe:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .tracker-btn {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    .tracker-btn:active {
        background: rgba(102, 126, 234, 0.8);
        transform: scale(0.98);
    }
}

/* Loading state optimizations */
.tracker-loading {
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    color: #6c757d;
    font-size: 0.95rem;
    text-align: center;
    max-width: 200px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Fullscreen mode optimizations */
.tracker-embed-wrapper:fullscreen {
    background: #000;
    padding: 0;
}

.tracker-embed-wrapper:fullscreen .tracker-iframe {
    height: 100vh !important;
    border-radius: 0;
}

.tracker-embed-wrapper:fullscreen .tracker-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 8px;
    z-index: 1000;
}

/* WebKit fullscreen */
.tracker-embed-wrapper:-webkit-full-screen {
    background: #000;
    padding: 0;
}

.tracker-embed-wrapper:-webkit-full-screen .tracker-iframe {
    height: 100vh !important;
    border-radius: 0;
}

/* Mozilla fullscreen */
.tracker-embed-wrapper:-moz-full-screen {
    background: #000;
    padding: 0;
}

.tracker-embed-wrapper:-moz-full-screen .tracker-iframe {
    height: 100vh !important;
    border-radius: 0;
}
