/* =========================================
   1. CORE STYLES & FONTS
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&display=swap');

:root {
    --main-color: #5cb85c;
    --main-color-hover: #4cae4c;
    --bg-color: #f8f9fa;
    --text-color: #333;
}

body {
    background-color: var(--bg-color);
    font-family: 'Be Vietnam Pro', sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    text-decoration: none;
}

/* =========================================
   2. HEADER & LOGO
   ========================================= */
.main-header {
    text-align: center;
    margin-bottom: 30px;
    padding-top: 40px;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-decoration: none;
    position: relative;
    padding: 10px 20px;
    margin-bottom: 15px;
    overflow: hidden;
}

.brand-logo .logo-icon {
    font-size: 2.5rem;
    color: var(--main-color);
    text-shadow: 0 4px 10px rgba(92, 184, 92, 0.3);
    display: flex;
    align-items: center;
}

.brand-logo .logo-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1;
}

.brand-logo .main-text {
    font-size: 2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #2c3e50 30%, #5cb85c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: -0.5px;
}

.brand-logo .sub-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: #888;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 3px;
    margin-left: 2px;
}

.brand-logo::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0) 100%);
    transform: skewX(-25deg);
    animation: shine-logo 3.5s infinite;
    pointer-events: none;
}

@keyframes shine-logo {
    0% {
        left: -100%;
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    40% {
        left: 200%;
        opacity: 0;
    }

    100% {
        left: 200%;
        opacity: 0;
    }
}

@media (max-width: 480px) {
    .brand-logo .main-text {
        font-size: 1.6rem;
    }

    .brand-logo .logo-icon {
        font-size: 2rem;
    }
}

.main-header p {
    color: #666;
    max-width: 600px;
    margin: 0 auto;
    font-size: 15px;
}

/* =========================================
   3. TOOL CARD & FORM
   ========================================= */
.tool-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    background: #fff;
    overflow: hidden;
    margin-bottom: 30px;
}

.tool-card-header {
    background-color: var(--main-color);
    color: white;
    padding: 15px;
    font-weight: 700;
    text-align: center;
    font-size: 18px;
    text-transform: uppercase;
}

.tool-card-body {
    padding: 30px;
}

.form-label {
    font-weight: 600;
    font-size: 14px;
    color: #555;
}

.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    padding: 10px 15px;
    font-size: 15px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--main-color);
    box-shadow: 0 0 0 0.2rem rgba(92, 184, 92, 0.25);
}

