/* --- VARIABLES --- */
:root {
    --mol-primary: #2563EB; /* Xanh dương đậm */
    --mol-accent: #3B82F6;
    --mol-bg: #EFF6FF;
    --mol-text: #1E293B;
    --mol-gray: #64748B;
    --mol-border: #DBEAFE;
    --mol-radius: 20px;
}

#kth-molar-app {
    font-family: 'Segoe UI', Roboto, sans-serif;
    max-width: 1000px;
    margin: 40px auto;
    color: var(--mol-text);
}

[v-cloak] { display: none; }
*, *::before, *::after { box-sizing: border-box; }

/* --- MAIN CARD (SPLIT LAYOUT) --- */
.mol-card {
    display: flex;
    background: #fff;
    border-radius: var(--mol-radius);
    box-shadow: 0 20px 40px -10px rgba(37, 99, 235, 0.1);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.05);
    min-height: 500px;
}

/* Cột Trái */
.mol-left {
    flex: 1;
    padding: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Cột Phải */
.mol-right {
    flex: 1;
    background: var(--mol-bg);
    padding: 40px;
    border-left: 1px solid var(--mol-border);
    position: relative;
    overflow-y: auto; /* Cho phép cuộn nếu bảng dài */
    max-height: 600px;
}

/* --- HEADER --- */
.tool-tag {
    color: var(--mol-primary);
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 10px;
    display: block;
}

.mol-header h2 {
    font-size: 36px;
    font-weight: 800;
    margin: 0 0 15px 0;
    color: var(--mol-text);
    line-height: 1.2;
}

.mol-header p {
    color: var(--mol-gray);
    font-size: 16px;
    margin-bottom: 40px;
}

/* --- INPUT --- */
.input-box {
    position: relative;
    display: flex;
    align-items: center;
}

.input-box input {
    width: 100%;
    padding: 20px 50px 20px 25px;
    font-size: 24px;
    font-weight: 700;
    border: 3px solid var(--mol-border);
    border-radius: 16px;
    outline: none;
    transition: all 0.3s;
    color: var(--mol-text);
    background: #fff;
}

.input-box input:focus {
    border-color: var(--mol-primary);
    box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.1);
}

.input-box input.input-error {
    border-color: #EF4444;
    background: #FEF2F2;
}

.btn-clear {
    position: absolute;
    right: 20px;
    background: #F1F5F9;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    color: var(--mol-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.btn-clear:hover { background: #E2E8F0; color: #EF4444; }

.error-badge {
    margin-top: 10px;
    color: #B91C1C;
    background: #FEE2E2;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    display: inline-block;
}

/* --- SUGGESTIONS --- */
.suggestions {
    margin-top: 25px;
}
.suggestions span { font-size: 13px; color: var(--mol-gray); font-weight: 600; display: block; margin-bottom: 8px;}
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags button {
    background: #F8FAFC;
    border: 1px solid var(--mol-border);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 14px;
    color: var(--mol-gray);
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}
.tags button:hover {
    background: #DBEAFE;
    color: var(--mol-primary);
    border-color: var(--mol-primary);
}

/* --- RESULT SECTION --- */
.mass-card {
    background: linear-gradient(135deg, var(--mol-primary), #1D4ED8);
    color: white;
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.4);
    margin-bottom: 30px;
    animation: popIn 0.4s ease;
}

.mass-label {
    font-size: 13px;
    font-weight: 700;
    opacity: 0.8;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.mass-value {
    font-size: 42px;
    font-weight: 900;
    margin-top: 5px;
    letter-spacing: -1px;
}
.mass-value small { font-size: 20px; font-weight: 500; opacity: 0.9; margin-left: 5px; }

/* --- COMPOSITION TABLE --- */
.composition-box h4 {
    margin: 0 0 20px 0;
    color: var(--mol-text);
    font-size: 18px;
}

.comp-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.comp-item {
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #E2E8F0;
    animation: slideIn 0.3s ease-out;
}

.comp-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.atom-badge {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    margin-right: 15px;
    flex-shrink: 0;
}

.atom-details {
    flex: 1;
}
.atom-name {
    display: block;
    font-weight: 700;
    font-size: 15px;
}
.atom-details small { color: var(--mol-gray); font-size: 13px; }

.atom-percent {
    font-weight: 800;
    font-size: 16px;
    color: var(--mol-text);
}

.progress-track {
    height: 8px;
    background: #F1F5F9;
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill { height: 100%; border-radius: 4px; }

/* PLACEHOLDER */
.mol-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: var(--mol-gray);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}
.mol-placeholder img {
    width: 120px;
    opacity: 0.5;
    margin-bottom: 20px;
    filter: grayscale(100%);
}

/* --- RESPONSIVE MOBILE FIX (QUAN TRỌNG) --- */
@media (max-width: 900px) {
    .mol-card {
        flex-direction: column; /* Chuyển thành cột dọc */
        margin: 10px; /* Giảm margin để không bị tràn */
    }

    .mol-left, .mol-right {
        padding: 30px 20px; /* Giảm padding */
        width: 100%; /* Chiếm full chiều rộng */
    }

    .mol-right {
        border-left: none;
        border-top: 1px solid var(--mol-border);
        max-height: none; /* Bỏ giới hạn chiều cao trên mobile */
    }

    .mol-header h2 { font-size: 28px; }
    .input-box input { font-size: 20px; padding: 15px; }
}

/* Animations */
@keyframes popIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.fade-enter-active, .fade-leave-active { transition: opacity 0.3s; }
.fade-enter-from, .fade-leave-to { opacity: 0; }