/* AECK Landing Page CSS - Enhanced Mobile Version */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Smooth scrolling for better UX */
html {
    scroll-behavior: smooth;
}

/* Better font rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Selection colors giống Box Đề */
::selection {
    background: #ee8e97;
    color: #fff;
}

::-moz-selection {
    background: #cd1627;
    color: #fff;
}

/* Card Footer */
.card-footer {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid rgba(205, 22, 39, 0.1);
}

.copyright {
    font-size: 14px;
    color: #666;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Submenu Styles */
.submenu {
    width: 100%;
}

.submenu .card-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: center;
    max-width: 700px;
    margin: 0 auto;
}

.submenu-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 25px;
}

.back-button {
    position: absolute;
    left: 0;
    background: none;
    border: 2px solid #cd1627;
    color: #cd1627;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-button:hover {
    background: #cd1627;
    color: white;
    transform: translateX(-2px);
}

.submenu-header h3 {
    font-size: 22px;
    font-weight: 700;
    color: #cd1627;
    margin: 0;
    letter-spacing: 1px;
}

body {
    font-family: 'Montserrat', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
    color: #1f1f1f;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: url('assets/bg.png') center/cover no-repeat;
    filter: blur(6px);
    transform: scale(1.04);
    z-index: -2;
}

/* Dark Overlay giống Box Đề */
.dark-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.25);
    z-index: -1;
}

/* Popup Notification */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
    padding: 20px;
}

.popup-overlay.hidden {
    display: none;
}

.popup-container {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: popupScale 0.3s ease-out;
}

.popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(205, 22, 39, 0.9);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.popup-close:hover {
    background: #cd1627;
    transform: rotate(90deg) scale(1.1);
}

