
/* --- RESET & BASIC STYLES --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--bg);
    /*background-image: radial-gradient(#d1d1d1 1px, transparent 1px);*/
    background-size: 24px 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 20px;

}

/* --- TABS SYSTEM --- */
header {
    width: 100%;
    max-width: 2000px;
    background-color: var(--header-bg);
    border-radius: 12px;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.brand .logo-text {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--text-size);
    line-height: 1;
}

.brand .tagline {
    font-size: 14px;
    color: var(--text-size);
    font-weight: 400;
    margin-top: 4px;
}


h3 .custom-link {
    color: inherit;            /* Inherit the text color from the h3 parent */
    text-decoration: none;     /* Remove the default underline */
    display: inline-block;     /* Allows for proper padding and click area mapping */
}
h3 .custom-link:hover {
    text-decoration: underline; /* Bring back the underline on hover */
    color: #007bff;            /* Change color on hover if desired */
}

.tabs {
    display: flex;
    gap: 12px;
}

.tab-btn {
    background-color: #6495ed;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    color: #222;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover, .tab-btn.active {
    background-color: #ff7b47;
    color: #fff;
    transform: translateY(-2px);
}

.tabs-content {
    width: 100%;
    max-width: 1100px;
    display: flex;
    justify-content: center;
}

/*  Tab pane hiding logic */
.tab-pane {
    display: none; /* def */
    width: 100%;
    flex-direction: column;
    align-items: center;
}

.tab-pane.active {
    display: flex; /*active tab*/
}

/* --- SEARCH SECTION & SWING ANIMATION --- */
.search-container-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transform-origin: 50% 0%;
    animation: pendulum 1.4s cubic-bezier(.45, 0, .55, 1) infinite alternate;
    margin-bottom: 20px;
}

@keyframes pendulum {
    from {
        transform: rotate(-7deg);
    }

    to {
        transform: rotate(7deg);
    }
}

.hanging-line {
    width: 2px;
    height: 55px;
    background-color: #2b5b84;
}

.search-box {
    width: 500px;
    max-width: 90vw;
    background: var(--card-bg);
    border: 2px solid #38b6ff;
    border-radius: 10px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 12px rgba(56, 182, 255, 0.15);
}

.search-box span.icon {
    font-size: 20px;
    margin-right: 10px;
}

.search-box input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 18px;
    color: var(--text-color);
    background-color: var(--card-bg);
}

@keyframes swing {
    0% { transform: rotate(0deg); }
    20% { transform: rotate(4deg); }
    40% { transform: rotate(-3deg); }
    60% { transform: rotate(2deg); }
    80% { transform: rotate(-1deg); }
    100% { transform: rotate(0deg); }
}

.divider {
    width: 550px;
    max-width: 90vw;
    border-bottom: 2px dashed #ccc;
    margin: 10px 0 35px 0;
}

/* --- CARDS GRID --- */
.cards-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.card {
    position: relative;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    gap: 12px;

    box-shadow: var(--card-shadow);

    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
    box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
    background-color 0.3s ease,
    border-color 0.3s ease;
}


.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}

.card.hidden {
    display: none; /* for card filter */
}

.card-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 13px;
}

.cicon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 13px;
}

.card .custom-link::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1; /* This invisibly stretches the clickable link over the whole card */
}

.card-content h3 {
    font-size: 18px;
    color: var(--text-color);
    margin-bottom: 4px;
}

.card-content p {
    font-size: 14px;
    color: var(--text-color);
    line-height: 1.35;
}
body.dark-mode .cicon {
    filter: invert(1) brightness(2);
}


/* Badge colors */
:root {
    /*--bg: #36454f;*/
    --bg: #f7f7f7;
    --text-color: #222222;
    --card-bg: #ffffff;
    --header-bg: #e0e0e0;
    --panel-bg: #d1d5db;
    --card-border: #e2e2e2;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    --card-shadow-hover: 0 8px 20px rgba(0, 0, 0, 0.08);

}
/* 2. ĐIỀU CHỈNH KHI BẬT DARK MODE */
body.dark-mode {
    --bg: #0f172a;
    --text-color: #f8fafc;
    --text-sub: #94a3b8;
    --card-bg: #1e293b;
    --header-bg: #1e293b;
    --panel-bg: #d1d5db;
    --card-border: #334155;
    --accent-blue: #38bdf8;

    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}
body {
    background-color: var(--bg);
    color: var(--text-color);
    /*
    background-image: radial-gradient(rgba(0, 0, 0, 0.15) 1px, transparent 1px);*/
    transition: background-color 0.3s ease, color 0.3s ease;
}

header {
    background-color: var(--header-bg);
}

p {
    color: var(--text-sub);
}

.card {
    background-color: var(--card-bg);
}


.floating-panel {
    background-color: var(--panel-bg);
}

