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

body {
    font-family: 'Roboto', sans-serif;
    font-weight: 300;
    background-color: #f0f8ff; /* Alice Blue */
    color: #003366;
    line-height: 1.6;
}

.nav-bar {
    background: #002244;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 3px solid #00509e;
}
.nav-bar a {
    color: white;
    text-decoration: none;
    font-weight: 400;
    opacity: 0.8;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    padding: 6px 12px;
    border-radius: 6px;
}
.nav-bar a:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}
.nav-bar a.nav-active {
    font-weight: 500;
    opacity: 1;
    background: #00509e;
    color: #ffffff;
}
.nav-separator {
    color: rgba(255, 255, 255, 0.25);
    font-weight: 300;
    margin: 0 4px;
}
.nav-group-label {
    color: #a0c2e6;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
}
.chapter-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.main-header {
    text-align: center;
    padding: 30px 20px;
    background: #004080;
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.main-header h1 {
    font-weight: 300;
    margin: 0 0 10px 0;
    font-size: 2.2rem;
    color: white;
}

.main-header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.layout-container {
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
    padding: 30px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.theory-column, .practice-column {
    flex: 1 1 450px;
    min-width: 0; /* Ngăn chặn overflow trên flex con */
}

.card {
    background: #ffffff;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 80, 158, 0.08);
}

h2 {
    font-weight: 400;
    font-size: 1.3rem;
    margin-bottom: 15px;
    border-bottom: 1px solid #cce0ff;
    padding-bottom: 8px;
    color: #004080;
}

h3 {
    font-weight: 400;
    font-size: 1.05rem;
    margin-top: 20px;
    margin-bottom: 8px;
    color: #00509e;
}

p {
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: #334e68;
}

pre {
    background: #1e1e1e; /* Dark theme cho code JS */
    color: #d4d4d4;
    padding: 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    overflow-x: auto;
    margin-bottom: 15px;
    border: 1px solid #333;
    -webkit-overflow-scrolling: touch; /* Hỗ trợ scroll mượt trên iOS */
}

code {
    font-family: 'Fira Code', monospace;
}

/* Pre cho phần kết quả JSON ở cột thực hành (Light theme) */
pre.light-pre {
    background: #e6f2ff;
    color: #003366;
    border: 1px solid #b3d4ff;
}

.input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
}

input {
    flex: 1;
    min-width: 0;
    padding: 14px;
    border: 1px solid #b3d4ff;
    border-radius: 8px;
    font-family: 'Roboto', sans-serif;
    font-weight: 300;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
    -webkit-appearance: none;
}

input:focus, textarea:focus {
    border-color: #00509e;
}

textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid #b3d4ff;
    border-radius: 8px;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    margin-bottom: 15px;
    resize: vertical;
    background-color: #fafbfc;
    color: #333;
    line-height: 1.4;
    -webkit-appearance: none;
}

button {
    background-color: #00509e;
    color: #ffffff;
    border: none;
    padding: 14px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    font-size: 1.05rem;
    transition: background-color 0.3s, transform 0.1s;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
}

button:hover {
    background-color: #003366;
}

button:active {
    transform: translateY(2px);
}

.message {
    margin-top: 15px;
    font-weight: 400;
    font-size: 0.95rem;
    padding: 12px;
    border-radius: 8px;
    display: none;
}

.message:not(:empty) {
    display: block;
}

.success { 
    background-color: #d4edda;
    color: #155724; 
    border: 1px solid #c3e6cb;
}
.error { 
    background-color: #f8d7da;
    color: #721c24; 
    border: 1px solid #f5c6cb;
}

/* =========================================
   RESPONSIVE (MOBILE UX/UI TWEAKS)
========================================= */
@media (max-width: 768px) {
    .main-header {
        padding: 20px 15px;
    }

    .main-header h1 {
        font-size: 1.6rem;
    }

    .main-header p {
        font-size: 1rem;
    }

    .layout-container {
        padding: 15px 10px;
        gap: 15px;
    }

    .card {
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 10px;
    }

    h2 {
        font-size: 1.15rem;
    }

    h3 {
        font-size: 1rem;
    }

    /* Ở mobile, input account dọc sẽ hợp lý hơn */
    .input-group {
        flex-direction: column;
        gap: 10px;
    }

    input, textarea, button {
        font-size: 1rem;
        /* Mobile touch target size (44px+) */
        padding: 14px; 
    }
}
