/* ==========================================================================
   1. KHUNG CHỨA CHÍNH (CẬP NHẬT: CSS PHÁ KHUNG THEME ĐỂ RỘNG RA)
   ========================================================================== */
.cert-lookup-container {
    max-width: 650px;
    margin: 30px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    box-sizing: border-box;
}

/* Kỹ thuật phá khung: Bất kể Theme ép bao nhiêu, khung này vẫn bung rộng ra được */
.cert-admin-dashboard {
    width: 95vw !important;             /* Chiếm 95% toàn màn hình hiển thị */
    max-width: 1350px !important;       /* Rộng tối đa 1350px để thoải mái chứa 9 cột */
    position: relative !important;
    left: 50% !important;               /* Đẩy sang giữa */
    transform: translateX(-50%) !important; /* Căn chuẩn giữa màn hình */
    margin: 30px 0 !important;
    padding: 30px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    box-sizing: border-box;
}

.cert-title {
    text-align: center;
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: 700;
}

/* ==========================================================================
   2. THÀNH PHẦN FORM & Ô NHẬP LIỆU
   ========================================================================== */
.cert-form-group {
    display: block !important;
    width: 100% !important;
    margin-bottom: 20px !important;
    clear: both !important;
}

.cert-input-block {
    margin-bottom: 20px;
}

.cert-form-group label,
.cert-input-block label,
.cert-admin-form label {
    display: block !important;
    font-weight: 600 !important;
    margin-bottom: 8px !important;
    color: #34495e !important;
    font-size: 14px !important;
    float: none !important;
}

.cert-form-group input[type="text"], 
.cert-form-group input[type="date"],
.cert-input-block input[type="text"],
.cert-input-block input[type="date"],
.cert-admin-form input[type="file"] {
    display: block !important;
    width: 100% !important;
    padding: 10px 12px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 5px !important;
    box-sizing: border-box !important;
    font-size: 15px !important;
    color: #334155 !important;
}

.cert-form-group select {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px 12px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 5px !important;
    box-sizing: border-box !important;
    background-color: #ffffff !important;
    height: 42px !important;
    font-size: 15px !important;
    color: #334155 !important;
    float: none !important;
}

.cert-form-group input:focus,
.cert-input-block input:focus,
.cert-form-group select:focus {
    border-color: #3498db !important;
    outline: none !important;
}

.cert-radio-group {
    margin-bottom: 25px;
    background: #f8fafc;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.cert-radio-group label {
    margin-right: 25px;
    cursor: pointer;
    font-weight: 500;
    color: #475569;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cert-admin-header-nav {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* ==========================================================================
   3. NÚT BẤM (BUTTONS)
   ========================================================================== */
.cert-btn-submit, 
.cert-btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #3498db;
    color: #ffffff !important;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    transition: background-color 0.2s ease;
}

