/* He Thong Tao De Kiem Tra - Custom CSS */

:root {
    --primary: #1a2a6c;
    --secondary: #4b6cb7;
    --accent: #27ae60;
    --light-bg: #f8fafc; /* Lighter, modern SaaS bg */
    --text-main: #334155;
    --text-muted: #64748b;
}

body {
    background-color: var(--light-bg);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

html {
    overflow-x: hidden;
}

/* Modern Typography for Headings */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
}

h1 { font-size: clamp(1.75rem, 3vw + 1rem, 2.5rem); }
h2 { font-size: clamp(1.5rem, 2.5vw + 0.5rem, 2rem); }
h3 { font-size: clamp(1.25rem, 2vw + 0.5rem, 1.75rem); }

/* Global Button Styling for a Premium Feel */
.btn {
    border-radius: 10px;
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', sans-serif;
}

.btn:active {
    transform: scale(0.97);
}

/* Form Controls Optimization for Touch & Readability */
.form-control, .form-select {
    border-radius: 10px;
    padding: 0.75rem 1rem;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    font-size: 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02) inset;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 4px rgba(75, 108, 183, 0.15);
}

/* ---- Navbar ---- */
.navbar-custom {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border-bottom: 1px solid #e2e8f0;
}

.navbar-custom .nav-link {
    color: #475569 !important;
    font-weight: 500;
    transition: color 0.2s, background-color 0.2s;
    border-radius: 8px;
}

.navbar-custom .nav-link:hover,
.navbar-custom .nav-link.active {
    color: #0f172a !important;
    background-color: #f1f5f9;
}

.navbar-brand {
    color: #0f172a !important;
    font-weight: 800;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.25rem;
}

/* ---- Cards ---- */
.card {
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    background-color: #ffffff;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
}

.card-header-gradient {
    background: linear-gradient(135deg, #1e293b, #334155);
    color: white;
    border-radius: 16px 16px 0 0 !important;
    border-bottom: none;
}

/* ---- Step Badge ---- */
.step-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a2a6c, #4b6cb7);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.step-badge.active {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

.step-badge.completed {
    background: #28a745;
}

/* ---- Wizard Steps ---- */
.wizard-step {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 8px;
    background: white;
    border: 2px solid #e0e8ff;
    transition: all 0.3s;
}

.wizard-step.active {
    border-color: #4b6cb7;
    background: #f0f4ff;
}

.wizard-step.completed {
    border-color: #28a745;
    background: #f0fff4;
}

/* ---- Upload Zone ---- */
.upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    padding: 30px 20px;
    text-align: center;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.upload-zone:hover,
.upload-zone.dragover {
    background: #f8fafc;
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.1);
}

.upload-zone .upload-icon {
    font-size: 2.5rem;
    color: #94a3b8;
    margin-bottom: 10px;
    transition: color 0.3s;
}

.upload-zone:hover .upload-icon,
.upload-zone.dragover .upload-icon {
    color: #3b82f6;
}

/* ---- Form Controls ---- */
.form-control:focus,
.form-select:focus {
    border-color: #4b6cb7;
    box-shadow: 0 0 0 0.25rem rgba(75, 108, 183, 0.2);
}

/* ---- Buttons ---- */
.btn-primary {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border: none;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.3);
}

.btn-success-custom {
    background: linear-gradient(135deg, #10b981, #34d399);
    border: none;
    color: white;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.btn-success-custom:hover {
    background: linear-gradient(135deg, #059669, #10b981);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.3);
    color: white;
}

/* ---- Loading Overlay ---- */
#loading-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(26, 42, 108, 0.85);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- QR Code Card ---- */
.qr-card {
    border-radius: 16px;
    overflow: hidden;
    border: none;
    box-shadow: 0 4px 20px rgba(26, 42, 108, 0.1);
}

.qr-card .set-header {
    background: linear-gradient(135deg, #1a2a6c, #4b6cb7);
    color: white;
    padding: 15px 20px;
    font-weight: 700;
    font-size: 1.1rem;
}

.qr-code-img {
    max-width: 180px;
    border-radius: 8px;
    border: 3px solid #e0e8ff;
}

/* ---- Score Table ---- */
.score-excellent { background-color: #d4edda !important; }
.score-good      { background-color: #fff3cd !important; }
.score-weak      { background-color: #f8d7da !important; }

/* ---- Hero Section ---- */
.hero-section {
    background: linear-gradient(135deg, #1a2a6c 0%, #4b6cb7 50%, #182848 100%);
    color: white;
    padding: 20px 0 50px 0;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: 5%;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
}

/* ---- Footer ---- */
footer {
    background: #0f1a3d;
    color: rgba(255,255,255,0.7);
    padding: 20px 0;
    margin-top: auto;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .hero-section {
        padding: 15px 0 40px 0;
    }
    .hero-section h1 {
        font-size: 1.6rem;
    }
    .upload-zone {
        padding: 20px 10px;
    }
}

/* ---- Responsive Table to Mobile Cards ---- */
@media (max-width: 767.98px) {
    .mobile-card-table {
        background-color: transparent !important;
        border: none !important;
    }
    
    .mobile-card-table thead {
        display: none; /* Hide standard headers */
    }
    
    .mobile-card-table, 
    .mobile-card-table tbody, 
    .mobile-card-table tr, 
    .mobile-card-table td {
        display: block;
        width: 100%;
    }
    
    .mobile-card-table tr {
        background-color: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        margin-bottom: 1rem;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
        padding: 0.5rem 0;
        overflow: hidden;
    }
    
    .mobile-card-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right !important;
        padding: 0.75rem 1.25rem !important;
        border-bottom: 1px solid #f1f5f9;
        font-size: 0.95rem;
    }
    
    .mobile-card-table td:last-child {
        border-bottom: none;
        background-color: #f8fafc;
        justify-content: flex-end; /* Align action buttons to right */
        gap: 0.5rem;
        flex-wrap: wrap;
        padding: 1rem 1.25rem !important;
    }
    
    .mobile-card-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-right: auto; /* Push label to the left */
        padding-right: 1rem;
        text-align: left;
    }
    
    /* specific overrides for color-coded rows in results table */
    .mobile-card-table tr.score-excellent { border-left: 5px solid #10b981; }
    .mobile-card-table tr.score-good { border-left: 5px solid #f59e0b; }
    .mobile-card-table tr.score-weak { border-left: 5px solid #ef4444; }
}

/* ---- Animations ---- */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Copy button feedback ---- */
.copied {
    background: #28a745 !important;
    border-color: #28a745 !important;
}
