/* ===========================================
   Mobile Responsive Styles
   Enhanced for better mobile experience
   =========================================== */

/* ========== Base Mobile Optimizations ========== */
@media (max-width: 768px) {

    /* Prevent horizontal scroll */
    html,
    body {
        overflow-x: hidden;
        width: 100%;
    }

    .container {
        padding: 0 16px;
        max-width: 100%;
    }

    /* ========== Hero Section Mobile ========== */
    .hero-section {
        min-height: auto;
        padding: 40px 0;
    }

    .hero-content {
        flex-direction: column;
        gap: 24px;
        padding: 0 10px;
    }

    .hero-image-box {
        order: -1;
    }

    .hero-main-img {
        max-height: 200px;
        max-width: 200px;
    }

    .hero-text-box {
        width: 100%;
    }

    .hero-partner-logos {
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero-partner-logos img {
        height: 30px;
    }

    .event-badge {
        font-size: 0.75rem;
        padding: 8px 16px;
        margin-bottom: 16px;
    }

    .title-line {
        font-size: 1.6rem;
        letter-spacing: 0;
    }

    .hero-theme {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    .hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: 24px;
        line-height: 1.6;
    }

    .hero-meta {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 24px;
    }

    .meta-card {
        width: 100%;
        max-width: 100%;
        padding: 12px 16px;
        gap: 10px;
    }

    .meta-icon {
        font-size: 1.5rem;
    }

    .meta-text strong {
        font-size: 0.75rem;
    }

    .meta-text span {
        font-size: 0.85rem;
    }

    .hero-cta {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        max-width: 100%;
        justify-content: center;
        padding: 14px 24px;
        font-size: 1rem;
    }

    /* ========== Countdown Banner Mobile ========== */
    .registrants-banner {
        padding: 15px 0;
    }

    .banner-grid {
        flex-direction: column;
        gap: 15px;
        padding: 0 10px;
    }

    .countdown-box {
        padding: 12px 15px;
        width: 100%;
    }

    .countdown-title {
        font-size: 0.9rem;
    }

    .countdown-timer {
        gap: 4px;
    }

    .countdown-item {
        padding: 6px 8px;
        min-width: 42px;
    }

    .countdown-number {
        font-size: 1.2rem;
    }

    .countdown-label {
        font-size: 0.65rem;
    }

    .countdown-separator {
        font-size: 1rem;
    }

    .countdown-deadline {
        font-size: 0.75rem;
        margin-top: 8px;
    }

    .banner-link {
        width: 100%;
        padding: 12px 20px;
        border-radius: 30px;
    }

    .banner-content {
        gap: 8px;
        justify-content: center;
    }

    .banner-text {
        font-size: 1rem;
    }

    /* ========== About Section Mobile ========== */
    .about-section {
        padding: 50px 0;
    }

    .section-title {
        font-size: 1.4rem;
        margin-bottom: 30px;
        flex-direction: column;
        gap: 8px;
    }

    .title-icon {
        font-size: 1.4rem;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .about-card {
        padding: 20px;
    }

    .about-card.main-card {
        grid-column: auto;
        grid-row: auto;
    }

    .about-card h3 {
        font-size: 1.1rem;
    }

    .topic-en {
        font-size: 1.1rem;
    }

    .topic-th {
        font-size: 1rem;
    }

    .topic-desc {
        font-size: 0.85rem;
    }

    .eligibility-list li,
    .fee-list li {
        font-size: 0.9rem;
        padding: 6px 0;
        padding-left: 24px;
    }

    .organizer-info {
        margin-top: 20px;
    }

    .organizer-info p {
        font-size: 0.9rem;
    }

    /* ========== Timeline Section Mobile ========== */
    .timeline-section {
        padding: 50px 0;
    }

    .fishbone-timeline {
        padding: 20px 0;
    }

    .timeline-line {
        left: 25px;
        width: 3px;
    }

    .fishbone-item,
    .fishbone-item:nth-child(odd),
    .fishbone-item:nth-child(even) {
        flex-direction: row;
        padding-left: 60px;
        padding-right: 0;
        margin-bottom: 25px;
    }

    .fishbone-node {
        left: 25px;
        width: 40px;
        height: 40px;
    }

    .node-icon {
        font-size: 1.1rem;
    }

    .fishbone-connector {
        display: none;
    }

    .fishbone-content,
    .fishbone-item:nth-child(odd) .fishbone-content,
    .fishbone-item:nth-child(even) .fishbone-content {
        text-align: left;
        margin-left: 0;
        margin-right: 0;
        padding: 15px;
    }

    .fishbone-header,
    .fishbone-item:nth-child(odd) .fishbone-header,
    .fishbone-item:nth-child(even) .fishbone-header {
        align-items: flex-start;
    }

    .fishbone-header h3 {
        font-size: 0.95rem;
    }

    .fishbone-date {
        font-size: 0.7rem;
        padding: 3px 10px;
    }

    .fishbone-content p {
        font-size: 0.8rem;
    }

    .btn-schedule {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    /* ========== Benefits Section Mobile ========== */
    .benefits-section {
        padding: 50px 0;
    }

    .benefits-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .benefit-card {
        padding: 20px 12px;
    }

    .benefit-icon {
        font-size: 2rem;
        margin-bottom: 10px;
    }

    .benefit-card h3 {
        font-size: 0.95rem;
        margin-bottom: 4px;
    }

    .benefit-card p {
        font-size: 0.8rem;
    }

    /* ========== Tamiya Promo Banner Mobile ========== */
    .tamiya-promo-banner {
        padding: 40px 0;
    }

    .tamiya-promo-content {
        flex-direction: column;
        text-align: center;
        gap: 25px;
    }

    .tamiya-promo-banner::before {
        display: none;
    }

    .tamiya-promo-text h2 {
        font-size: 1.2rem;
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
    }

    .tamiya-promo-text h2 img {
        height: 35px !important;
    }

    .tamiya-promo-text p {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }

    .btn-tamiya-shop {
        padding: 12px 24px;
        font-size: 0.95rem;
    }

    .tamiya-promo-image img {
        max-width: 150px !important;
    }

    /* ========== Location Banner Mobile ========== */
    .location-banner {
        padding: 40px 0;
    }

    .location-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 25px;
    }

    .location-logos {
        justify-content: center;
    }

    .location-logo {
        height: 35px;
    }

    .location-title {
        font-size: 1.4rem;
        justify-content: center;
    }

    .location-icon {
        font-size: 1.4rem;
    }

    .location-details h3 {
        font-size: 1.1rem;
    }

    .location-university {
        font-size: 0.95rem;
    }

    .parking-card {
        padding: 20px;
        border-left: none;
        border-top: 4px solid #3b82f6;
    }

    .parking-card h4 {
        font-size: 1.05rem;
    }

    .parking-location {
        font-size: 0.9rem;
    }

    .parking-details p {
        font-size: 0.85rem;
    }

    .qr-card {
        padding: 15px;
    }

    .qr-image {
        width: 120px;
        height: 120px;
    }

    .location-qr {
        grid-column: 1;
    }

    /* ========== Register Section Mobile ========== */
    .register-section {
        padding: 50px 0;
    }

    .register-card {
        padding: 25px 20px;
    }

    .register-card h2 {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }

    .register-card>p {
        font-size: 0.95rem;
        margin-bottom: 25px;
    }

    .register-methods {
        flex-direction: column;
        gap: 20px;
    }

    .qr-placeholder {
        width: 130px;
        height: 130px;
    }

    .qr-placeholder img {
        width: 120px;
        height: 120px;
    }

    .btn-register-link {
        padding: 14px 28px;
        font-size: 1rem;
    }

    /* ========== Footer Mobile ========== */
    .main-footer {
        padding: 40px 0 25px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 25px;
        text-align: center;
    }

    .footer-brand h3 {
        font-size: 1.15rem;
    }

    .footer-contact h4,
    .footer-links h4 {
        font-size: 0.95rem;
        margin-bottom: 12px;
    }

    .footer-contact p {
        font-size: 0.85rem;
    }

    .footer-links {
        align-items: center;
    }

    .footer-links a {
        font-size: 0.85rem;
    }

    .footer-bottom {
        padding-top: 20px;
    }

    .footer-bottom p {
        font-size: 0.75rem;
    }
}

/* ========== Extra Small Screens (480px and below) ========== */
@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    .hero-section {
        padding: 30px 0;
    }

    .hero-main-img {
        max-height: 160px;
        max-width: 160px;
    }

    .hero-partner-logos img {
        height: 25px;
    }

    .title-line {
        font-size: 1.4rem;
    }

    .hero-theme {
        font-size: 0.9rem;
    }

    .countdown-item {
        min-width: 38px;
        padding: 5px 6px;
    }

    .countdown-number {
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.2rem;
    }

    .benefits-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .benefit-card {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 15px;
        text-align: left;
        padding: 15px;
    }

    .benefit-icon {
        margin-bottom: 0;
        font-size: 2rem;
    }

    .benefit-card h3 {
        margin-bottom: 2px;
    }

    .fishbone-item,
    .fishbone-item:nth-child(odd),
    .fishbone-item:nth-child(even) {
        padding-left: 50px;
    }

    .timeline-line {
        left: 20px;
    }

    .fishbone-node {
        left: 20px;
        width: 35px;
        height: 35px;
    }

    .node-icon {
        font-size: 0.95rem;
    }

    .location-logo {
        height: 30px;
    }

    .qr-image {
        width: 100px;
        height: 100px;
    }
}

/* ========== Mobile Navigation Enhancements ========== */
@media (max-width: 768px) {
    .main-header {
        padding: 12px 0;
    }

    .logo h1 {
        font-size: 1.15rem;
    }

    .logo span {
        font-size: 0.65rem;
        letter-spacing: 2px;
    }

    .mobile-menu-btn {
        display: flex;
        padding: 10px;
    }

    .mobile-menu-btn span {
        width: 24px;
        height: 2.5px;
    }

    .mobile-nav {
        display: flex;
    }

    .mobile-nav a {
        font-size: 1.2rem;
        padding: 10px 24px;
    }

    .mobile-nav .btn-nav-register {
        margin-top: 10px;
    }
}

/* ========== Touch Optimizations ========== */
@media (pointer: coarse) {

    /* Increase tap targets for touch devices */
    .btn-primary,
    .btn-secondary,
    .btn-nav-register,
    .btn-register-link,
    .btn-schedule,
    .btn-tamiya-shop,
    .btn-call-for-paper {
        min-height: 48px;
    }

    .desktop-nav a,
    .mobile-nav a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Remove hover effects on touch */
    .about-card:hover,
    .benefit-card:hover,
    .fishbone-content:hover,
    .meta-card:hover {
        transform: none;
    }
}

/* ========== Landscape Mobile Optimization ========== */
@media (max-width: 896px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: 30px 0;
    }

    .hero-content {
        flex-direction: row;
        gap: 30px;
    }

    .hero-main-img {
        max-height: 180px;
    }

    .hero-meta {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .meta-card {
        width: auto;
        flex: 1;
        min-width: 200px;
    }
}

/* ========== Safe Area Insets for Notched Devices ========== */
@supports (padding-top: env(safe-area-inset-top)) {
    .main-header {
        padding-top: calc(12px + env(safe-area-inset-top));
        padding-left: calc(16px + env(safe-area-inset-left));
        padding-right: calc(16px + env(safe-area-inset-right));
    }

    .main-footer {
        padding-bottom: calc(25px + env(safe-area-inset-bottom));
    }

    .mobile-nav {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ========== Font Size Optimization for Readability ========== */
@media (max-width: 768px) {
    body {
        font-size: 16px;
        -webkit-text-size-adjust: 100%;
    }
}

/* ========== Image Optimization ========== */
@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
    }

    .hero-partner-logos a,
    .hero-partner-logos img {
        display: inline-flex;
        align-items: center;
    }
}

/* ========== Smooth Scrolling Optimization ========== */
@media (max-width: 768px) {
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }

    section {
        scroll-margin-top: 60px;
    }
}