.popup-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 90vh;
    object-fit: contain;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes popupScale {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.container {
    width: 100%;
    max-width: 1200px;
    padding: 20px;
    padding-top: max(70px, calc(50px + env(safe-area-inset-top)));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: auto;
    margin-bottom: auto;
    position: relative;
    z-index: 2;
}

/* Main Content Card */
.main-card {
    background: rgba(255, 255, 255, 0.97);
    border-radius: 26px;
    padding: 60px 50px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(5px);
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 1200px;
    width: calc(100% - 32px);
    min-height: 600px;
    animation: fadeInUp 0.8s ease-out;
    gap: 35px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    margin-bottom: 50px;
    text-align: center;
}

.logo img {
    max-height: 50px;
    width: auto;
    height: auto;
    max-width: 100%;
}

.card-container {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 1200px;
}

/* Desktop layout - 3 cards per row + 1 card on second row */
@media (min-width: 1024px) {
    .card-container {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
        max-width: 950px;
        justify-items: center;
        place-content: center;
    }
    
    /* Make the 4th card span the middle column of the second row */
    .card:nth-child(4) {
        grid-column: 2;
    }
}

.card {
    background: white;
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 280px;
    cursor: pointer;
    position: relative;
    border: 2px solid #cd1627;
    flex: 1;
    min-width: 260px;
    max-width: 320px;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 35px rgba(0, 0, 0, 0.2), 0 4px 15px rgba(0, 0, 0, 0.15);
    border-color: #e61d2f;
    background: rgba(205, 22, 39, 0.02);
}

.card:active,
.card:focus {
    background: rgba(205, 22, 39, 0.05);
    border: 3px solid #cd1627;
    transform: translateY(-3px);
}

.card:active .card-title,
.card:focus .card-title {
    color: #b01426;
}

.card:active .card-icon i,
.card:focus .card-icon i {
    color: #b01426;
    transform: scale(1.1);
}

.card-icon {
    margin-bottom: 15px;
}

.card-icon i {
    font-size: 42px;
    color: #cd1627;
    transition: transform 0.2s ease, color 0.2s ease;
    text-shadow: none;
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: #cd1627;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
    line-height: 1.4;
    transition: color 0.3s ease;
    -webkit-text-stroke: none;
    text-shadow: none;
}

.card-description {
    font-size: 14px;
    color: #555;
    line-height: 1.4;
    font-weight: 500;
}

/* Enhanced Mobile Responsive Design */
@media (max-width: 768px) {
    body {
        background-attachment: scroll;
        padding: 0;
    }
    
    .popup-container {
        max-width: 95%;
        max-height: 85vh;
    }
    
    .popup-close {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .container {
        padding: 15px;
        padding-top: max(20px, calc(15px + env(safe-area-inset-top, 15px)));
        padding-bottom: max(15px, env(safe-area-inset-bottom, 15px));
        min-height: 100vh;
        justify-content: center;
    }
    
    .main-card {
        padding: 60px 40px 20px;
        border-radius: 24px;
        max-width: 600px;
        min-height: 520px;
        gap: 28px;
    }
    
    .back-button {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .submenu-header h3 {
        font-size: 20px;
    }
    
    .submenu .card-container {
        flex-direction: column;
        gap: 25px;
        max-width: 400px;
    }
    
    .logo {
        margin-bottom: 30px;
        text-align: center;
    }
    
    .logo img {
        max-height: 42px;
        max-width: 90%;
    }
    
    .card-container {
        flex-direction: column;
        gap: 25px;
        width: 100%;
        max-width: 450px;
    }
    
    .card {
        width: 100%;
        padding: 30px 20px;
        margin: 0;
        border-radius: 12px;
        min-height: 160px;
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
        background: white;
        border: 2px solid #cd1627;
        flex: none;
        min-width: auto;
        max-width: none;
    }
    
    .copyright {
        font-size: 13px;
    }
    
    .card-icon i {
        font-size: 44px;
    }
    
    .card-title {
        font-size: 22px;
        margin-bottom: 12px;
    }
    
    .card-description {
        font-size: 15px;
        line-height: 1.5;
    }
}

@media (max-width: 480px) {
    body {
        align-items: flex-start;
        padding-top: 0;
    }
    
    .popup-container {
        max-width: 98%;
        max-height: 80vh;
    }
    
    .popup-close {
        width: 32px;
        height: 32px;
        font-size: 14px;
        top: 8px;
        right: 8px;
    }
    
    .container {
        padding: 12px;
        padding-top: max(20px, calc(15px + env(safe-area-inset-top, 12px)));
        padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
        min-height: calc(100vh - 40px);
    }
    
    .main-card {
        padding: 45px 28px 18px;
        border-radius: 22px;
        max-width: 480px;
        min-height: 480px;
        gap: 26px;
    }
    
    .submenu-header {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .back-button {
        position: static;
        align-self: flex-start;
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .submenu-header h3 {
        font-size: 18px;
    }
    
    .submenu .card-container {
        flex-direction: column;
        gap: 20px;
        max-width: 100%;
    }
    
    .logo {
        margin-bottom: 25px;
    }
    
    .logo img {
        max-height: 38px;
        max-width: 85%;
    }
    
    .card-container {
        gap: 20px;
        max-width: 350px;
    }
    
    .card {
        padding: 30px 20px;
        border-radius: 12px;
        min-height: 160px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1), 0 1px 4px rgba(0, 0, 0, 0.06);
        background: white;
        border: 2px solid #cd1627;
    }
    
    .card-footer {
        padding-top: 12px;
    }
    
    .copyright {
        font-size: 12px;
    }
    
    .card-icon {
        margin-bottom: 15px;
    }
    
    .card-icon i {
        font-size: 40px;
    }

    .card-title {
        font-size: 20px;
        margin-bottom: 10px;
        letter-spacing: 0.5px;
    }
    
    .card-description {
        font-size: 14px;
        line-height: 1.4;
    }
}

@media (max-width: 360px) {
    .maintenance-content {
        font-size: 11px;
    }
    
    .container {
        padding: 10px;
        padding-top: max(85px, calc(75px + env(safe-area-inset-top, 10px)));
        padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
    }
    
    .main-card {
        padding: 38px 24px 16px;
        border-radius: 22px;
        max-width: 400px;
        min-height: 450px;
        gap: 24px;
    }
    
    .back-button {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .submenu-header h3 {
        font-size: 16px;
    }
    
    .submenu .card-container {
        gap: 18px;
    }
    
    .logo img {
        max-height: 34px;
        max-width: 80%;
    }
    
    .card-container {
        max-width: 320px;
    }
    
    .card {
        padding: 25px 15px;
        min-height: 150px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
        background: white;
        border: 2px solid #cd1627;
    }
    
    .card-footer {
        padding-top: 10px;
    }
    
    .copyright {
        font-size: 11px;
    }
    
    .card-icon i {
        font-size: 36px;
    }
    
    .card-title {
        font-size: 18px;
    }
    
    .card-description {
        font-size: 13px;
    }
}

/* Enhanced touch interactions for mobile */
@media (hover: none) and (pointer: coarse) {
    .card:hover {
        transform: none;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
        border-color: #cd1627;
    }
    
    .card:active {
        transform: scale(0.97);
        transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
        background: rgba(205, 22, 39, 0.05);
        border-color: #b01426;
    }
    
    /* Improve tap highlight */
    .card {
        -webkit-tap-highlight-color: rgba(205, 22, 39, 0.1);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        align-items: center;
        padding-top: 0;
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    
    .container {
        min-height: 100vh;
        justify-content: center;
        padding-left: max(20px, env(safe-area-inset-left, 20px));
        padding-right: max(20px, env(safe-area-inset-right, 20px));
    }
    
    .main-card {
        padding: 30px 35px;
        max-width: 850px;
        border-radius: 12px;
        min-height: 380px;
        gap: 25px;
    }
    
    .card-container {
        flex-direction: row;
        gap: 15px;
        max-width: 100%;
    }
    
    .card {
        flex: 1;
        max-width: 250px;
        padding: 20px 15px;
        min-height: 130px;
        min-width: 200px;
    }
    
    .logo {
        margin-bottom: 20px;
    }
    
    .logo img {
        max-height: 30px;
        max-width: 80%;
    }
}

/* High DPI displays optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .card {
        border: 0.5px solid rgba(255, 255, 255, 0.3);
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .card:hover {
        transform: none;
    }
    
    .card:active {
        transform: none;
    }
}