/* =========================================
    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;
    --card-bg: #fff;
    --secondary-text: #666; 
}

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: var(--secondary-text);
    max-width: 600px;
    margin: 0 auto;
    font-size: 15px;
}

/* =========================================
    3. TOOL CARD
    ========================================= */
.tool-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    background: var(--card-bg);
    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;
}

/* =========================================
    4. IP DISPLAY & TABLE (Light Mode)
    ========================================= */
.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;
}

.big-ip-display {
    display: flex; 
    align-items: center;
    justify-content: space-between; 
    
    font-weight: 800;
    color: #2c3e50;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    background-color: #f7f7f7;
    flex-wrap: wrap; 
    gap: 10px;
}

.ip-group {
    flex-grow: 1;
    min-width: 0;
}

.ip-line {
    display: flex;
    align-items: baseline;
    line-height: 1.5;
}

.ip-label {
    font-weight: 700;
    color: #6c757d; 
    min-width: 60px; 
    white-space: nowrap;
    font-size: 0.9em;
}

/* SỬA LỖI: HIỂN THỊ IP/N/A */
.ip-value {
    flex-grow: 1; 
    text-align: left;
    margin-left: 10px;
    font-weight: 800;
    font-family: monospace; /* Font IP */
    color: var(--main-color); /* Màu xanh đẹp */
    overflow-wrap: break-word;
    word-break: break-all;
    font-size: 1.4em; /* TĂNG SIZE CHỮ IP */
}

/* Giữ chữ N/A và UNKNOWN không bị đổi màu quá rực rỡ */
.ip-value:is([id*="N/A"], [id*="UNKNOWN"]) {
    color: #999; 
    font-family: 'Be Vietnam Pro', sans-serif;
    font-weight: 600;
    font-style: italic;
    font-size: 1.2em; /* Giảm nhẹ size N/A/UNKNOWN so với IP */
}


.copy-button-group {
    flex-shrink: 0;
    align-self: center;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Nút copy */
.btn-copy-ip {
    background-color: var(--main-color);
    color: white;
    font-weight: 600;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    transition: all 0.3s;
    font-size: 1rem;
    white-space: nowrap;
}

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

/* Nút chụp ảnh */
.btn-screenshot {
    background-color: #34495e;
    color: white;
    font-weight: 600;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    transition: all 0.3s;
    font-size: 1rem;
    white-space: nowrap;
}

.btn-screenshot:hover:not(:disabled) {
    background-color: #2c3e50;
    color: white;
}

.btn-screenshot:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

/* Khu vực kết quả sau khi chụp ảnh */
.screenshot-result {
    margin-top: 20px;
    padding: 15px;
    border: 2px dashed #ddd;
    border-radius: 10px;
    background-color: #f7f7f7;
}

.screenshot-result-inner {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.screenshot-thumb {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #fff;
    flex-shrink: 0;
}

.screenshot-result-info {
    flex: 1;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.screenshot-link-input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background-color: #fff;
    color: var(--text-color);
    font-size: 0.9rem;
}

.screenshot-result-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-view-screenshot,
.btn-copy-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: all 0.3s;
}

.btn-view-screenshot {
    background-color: #3498db;
    color: #fff;
}
.btn-view-screenshot:hover {
    background-color: #2980b9;
    color: #fff;
}

.btn-copy-link {
    background-color: var(--main-color);
    color: #fff;
}
.btn-copy-link:hover {
    background-color: var(--main-color-hover);
    color: #fff;
}

.screenshot-autocopy-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--main-color);
    background-color: rgba(92, 184, 92, 0.12);
    padding: 6px 12px;
    border-radius: 20px;
    animation: fadeInBadge 0.25s ease;
}

@keyframes fadeInBadge {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Bảng chi tiết */
.ip-detail-table {
    width: 100%;
    margin-top: 30px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}
.ip-detail-table th, .ip-detail-table td {
    padding: 15px;
    vertical-align: middle;
}
.ip-detail-table th {
    background-color: #5cb85c;
    color: white;
    font-weight: 600;
    width: 30%;
}
.ip-detail-table td {
    background-color: #fff;
    color: #333;
    font-weight: 500;
    border-bottom: 1px solid #eee;
}
.ip-detail-table tr:last-child td {
    border-bottom: none;
}

.user-agent-cell {
    word-break: break-all;
}

/* Dòng phân tách không dùng nữa */
.table-separator td {
    background-color: #f1f1f1 !important;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    font-size: 0.9em;
    letter-spacing: 0.5px;
    color: #6c757d !important;
}

/* =========================================
    5. 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;
}

/* =========================================
    6. 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);
}

/* =========================================
    7. MOBILE OPTIMIZATION
    ========================================= */
@media (max-width: 576px) {
    .big-ip-display {
        flex-direction: column; /* Xếp dọc trên màn hình nhỏ */
        align-items: flex-start;
        font-size: 1rem;
        gap: 15px;
    }
    
    .ip-group {
        width: 100%;
    }

    .ip-line {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ip-label {
        font-size: 0.85rem;
        margin-bottom: 2px;
        min-width: auto;
    }

    .ip-value {
        width: 100%;
        margin-left: 0;
        font-size: 1.2em;
    }
    
    .ip-value:is([id*="N/A"], [id*="UNKNOWN"]) {
        font-size: 1em;
    }


    .copy-button-group {
        width: 100%;
        flex-direction: column;
    }

    .btn-copy-ip,
    .btn-screenshot {
        width: 100%;
        margin-left: 0 !important;
        margin-top: 5px;
        font-size: 1rem;
    }

    .screenshot-result-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .screenshot-thumb {
        width: 100%;
        height: 160px;
    }

    .screenshot-result-actions {
        width: 100%;
    }

    .btn-view-screenshot,
    .btn-copy-link {
        flex: 1;
        justify-content: center;
    }
    
    .user-agent-cell {
        word-break: break-all;
    }
    
    .community-buttons {
        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;
    }
}
