/* ===========================================
   RESPONSIVE CSS - Mobile First Enhancements
   Cải thiện responsive cho toàn bộ hệ thống
   Thêm vào cuối các file CSS để override
   =========================================== */

/* ===========================================
   BREAKPOINTS:
   - Mobile: <= 480px
   - Tablet: <= 768px  
   - Tablet Landscape: <= 992px
   - Desktop: > 992px
   =========================================== */

/* ========== MOBILE MENU BUTTON ========== */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text);
    padding: 8px;
    cursor: pointer;
    font-size: 1.4rem;
}

.mobile-menu-btn:hover {
    color: var(--primary);
}

/* Mobile Close Button */
.mobile-close-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px;
    cursor: pointer;
    font-size: 1.5rem;
}

.mobile-close-btn:hover {
    color: var(--text);
}

/* Mobile Menu Header - hidden on desktop */
.mobile-menu-header {
    display: none;
}

/* Mobile Menu Items wrapper - hidden on desktop */
.mobile-menu-items {
    display: contents;
}

/* Mobile Menu Actions - hidden on desktop */
.mobile-menu-actions {
    display: none;
}

/* Mobile Menu Overlay Backdrop */
.mobile-menu-overlay {
    display: none;
}

/* Body lock when menu open */
body.menu-open {
    overflow: hidden;
}

/* ========== TABLET & BELOW (992px) ========== */
@media (max-width: 992px) {

    /* Show mobile menu button */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Hide desktop nav actions */
    .nav-actions {
        display: none;
    }

    /* Mobile Menu Overlay Backdrop */
    .mobile-menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .mobile-menu-overlay.active {
        display: block;
        opacity: 1;
    }

    /* Fullscreen Mobile Navigation - KiotViet Style */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 360px;
        height: 100vh;
        height: 100dvh;
        background: #FFFFFF;
        flex-direction: column;
        padding: 0;
        gap: 0;
        border-left: 1px solid var(--border);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
        transition: right 0.3s ease;
        z-index: 999;
        overflow-y: auto;
        display: flex;
    }

    .nav-links.active {
        right: 0;
    }

    /* Mobile Menu Header */
    .mobile-menu-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px 20px;
        border-bottom: 1px solid var(--border);
        background: #FFFFFF;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .mobile-menu-header .logo {
        font-size: 1.3rem;
    }

    .mobile-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Mobile Menu Items */
    .mobile-menu-items {
        display: flex;
        flex-direction: column;
        flex: 1;
        padding: 10px 0;
    }

    .mobile-menu-items a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 18px 24px;
        font-size: 1.05rem;
        font-weight: 500;
        color: var(--text);
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        transition: background 0.2s ease;
    }

    .mobile-menu-items a::after {
        content: '\f054';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        font-size: 0.75rem;
        color: var(--text-muted);
        opacity: 0.5;
    }

    .mobile-menu-items a:hover,
    .mobile-menu-items a:active {
        background: rgba(217, 119, 6, 0.05);
        color: var(--primary);
    }

    .mobile-menu-items a:hover::after,
    .mobile-menu-items a:active::after {
        color: var(--primary);
        opacity: 1;
    }

    .mobile-menu-items a.ctv-link {
        color: #f72585;
        font-weight: 600;
    }

    .mobile-menu-items a.ctv-link::after {
        color: #f72585;
    }

    /* Mobile Menu Actions (Login/Register buttons) */
    .mobile-menu-actions {
        display: flex;
        gap: 12px;
        padding: 20px 24px;
        border-top: 1px solid var(--border);
        background: #FAFAFA;
        margin-top: auto;
    }

    .mobile-menu-actions .btn {
        flex: 1;
        text-align: center;
        padding: 14px 20px;
        font-size: 0.95rem;
        border-radius: 8px;
    }

    .mobile-menu-actions .btn-outline {
        background: transparent;
        border: 1.5px solid var(--primary);
        color: var(--primary);
    }

    .mobile-menu-actions .btn-primary {
        background: var(--primary);
        color: white;
        box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25);
    }

    /* Benefit Items */
    .benefit-item,
    .benefit-item:nth-child(even) {
        flex-direction: column;
        gap: 30px;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }

    /* Pricing Card - remove scale on popular */
    .pricing-card.popular {
        transform: scale(1);
    }
}