.cert-btn-submit:hover { background-color: #2980b9; }
.cert-btn-success { background-color: #2ecc71; }
.cert-btn-success:hover { background-color: #27ae60; }
.cert-btn-info { background-color: #9b59b6; }
.cert-btn-info:hover { background-color: #8e44ad; }

.cert-btn-submit {
    width: 100%;
    font-size: 16px;
    padding: 12px;
    margin-top: 10px;
}

/* ==========================================================================
   4. HỘP THÔNG BÁO (ALERTS)
   ========================================================================== */
.cert-alert {
    padding: 14px;
    margin: 20px 0;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    border-left: 4px solid transparent;
}
.cert-alert-danger { background-color: #fef2f2; color: #991b1b; border-left-color: #ef4444; }
.cert-alert-success { background-color: #f0fdf4; color: #166534; border-left-color: #22c55e; }
.cert-alert-warning { background-color: #fffbec; color: #b45309; border-left-color: #f59e0b; }
.cert-alert-info { background-color: #f0f9ff; color: #0369a1; border-left-color: #0ea5e9; font-size: 13.5px; line-height: 1.6; }

/* ==========================================================================
   5. HIỂN THỊ KẾT QUẢ TRA CỨU MÔI TRƯỜNG NGOÀI (FRONTEND)
   ========================================================================== */
.cert-results-area {
    margin-top: 35px;
    border-top: 2px dashed #e2e8f0;
    padding-top: 25px;
}

.cert-success-title { color: #1e293b; margin-bottom: 20px; font-size: 18px; }
.cert-card { border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 25px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.02); }
.cert-card-header { background: #2c3e50; color: #ffffff; padding: 12px 20px; font-weight: 700; font-size: 16px; }
.cert-result-table { width: 100%; border-collapse: collapse; background: #ffffff; }
.cert-result-table th, .cert-result-table td { padding: 12px 20px; border-bottom: 1px solid #f1f5f9; font-size: 15px; }
.cert-result-table th { text-align: left; width: 30%; color: #64748b; font-weight: 600; background-color: #fafafa; }
.cert-result-table td { color: #1e293b; }

/* ==========================================================================
   6. BẢNG DỮ LIỆU ĐIỀU HÀNH ADMIN (ĐÃ FIX CO CHỮ)
   ========================================================================== */
.cert-table-responsive {
    width: 100% !important;
    overflow-x: auto !important; /* Bật thanh cuộn ngang thông minh nếu màn hình hẹp */
    margin-top: 15px !important;
    -webkit-overflow-scrolling: touch;
}

.cert-admin-table {
    width: 100% !important;
    min-width: 1200px !important; /* Khóa độ rộng an toàn để 9 cột không bao giờ bị dồn chữ */
    border-collapse: collapse;
}

.cert-admin-table th, 
.cert-admin-table td {
    border: 1px solid #e2e8f0;
    padding: 12px 10px;
    text-align: left;
    font-size: 14px;
    white-space: normal; /* Cho phép tự động xuống hàng theo từ chữ nếu quá dài */
}

.cert-admin-table th {
    background-color: #f8fafc;
    color: #334155;
    font-weight: 600;
}

.cert-admin-table tr:hover { background-color: #f8fafc; }
.cert-admin-table td a { color: #3498db; text-decoration: none; font-weight: 500; }
.cert-admin-table td a:hover { text-decoration: underline; }

/* ==========================================================================
   7. PHÂN TRANG (PAGINATION)
   ========================================================================== */
.cert-pagination { margin-top: 25px; text-align: center; display: flex; justify-content: center; gap: 5px; }
.cert-pagination a { display: inline-block; padding: 6px 12px; border: 1px solid #cbd5e1; border-radius: 4px; text-decoration: none; color: #334155; font-size: 14px; }
.cert-pagination a:hover { background-color: #f1f5f9; border-color: #94a3b8; }
.cert-pagination a.active { background: #3498db; color: #ffffff !important; border-color: #3498db; font-weight: 600; }

/* ==========================================================================
   8. NHÃN TRẠNG THÁI HIỆU LỰC
   ========================================================================== */
.cert-status { display: inline-block; padding: 4px 10px; font-size: 12px; font-weight: 600; border-radius: 4px; text-align: center; white-space: nowrap; }
.cert-status-valid { background-color: #e6f4ea !important; color: #137333 !important; border: 1px solid #ceead6 !important; }
.cert-status-expired { background-color: #fce8e6 !important; color: #c5221f !important; border: 1px solid #fad2cf !important; }

/* ==========================================================================
   9. ĐÁP ỨNG THIẾT BỊ DI ĐỘNG (RESPONSIVE)
   ========================================================================== */
@media screen and (max-width: 600px) {
    .cert-lookup-container, 
    .cert-admin-dashboard {
        padding: 15px;
        margin: 10px;
    }
    .cert-result-table th, .cert-result-table td { display: block; width: 100%; padding: 8px 10px; }
    .cert-result-table th { background-color: #f8fafc; border-bottom: none; }
}