.bg-teal   { background-color: #10b981; }
.bg-blue   { background-color: #0d9488; }
.bg-sky    { background-color: #0284c7; }


/* --- FLOATING SETTINGS PANEL --- */
.floating-panel {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;

    background-color: var(--panel-bg);
    padding: 10px 6px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.panel-btn {
    background: transparent;
    border: none;
    color: #374151;
    font-size: 15px;
    font-weight: 600;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.panel-btn:hover {
    background-color: rgba(0, 0, 0, 0.08);
    color: #111827;
}

.panel-btn.active {
    background-color: #ffffff;
    color: #000000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.panel-divider {
    width: 70%;
    height: 1px;
    background-color: #9ca3af;
    margin: 2px 0;
}

/* ================================
 *  MOBILE BOTTOM NAV
 *  ================================ */

.mobile-bottom-nav {
    display: none;
}

@media (max-width: 600px) {

    .mobile-bottom-nav {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 12px;

        height: 64px;

        display: grid;
        grid-template-columns: repeat(5, 1fr);

        background: var(--card-bg);
        border: 1px solid var(--card-border);
        border-radius: 16px;

        box-shadow: var(--card-shadow);

        z-index: 1000;

        overflow: hidden;
    }

    .mobile-nav-item {
        position: relative;

        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;

        gap: 3px;

        min-width: 0;

        color: var(--text-color);
        text-decoration: none;

        background: transparent;
        border: none;

        cursor: pointer;

        transition:
        background-color 0.2s ease,
        color 0.2s ease,
        transform 0.15s ease;
    }

    .mobile-nav-item:hover {
        background: var(--hover-bg);
    }

    .mobile-nav-item:active {
        transform: scale(0.92);
    }

    .mobile-nav-icon {
        font-size: 19px;
        line-height: 1;
    }

    .mobile-nav-label {
        font-size: 10px;
        line-height: 1;
        opacity: 0.75;
    }

    .mobile-nav-item.active {
        color: var(--accent-color);
    }

    .mobile-nav-item.active .mobile-nav-label {
        opacity: 1;
        font-weight: 600;
    }

    /* hamburger */
    .mobile-menu-btn {
        font-family: inherit;
    }


    body {
        padding-bottom: 90px;
    }
}

@media (max-width: 600px) {
    .float-panel {
        width: auto;
        max-width: calc(100vw - 24px);
        left: 12px;
        right: 12px;
        box-sizing: border-box;
    }
}

@media (max-width: 600px) {
    .tabs {
        display: none !important;
    }
}
/* --- DESKTOP STYLES (Default Layout) --- */
.math-footer {
    width: 100%;
    margin-top: auto;
    padding: 10px 10px;
    background-color: var(--header-bg);
    border-radius: 16px;
    box-shadow: var(--card-shadow);

    /* --- Các thuộc tính quan trọng để xuống dòng --- */
    display: flex;
    flex-direction: column;   /* Đổi từ row thành column để xếp chồng lên nhau */
    align-items: center;      /* Căn giữa các dòng theo chiều ngang */
    justify-content: center;  /* Căn giữa theo chiều dọc */
    gap: 1px;                /* Tạo khoảng cách vừa phải giữa cụm links và dòng copyright */
}


.math-footer a {
    white-space: nowrap;            /* Prevents "Terms of Service" from ever breaking */
    text-decoration: none;
    color: inherit;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-links a {
    color: var(--primary-blue);
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary-purple);
    text-decoration: underline;
}

.footer-links .divider {
    color: var(--card-border);
    font-size: 14px;
    font-weight: 300;
}

.footer-copy {
    font-size: 14px;
    color: var(--text-sub);
}
@media (max-width: 768px) {
    /* 1. Reset the layout to tightly hug the content */
    .math-footer {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 12px;           /* Shrinks the outer gray box padding */
        gap: 6px;                /* Tight space between links block and copyright */
    }

    /* 2. Force links to sit tightly side-by-side or closely stacked */
    .footer-links {
        display: flex;
        flex-direction: row;     /* Changes back to a clean row */
        flex-wrap: wrap;         /* Allows clean wrapping if screen is tiny */
        justify-content: center;
        align-items: center;
        gap: 10px;               /* Small gap between each item */
        width: 100%;
    }

    /* 3. Hide the ugly broken dashed lines / divider tags on mobile */
    .footer-links .divider {
        display: inline-block;
        margin: 0 2px;
        transform: scaleY(0.8);  /* Makes vertical bar slightly shorter */
    }

    /* 4. Ensure links take up zero extra vertical space */
    .footer-links a {
        padding: 2px 0;          /* Removes any tall padding heights */
        margin: 0;
        line-height: 1.2;
    }
}
@media (max-width: 768px) {
    /* 1. Center the entire container layout vertically and horizontally */
    .math-footer {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center; /* Centers everything vertically inside the gray box */
        padding: 16px;           /* Even padding on all 4 sides */
        gap: 12px;               /* Consistent gap between the link pile and copyright */
    }

    /* 2. Stack the links perfectly on top of each other with equal gaps */
    .footer-links {
        display: flex;
        flex-direction: column;  /* Clean vertical stacking */
        align-items: center;
        justify-content: center;
        gap: 8px;                /* Forces exact, equal space above and below TOS */
        width: 100%;
    }

    /* 3. Hide the desktop vertical pipes "|" completely so they don't break the layout */
    .footer-links .divider {
        display: none;           /* Removes the desktop dividers on mobile */
    }

    /* 4. Reset link metrics so nothing pulls them off-center */
    .footer-links a {
        display: block;
        text-align: center;
        margin: 0;
        padding: 0;
        line-height: 1.2;
    }
}