/* ========== TABLET (768px) ========== */
@media (max-width: 768px) {

    /* Hero */
    .hero {
        padding: 100px 0 60px;
    }

    .hero h1 {
        font-size: 2rem;
        line-height: 1.3;
    }

    .hero p {
        font-size: 1.05rem;
    }

    .hero-btns {
        flex-direction: column;
        gap: 15px;
        padding: 0 20px;
    }

    .hero-btns .btn {
        width: 100%;
        text-align: center;
    }

    /* Section titles */
    .section-title h2 {
        font-size: 1.8rem;
    }

    /* Features */
    .features {
        padding: 60px 0;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Pricing */
    .pricing {
        padding: 60px 0;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    /* Benefits */
    .benefits {
        padding: 60px 0;
    }

    .benefit-content h3 {
        font-size: 1.5rem;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-info p {
        max-width: 100%;
        margin: 20px auto 0;
    }

    .footer-col {
        padding: 20px 0;
        border-top: 1px solid var(--border);
    }

    /* Nav Actions */
    .nav-actions .btn-outline {
        display: none;
    }

    .nav-actions .btn-primary {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    /* Contact Form */
    .contact-form {
        padding: 30px 20px;
    }

    /* Documentation */
    .doc-sidebar {
        display: none;
    }

    .doc-layout {
        grid-template-columns: 1fr;
    }

    /* Blog */
    .blog-layout {
        grid-template-columns: 1fr;
    }

    .article-layout {
        grid-template-columns: 1fr;
    }

    .article-sidebar {
        order: -1;
    }

    /* Comments */
    .comments-container {
        padding: 25px;
    }
}

/* ========== MOBILE (480px) ========== */
@media (max-width: 480px) {

    /* Typography */
    .hero h1 {
        font-size: 1.6rem;
    }

    .hero p {
        font-size: 0.95rem;
    }

    .section-title h2 {
        font-size: 1.5rem;
    }

    .section-title p {
        font-size: 0.95rem;
    }

    /* Logo */
    .logo {
        font-size: 1.2rem;
    }

    /* Buttons */
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    /* Feature Cards */
    .feature-card {
        padding: 20px;
    }

    .feature-card h3 {
        font-size: 1.1rem;
    }

    /* Pricing */
    .pricing-card {
        padding: 25px 20px;
    }

    .price {
        font-size: 2rem;
    }

    /* Blog Post */
    .article-main {
        padding: 20px;
    }

    .article-header h1 {
        font-size: 1.5rem;
    }

    .article-meta {
        flex-direction: column;
        gap: 10px;
    }

    .article-thumbnail {
        margin: 0 -20px 20px;
    }

    /* Comments */
    .comment {
        flex-direction: column;
        gap: 10px;
    }

    .comment-avatar {
        font-size: 2rem;
    }

    .comment-body {
        padding: 15px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* Share buttons */
    .share-buttons {
        flex-wrap: wrap;
    }

    /* Posts grid */
    .posts-grid {
        grid-template-columns: 1fr;
    }

    /* Post card */
    .post-content {
        padding: 15px;
    }

    .post-content h2 {
        font-size: 1rem;
    }

    /* Footer */
    footer {
        padding: 50px 0 20px;
    }

    .social-links {
        justify-content: center;
    }
}

/* ========== LANDSCAPE MODE ========== */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 80px 0 40px;
    }

    .hero h1 {
        font-size: 1.8rem;
    }
}

/* ========== TOUCH DEVICES ========== */
@media (hover: none) and (pointer: coarse) {

    /* Remove hover effects on touch devices */
    .feature-card:hover,
    .pricing-card:hover,
    .post-card:hover {
        transform: none;
    }

    /* Make tap targets larger */
    .nav-links a {
        padding: 10px 15px;
    }

    .btn {
        min-height: 44px;
    }
}

/* ========== PRINT STYLES ========== */
@media print {

    header,
    footer,
    .nav-links,
    .nav-actions,
    .hero-btns,
    .sidebar-widget,
    .share-buttons,
    .comment-form {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .article-main,
    .comments-container {
        background: white;
        border: 1px solid #ccc;
    }
}

/* ========== SAFE AREA (Notch devices) ========== */
@supports (padding: max(0px)) {
    header {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }

    footer {
        padding-bottom: max(30px, env(safe-area-inset-bottom));
    }
}