/**
 * ChinPost Responsive Styles
 * 
 * @package ChinPost
 * @version 1.0.0
 */

/* ==========================================================================
   BREAKPOINTS:
   - xs: 0 - 480px (Mobile Portrait)
   - sm: 481px - 640px (Mobile Landscape)
   - md: 641px - 768px (Tablet Portrait)
   - lg: 769px - 1024px (Tablet Landscape)
   - xl: 1025px - 1280px (Desktop)
   - 2xl: 1281px+ (Large Desktop)
   ========================================================================== */

/* ==========================================================================
   LARGE DESKTOP (1281px+)
   ========================================================================== */

@media (min-width: 1281px) {
    .container {
        padding: 0 var(--space-8);
    }
    
    .hero-title .title-highlight {
        font-size: 4rem;
    }
}

/* ==========================================================================
   DESKTOP (1025px - 1280px)
   ========================================================================== */

@media (max-width: 1280px) {
    :root {
        --text-5xl: 3rem;
        --text-4xl: 2.25rem;
        --text-3xl: 1.875rem;
    }
    
    .mega-menu {
        width: 600px;
    }
    
    .mega-menu-content {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .mega-menu-featured {
        display: none;
    }
}

/* ==========================================================================
   TABLET LANDSCAPE (769px - 1024px)
   ========================================================================== */

@media (max-width: 1024px) {
    :root {
        --text-5xl: 2.5rem;
        --text-4xl: 2rem;
        --text-3xl: 1.5rem;
        --space-20: 4rem;
        --space-16: 3rem;
    }
    
    /* Header */
    .main-nav {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .header-actions .btn {
        display: none;
    }
    
    /* Hero */
    .hero-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-actions {
        justify-content: center;
    }
    
    .hero-trust {
        justify-content: center;
    }
    
    .hero-stats {
        justify-content: center;
        margin-top: var(--space-8);
    }
    
    /* Services */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Calculator */
    .calc-grid {
        grid-template-columns: 1fr;
    }
    
    /* Why Us */
    .why-us-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Contact */
    .contact-grid {
        grid-template-columns: 1fr;
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Blog */
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================================================
   TABLET PORTRAIT (641px - 768px)
   ========================================================================== */

@media (max-width: 768px) {
    :root {
        --text-5xl: 2.25rem;
        --text-4xl: 1.875rem;
        --text-3xl: 1.5rem;
        --text-2xl: 1.25rem;
        --space-20: 3rem;
        --space-16: 2.5rem;
        --space-12: 2rem;
    }
    
    .container {
        padding: 0 var(--space-4);
    }
    
    /* Top Bar */
    .top-bar {
        display: none;
    }
    
    /* Hero Section */
    .hero-section {
        min-height: auto;
        padding: var(--space-16) 0;
    }
    
    .hero-content {
        padding: var(--space-10) 0;
    }
    
    .hero-badge {
        margin-bottom: var(--space-4);
    }
    
    .hero-title {
        margin-bottom: var(--space-4);
    }
    
    .hero-desc {
        font-size: var(--text-base);
        margin-bottom: var(--space-6);
    }
    
    .hero-desc br {
        display: none;
    }
    
    .hero-actions {
        flex-direction: column;
        gap: var(--space-3);
    }
    
    .hero-actions .btn {
        width: 100%;
    }
    
    .hero-trust {
        flex-wrap: wrap;
        gap: var(--space-4);
    }
    
    .stats-card {
        max-width: 100%;
    }
    
    .hero-slider-controls {
        display: none;
    }
    
    .scroll-indicator {
        display: none;
    }
    
    /* Track Widget */
    .quick-track-section {
        margin-top: -40px;
    }
    
    .track-widget-inner {
        flex-direction: column;
        text-align: center;
        padding: var(--space-6);
    }
    
    .track-widget-form {
        width: 100%;
    }
    
    /* Services */
    .service-card-content {
        padding: var(--space-5);
    }
    
    /* Calculator */
    .calc-tabs {
        flex-direction: column;
    }
    
    .calc-panel {
        padding: var(--space-6);
    }
    
    .form-row.two-cols,
    .form-row.three-cols {
        grid-template-columns: 1fr;
    }
    
    /* CTA Section */
    .cta-content {
        flex-direction: column;
        text-align: center;
    }
    
    .cta-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .cta-actions .btn {
        width: 100%;
    }
    
    /* Footer */
    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
    }
    
    /* Destinations */
    .destinations-map {
        display: none;
    }
    
    .ports-list {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   MOBILE LANDSCAPE (481px - 640px)
   ========================================================================== */

@media (max-width: 640px) {
    :root {
        --text-5xl: 2rem;
        --text-4xl: 1.75rem;
        --text-3xl: 1.375rem;
        --text-2xl: 1.25rem;
        --text-xl: 1.125rem;
    }
    
    /* Section Headers */
    .section-header {
        margin-bottom: var(--space-8);
    }
    
    /* Services */
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    /* Why Us */
    .why-us-grid {
        grid-template-columns: 1fr;
    }
    
    .why-us-card {
        padding: var(--space-6);
    }
    
    /* Blog */
    .blog-grid {
        grid-template-columns: 1fr;
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-col {
        text-align: center;
    }
    
    .footer-title::after {
        right: 50%;
        transform: translateX(50%);
    }
    
    .footer-links a::before {
        display: none;
    }
    
    .footer-links a:hover {
        padding-right: 0;
    }
    
    .footer-social {
        justify-content: center;
    }
    
    .footer-contact li {
        flex-direction: column;
        text-align: center;
    }
    
    /* Contact Methods */
    .contact-methods {
        gap: var(--space-3);
    }
    
    .contact-method {
        flex-direction: column;
        text-align: center;
    }
}

/* ==========================================================================
   MOBILE PORTRAIT (0 - 480px)
   ========================================================================== */

@media (max-width: 480px) {
    :root {
        --text-5xl: 1.75rem;
        --text-4xl: 1.5rem;
        --text-3xl: 1.25rem;
        --text-2xl: 1.125rem;
        --text-xl: 1rem;
        --space-20: 2.5rem;
        --space-16: 2rem;
        --space-12: 1.5rem;
        --space-8: 1.25rem;
    }
    
    .container {
        padding: 0 var(--space-4);
    }
    
    /* Header */
    .header-content {
        padding: var(--space-3) 0;
    }
    
    .logo-text-content strong {
        font-size: var(--text-lg);
    }
    
    .logo-text-content small {
        display: none;
    }
    
    .logo-icon {
        width: 40px;
        height: 40px;
    }
    
    /* Hero */
    .hero-badge {
        padding: var(--space-1) var(--space-3);
        font-size: var(--text-xs);
    }
    
    .badge-icon {
        font-size: 16px;
    }
    
    .hero-trust {
        display: none;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }
    
    .stat-item {
        padding: var(--space-3);
    }
    
    .stat-value {
        font-size: var(--text-2xl);
    }
    
    /* Service Card */
    .service-card-image {
        height: 160px;
    }
    
    .service-icon {
        width: 48px;
        height: 48px;
        margin-top: -40px;
    }
    
    .service-icon svg {
        width: 24px;
        height: 24px;
    }
    
    .service-features {
        display: none;
    }
    
    /* Calculator */
    .calc-panel {
        padding: var(--space-4);
    }
    
    .calc-form h4 {
        font-size: var(--text-base);
    }
    
    .result-item.highlight {
        padding: var(--space-4);
        margin: 0 calc(var(--space-4) * -1);
        margin-bottom: var(--space-3);
    }
    
    .result-item.highlight .result-value {
        font-size: var(--text-2xl);
    }
    
    /* Blog Card */
    .blog-card-image {
        height: 160px;
    }
    
    .blog-card-content {
        padding: var(--space-4);
    }
    
    /* Contact Form */
    .contact-form-wrapper {
        padding: var(--space-5);
    }
    
    .contact-info {
        padding: var(--space-5);
    }
    
    /* Mobile Menu */
    .mobile-menu {
        width: 100%;
    }
    
    /* Buttons */
    .btn-lg {
        padding: var(--space-3) var(--space-6);
        font-size: var(--text-base);
    }
}

/* ==========================================================================
   TOUCH DEVICE OPTIMIZATIONS
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn {
        min-height: 48px;
    }
    
    .nav-link {
        min-height: 48px;
    }
    
    .social-link {
        width: 48px;
        height: 48px;
    }
    
    /* Disable hover effects that don't work on touch */
    .service-card:hover {
        transform: none;
    }
    
    .blog-card:hover {
        transform: none;
    }
    
    /* Keep tap highlight */
    .btn:active {
        transform: scale(0.98);
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }
    
    .main-header,
    .main-footer,
    .cta-section,
    .back-to-top,
    .mobile-menu,
    .mobile-menu-overlay,
    .hero-slider-controls,
    .scroll-indicator {
        display: none !important;
    }
    
    .hero-section {
        min-height: auto;
        padding: 2cm 0;
    }
    
    .hero-slide {
        position: static;
        opacity: 1;
    }
    
    .slide-overlay {
        display: none;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
    
    .container {
        max-width: 100%;
        padding: 0 1cm;
    }
}

/* ==========================================================================
   HIGH CONTRAST MODE
   ========================================================================== */

@media (prefers-contrast: high) {
    :root {
        --cp-gold: #B8860B;
        --cp-navy: #000033;
        --cp-gray-500: #333333;
    }
    
    .btn-gold {
        border: 2px solid black;
    }
    
    .btn-outline-gold {
        border-width: 3px;
    }
}

/* ==========================================================================
   DARK MODE
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    :root {
        --cp-white: #0f1a2e;
        --cp-gray-50: #1a2a4a;
        --cp-gray-100: #2d3a5a;
        --cp-gray-200: #3d4a6a;
        --cp-gray-300: #6b7a9a;
        --cp-gray-400: #8b9aba;
        --cp-gray-500: #a0afc0;
        --cp-gray-600: #c0cfe0;
        --cp-gray-700: #dce5f0;
        --cp-gray-800: #e8f0f8;
        --cp-gray-900: #f5f8fc;
    }
    
    body {
        background: var(--cp-white);
    }
    
    .main-header {
        background: rgba(15, 26, 46, 0.95);
        border-bottom-color: var(--cp-gray-100);
    }
    
    .glass-card {
        background: rgba(26, 42, 74, 0.9);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .service-card,
    .blog-card,
    .contact-form-wrapper {
        background: var(--cp-gray-50);
    }
    
    .calc-tabs {
        background: var(--cp-gray-100);
    }
    
    .calc-tab.active {
        background: var(--cp-gray-50);
    }
    
    .calculator-wrapper,
    .track-widget-inner {
        background: var(--cp-gray-50);
    }
    
    .calc-result {
        background: var(--cp-gray-100);
    }
    
    .stat-item {
        background: var(--cp-gray-100);
    }
    
    img {
        opacity: 0.9;
    }
}

/* ==========================================================================
   LANDSCAPE ORIENTATION FIXES
   ========================================================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: var(--space-8) 0;
    }
    
    .hero-content {
        padding: var(--space-6) 0;
    }
    
    .hero-title {
        margin-bottom: var(--space-3);
    }
    
    .hero-desc {
        margin-bottom: var(--space-4);
    }
    
    .hero-stats {
        display: none;
    }
}