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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #0c0f16; /* Nền tối phẳng hoàn toàn, không gradient */
    color: #ffffff;
    min-height: 100vh;
    padding: 40px 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
}

.header p {
    font-size: 1rem;
    color: #566681;
    margin-top: 8px;
}

/* ĐẬP BỎ HOÀN TOÀN KHUNG BAO QUANH NGOÀI */
.main {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin-bottom: 40px;
}

.controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 35px;
}

.btn {
    padding: 12px 30px;
    font-size: 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #0066ff; /* Màu phẳng */
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #0052cc;
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #161b26;
    color: #a0aec0;
    border: 1px solid #222b3a;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #222b3a;
}

/* Khung hiển thị trạng thái chữ */
.status {
    text-align: center;
    padding: 16px;
    background-color: #111622;
    border-radius: 6px;
    border-left: 4px solid #0066ff;
    margin-bottom: 35px;
}

.status p {
    font-size: 1rem;
    color: #0066ff;
}

.progress {
    margin: 35px 0;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: #161b26;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #0066ff;
    width: 0%;
    transition: width 0.3s ease;
}

#progressText {
    text-align: center;
    margin-top: 10px;
    color: #0066ff;
    font-weight: 600;
}

/* GIỮ NGUYÊN LAYOUT CÁC Ô VUÔNG (GRID) */
.results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 35px 0;
}

/* Các ô vuông phẳng đặt trực tiếp lên nền tối của body */
.result-card {
    background-color: #161b26; /* Màu ô phẳng lì */
    border: 1px solid #222b3a;
    color: white;
    padding: 25px 20px;
    border-radius: 8px;
    text-align: center;
}

.result-icon {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.result-value {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    margin-bottom: 8px;
}

.result-value span:first-child {
    font-size: 2.2rem;
    font-weight: 700;
    font-family: monospace, sans-serif;
}

/* Đổi màu phẳng riêng cho số của từng ô vuông để dễ nhìn */
.result-card:nth-child(1) .result-value span:first-child { color: #38bdf8; } /* Download */
.result-card:nth-child(2) .result-value span:first-child { color: #34d399; } /* Upload */
.result-card:nth-child(3) .result-value span:first-child { color: #fbbf24; } /* Latency */
.result-card:nth-child(4) .result-value span:first-child { color: #c084fc; } /* Jitter */

.result-unit {
    font-size: 0.9rem;
    color: #64748b;
}

.result-label {
    font-size: 0.85rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* LỊCH SỬ ĐO PHẲNG KHÔNG KHUNG */
.history {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
}

.history h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    color: #ffffff;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background-color: #161b26;
    border: 1px solid #222b3a;
    border-radius: 8px;
}

.history-item-time {
    color: #64748b;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.history-item-values {
    color: #e2e8f0;
    font-weight: 600;
    font-size: 0.95rem;
}

.history-item-delete {
    background-color: transparent;
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.history-item-delete:hover {
    background-color: #ef4444;
    color: white;
}

.empty-history {
    text-align: center;
    color: #64748b;
    padding: 20px;
}

/* Responsive mượt cho mobile */
@media (max-width: 600px) {
    .results {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 400px) {
    .results {
        grid-template-columns: 1fr;
    }
}