.btn-resolve {
    background-color: var(--main-color);
    color: white;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    padding: 10px;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-resolve:hover {
    background-color: var(--main-color-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(92, 184, 92, 0.3);
}

.btn-loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn-loading .fa-search {
    display: none;
}

.btn-loading::after {
    content: "";
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: text-bottom;
    border: .15em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border .75s linear infinite;
    margin-left: 5px;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* =========================================
   4. NEW TRADITIONAL TABLE STYLES
   ========================================= */
.result-section {
    margin-top: 30px;
}

.dns-table-wrapper {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #eee;
}

.table-new-style {
    margin-bottom: 0;
    border-collapse: collapse;
    border-spacing: 0;
    table-layout: fixed;
    width: 100%;
}

.table-new-style thead th {
    background-color: var(--main-color);
    color: white;
    font-weight: 700;
    padding: 12px 15px;
    border: none;
    word-break: break-word;
}

.table-new-style tbody tr {
    transition: background-color 0.2s;
    /* CHỈ ĐẶT border-bottom CHO HÀNG (Fix lỗi lệch line) */
    border-bottom: 1px solid #f0f0f0;
}

.table-new-style tbody tr:last-child {
    border-bottom: none;
}

.table-new-style tbody tr:hover {
    background-color: #f7fff7;
    /* Hiệu ứng shadow khi hover trên hàng */
    box-shadow: 0 0 5px rgba(92, 184, 92, 0.2);
    z-index: 10;
    position: relative;
}

.table-new-style tbody td {
    /* CHUẨN HÓA CĂN CHỈNH: Quan trọng nhất */
    vertical-align: middle;
    padding: 10px 15px;
    font-size: 0.95rem;
    /* Đảm bảo không có viền thừa trong td */
    border: none;
    word-break: break-word;
}

/* FIX: Loại bỏ display: block trên domain-cell-new để vertical-align: middle hoạt động */
.domain-cell-new {
    /* Trở về mặc định của TD, cho phép text xuống dòng (trên mobile) hoặc ellipsis (trên desktop) */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    /* Đặt min-width 0 để tránh tràn */
    min-width: 0;
}

.provider-icon {
    display: none;
}

.host-text-new {
    /* Đảm bảo text Domain vẫn được căn chỉnh đúng */
    display: inline;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-type-new {
    font-size: 0.8em;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: #007bff !important;
    color: white;
    font-weight: 600;
    display: inline-block;
}

.ttl-cell-new {
    font-weight: 700;
    color: #444;
    white-space: nowrap;
}

.answer-cell-new {
    /* Fix: Đảm bảo ô answer cho phép ngắt dòng và căn chỉnh */
    white-space: normal;
    word-break: break-word;
}

/* Điều chỉnh các phần tử bên trong Answer để căn chỉnh dọc chuẩn */
.answer-cell-new .flag-icon,
.answer-cell-new .search-ip-btn,
.answer-cell-new .fw-bold {
    /* Đảm bảo các thành phần này được căn giữa theo text baseline */
    vertical-align: middle;
}

.answer-cell-new .fw-bold {
    white-space: normal;
    word-break: break-word;
    min-width: 0;
    flex-shrink: 1;
    margin-top: 0;
    display: inline;
}

/* Cờ và nút phải giữ nguyên kích thước (flex-shrink: 0) */
.flag-icon {
    width: 24px;
    height: auto;
    border-radius: 3px;
    margin-right: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    vertical-align: middle;
    position: relative;
    top: -1px;
    object-fit: cover;
    flex-shrink: 0;
}

.search-ip-btn {
    color: var(--main-color);
    background: rgba(92, 184, 92, 0.1);
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    margin-left: 8px;
    text-decoration: none;
    flex-shrink: 0;
    vertical-align: middle;
}

.search-ip-btn:hover {
    background: var(--main-color);
    color: white;
}

/* TÙY CHỈNH WHOIS: OVERRIDE MÀU NÚT btn-outline-primary */
.btn-outline-primary {
    /* Màu nền & viền khi bình thường */
    color: var(--main-color) !important;
    border-color: var(--main-color) !important;
}

.btn-outline-primary:hover {
    /* Màu nền & chữ khi rê chuột */
    background-color: var(--main-color) !important;
    color: white !important;
    box-shadow: 0 0 0 0.25rem rgba(92, 184, 92, 0.5) !important;
    /* Thêm hiệu ứng shadow khi hover/focus */
}


/* =========================================
   5. SHARE BOX
   ========================================= */
.share-box-container {
    margin-top: 25px;
    background: #f1fcf5;
    border: 1px dashed var(--main-color);
    border-radius: 8px;
    padding: 15px;
}

.input-group-share .form-control {
    border-color: var(--main-color);
    background: #fff;
    color: var(--main-color);
    font-weight: 500;
}

.btn-copy {
    background-color: var(--main-color);
    color: white;
    border: 1px solid var(--main-color);
    font-weight: 600;
    transition: all 0.3s;
}

.btn-copy:hover {
    background-color: var(--main-color-hover);
    color: white;
}

/* =========================================
   6. FOOTER
   ========================================= */
.site-footer {
    margin-top: auto;
    background: #fff;
    border-top: 1px solid #eee;
    padding: 20px 0;
    text-align: center;
    font-size: 0.9em;
    color: #666;
}

.footer-stats {
    display: inline-flex;
    gap: 20px;
    margin-bottom: 10px;
    background: #f9f9f9;
    padding: 8px 20px;
    border-radius: 50px;
    border: 1px solid #eee;
}

.stat-item i {
    color: var(--main-color);
    margin-right: 5px;
}

.footer-link {
    color: var(--main-color);
    font-weight: 600;
    text-decoration: none;
}

.footer-link:hover {
    text-decoration: underline;
}

/* =========================================
   7. COMMUNITY CARD
   ========================================= */

.join-community-card {
    font-family: 'Be Vietnam Pro', sans-serif;
    width: 100%;
    max-width: 100%;
    margin: 30px auto;
    background: #ffffff;
    border-radius: 16px;
    position: relative;
    border: 2px solid #5cb85c;
    box-shadow: 0 8px 30px -10px rgba(92, 184, 92, 0.15);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.join-community-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px -10px rgba(92, 184, 92, 0.25);
}

.card-content {
    padding: 20px;
    position: relative;
    z-index: 2;
    text-align: center;
}

.card-header-community {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.icon-pulse {
    width: 36px;
    height: 36px;
    background: #e0f2fe;
    color: #0284c7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    animation: pulse-blue 2s infinite;
}

@keyframes pulse-blue {
    0% {
        box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.4);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(2, 132, 199, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(2, 132, 199, 0);
    }
}

.join-community-card h4 {
    font-size: 20px;
    margin: 0;
    color: #1e293b;
    font-weight: 800;
}

.card-desc {
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
    margin: 0 auto 20px;
    max-width: 95%;
}

.community-buttons {
    display: block;
    text-align: center;
    gap: 10px;
    margin-top: 15px;
}

.comm-btn {
    min-width: 160px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 15px;
    border-radius: 10px;
    text-decoration: none;
    color: white;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.1);
    margin: 5px;
}

.comm-btn .btn-icon {
    background: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.comm-btn .btn-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.comm-btn span {
    flex: 1;
    text-align: center;
    padding: 0 4px;
}

.arrow-action {
    font-size: 11px;
    opacity: 0.6;
    transition: transform 0.3s;
    margin-left: 8px;
}

.comm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px -3px rgba(0, 0, 0, 0.15);
}

.comm-btn:hover .arrow-action {
    transform: translateX(3px);
    opacity: 1;
}

.comm-btn.fb {
    background: linear-gradient(135deg, #1877f2, #3b82f6);
}

.comm-btn.zalo {
    background: linear-gradient(135deg, #0068ff, #009efd);
}

.comm-btn.telegram {
    background: linear-gradient(135deg, #2aabee, #229ed9);
}

@media (max-width: 600px) {
    .community-buttons {
        display: block;
        padding: 0 10px;
    }

    .comm-btn {
        width: 100%;
        box-sizing: border-box;
        justify-content: flex-start;
        margin-bottom: 10px;
        margin-left: 0;
        margin-right: 0;
    }

    .comm-btn span {
        text-align: left;
        padding-left: 10px;
    }
}


/* =========================================
   8. FIX MOBILE TABLE OVERFLOW
   ========================================= */
@media (max-width: 767px) {

    /* BẮT BUỘC: Đảm bảo bảng cuộn trên mobile */
    .dns-table-wrapper {
        overflow-x: auto;
        /* Thêm padding/margin nếu cần */
    }

    .table-new-style {
        /* BẮT BUỘC: Đảm bảo bảng đủ rộng để cuộn */
        min-width: 650px;
        table-layout: auto;
        /* Cho phép các cột tự điều chỉnh độ rộng linh hoạt hơn trên mobile */
    }

    .domain-cell-new,
    .answer-cell-new {
        /* Cho phép nội dung cột Domain và Answer xuống dòng trên mobile */
        white-space: normal;
        word-break: break-word;
    }

    /* Thiết lập lại chiều rộng cột trên mobile để hiển thị tốt hơn */
    .table-new-style thead th:nth-child(1),
    .table-new-style tbody td:nth-child(1) {
        width: 35% !important;
    }

    /* Domain */

    .table-new-style thead th:nth-child(2),
    .table-new-style tbody td:nth-child(2) {
        width: 15% !important;
    }

    /* Type */

    .table-new-style thead th:nth-child(3),
    .table-new-style tbody td:nth-child(3) {
        width: 15% !important;
    }

    /* TTL */

    .table-new-style thead th:nth-child(4),
    .table-new-style tbody td:nth-child(4) {
        width: 35% !important;
    }

    /* Answer */
}
