/* CSS for Candidate Portal */

:root {
    /* Light Mode Colors (Default) */
    --bg-color: #f4f7f6;
    --container-bg-color: #ffffff;
    --item-bg-color: #f9f9f9;
    --text-color: #333333;
    --text-muted-color: #555555;
    --border-color: #e0e0e0;
    --border-light-color: #eee;
    --primary-color: #FF6B00; /* Orange Brand Color */
    --primary-hover-color: #E66000;
    --secondary-color: #6c757d;
    --secondary-hover-color: #5a6268;
    --success-color: #28a745;
    --success-hover-color: #218838;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --progress-bar-bg: #e0e0e0;
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Dark Mode Colors */
        --bg-color: #1a1a1a;
        --container-bg-color: #252525;
        --item-bg-color: #2c3034;
        --text-color: #e0e0e0;
        --text-muted-color: #bbbbbb;
        --border-color: #444444;
        --border-light-color: #495057;
        --primary-color: #FF7A1A; /* Brighter Orange for Dark Mode */
        --primary-hover-color: #FF6B00;
        --shadow-color: rgba(255, 255, 255, 0.05);
        --progress-bar-bg: #444444;
    }
}

/* Add your styles here */
body {
    font-family: Arial, sans-serif;
    /* Flexbox for centering */
    display: flex;
    flex-direction: column; /* Stack items vertically */
    justify-content: center; /* Center vertically */
    align-items: center; /* Center horizontally */
    min-height: 100vh; /* Ensure body takes full viewport height */
    margin: 0; /* Remove default body margin */
    background-color: var(--bg-color);
    color: var(--text-color);
    padding: 0 15px 15vh 15px; /* Top, Right, Bottom, Left */
    box-sizing: border-box;
}

h1 {
    color: var(--primary-hover-color);
    text-align: center;
    margin-bottom: 10px; /* Reduce margin below the title */
}

#app-container {
    width: 100%;
    /* All visual styles removed to make this an invisible wrapper */
}

/* Styling for Login Form */
.login-container {
    width: 90%; /* Make it responsive on small screens */
    max-width: 400px; /* Cap its size on medium screens */
    margin: 20px auto; /* Center it and add vertical margin */
    padding: 30px;
    background-color: var(--container-bg-color);
    border-radius: 8px;
    box-shadow: 0 4px 8px var(--shadow-color);
    text-align: center;
    box-sizing: border-box;
}

.login-container h2 {
    color: var(--primary-hover-color);
    font-size: 2.4em; /* Ukuran font disesuaikan */
    margin-top: 10px; /* Jarak dari atas container */
    margin-bottom: 30px; /* Jarak ke form di bawah */
}

.form-group {
    max-width: 380px; /* Constrain width of form groups */
    margin-left: auto; /* Center the form groups */
    margin-right: auto; /* Center the form groups */
    margin-bottom: 15px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--text-muted-color);
}

.form-group input[type="email"],
.form-group input[type="password"] {
    width: calc(100% - 20px); /* Adjust for padding */
    padding: 10px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    border-radius: 4px;
    font-size: 16px;
}

.login-container button[type="submit"] {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 15px; /* Adjusted gap */
}

.login-container button[type="submit"]:hover {
    background-color: var(--primary-hover-color);
}


.error-message {
    color: red;
    margin-top: 10px;
}

/* Styling for Assessment List */
.assessment-list-container {
    width: 95%; /* Memberi jarak dari tepi layar di mobile */
    max-width: 575px; /* Batas lebar maksimal di desktop */
    margin: 20px auto; /* Ini yang akan membuatnya ke tengah */
    padding: 15px;
    padding-bottom: 60px;
    background-color: var(--container-bg-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
    position: relative; /* Diperlukan untuk tombol logout */
    min-height: 200px;
    box-sizing: border-box;
    /* display: flex; dihapus untuk memperbaiki bug centering */
}

.assessment-list-container h2 {
    color: var(--text-color);
    margin-bottom: 20px;
    text-align: center;
}

.assessment-list-container ul {
    list-style: none;
    padding: 0;
    flex-grow: 1; /* Allow content to take available space */
}

.assessment-item {
    background-color: var(--item-bg-color);
    border: 1px solid var(--border-color);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    text-align: center; /* Center the title and buttons */
}

.assessment-item h3 {
    color: var(--text-color);
    margin-top: 0;
    margin-bottom: 10px;
}

.assessment-item p {
    margin-bottom: 5px;
    color: var(--text-muted-color);
}

.section-buttons-container {
    display: flex;
    justify-content: center;
    gap: 50px; /* Jarak antar tombol */
}

.section-buttons-container button {
    /* Hapus margin-right karena sudah diatur oleh gap */
    margin-bottom: 10px; /* Ensure spacing in case of wrapping */
}

.assessment-item button {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px; /* Increased padding */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px; /* Increased font size */
    margin-top: 10px;
}

.assessment-item button:hover:not(:disabled) {
    background-color: var(--primary-hover-color);
}

.assessment-item button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

#logout-btn {
    background-color: var(--secondary-color);
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    position: absolute; /* Position absolutely */
    bottom: 20px; /* Increased from 10px */
    right: 20px; /* Increased from 10px */
    margin-top: 20px; /* Add some top margin */
}

#logout-btn:hover {
    background-color: var(--secondary-hover-color);
}

/* Styling for Webcam Capture */
.webcam-capture-container {
    max-width: 700px;
    margin: 20px auto;
    padding: 20px;
    background-color: var(--container-bg-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
    text-align: center;
    display: flex; /* Use flexbox */
    flex-direction: column; /* Stack items vertically */
    align-items: center; /* Center items horizontally */
    box-sizing: border-box;
}

.webcam-capture-container h2 {
    margin-top: 0;
}

.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 640px; /* Match video max-width */
    margin-bottom: 15px;
    aspect-ratio: 4 / 3;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
}

#webcam-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#face-guide-oval {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50%; /* Corrected for oval shape */
    height: 80%; /* Corrected for oval shape */
    border: 3px dashed white; /* Changed to white for better visibility */
    border-radius: 50%;
    pointer-events: none;
    z-index: 10;
}


#captured-photo-preview {
    display: block;
    margin: 10px auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    max-width: 60%;
    height: auto;
}

.btn-confirm {
    background-color: #0d6efd; /* Standard Bootstrap Blue */
    color: white;
}

.btn-confirm:hover {
    background-color: #0b5ed7; /* Darker Blue on Hover */
}



.webcam-capture-container button {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    margin: 5px;
}

.webcam-capture-container button:hover {
    background-color: var(--primary-hover-color);
}

.webcam-capture-container button#retake-btn {
    background-color: #ffc107;
    color: #333;
}

.webcam-capture-container button#retake-btn:hover {
    background-color: #e0a800;
}

.webcam-capture-container button#upload-selfie-btn {
    background-color: #0d6efd; /* Standard Bootstrap Blue */
}

.webcam-capture-container button#upload-selfie-btn:hover {
    background-color: #0b5ed7; /* Darker Blue on Hover */
}

.webcam-capture-container button#cancel-webcam-btn {
    background-color: #6c757d;
}

.webcam-capture-container button#cancel-webcam-btn:hover {
    background-color: #5a6268;
}

/* Styling for Test Page */
.test-page-container {
    max-width: 800px;
    margin: 40px auto; /* Increased top margin */
    padding: 30px;
    background-color: var(--container-bg-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
    box-sizing: border-box; /* Include padding and border in the element's total width */
    position: relative; /* Added for positioning progress bar */
    min-height: 400px; /* Ensure enough height for content and progress bar */
    display: flex;
    flex-direction: column;
}

/* Styling for Completion Page */
.assessment-completed-container {
    max-width: 575px; /* Consistent max-width */
    margin: 20px auto; /* Center the container */
    padding: 40px 20px;
    background-color: var(--container-bg-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color);
    text-align: center;
    box-sizing: border-box;
}

.assessment-completed-container h2 {
    color: var(--primary-hover-color);
    margin-bottom: 25px;
    position: relative; /* Allow visual positioning */
    top: -20px; /* Shift further upwards */
}

.assessment-completed-container p {
    margin-bottom: 0; /* Remove gap between paragraphs */
    font-size: 1.1em;
    line-height: 1.2; /* Reduce line height for closer text */
}

.assessment-completed-container p:last-of-type {
    margin-bottom: 30px; /* Ensure enough space before the button */
}

.final-instruction {
    margin-top: 25px;
    font-weight: 600;
    color: var(--text-muted-color);
}

.assessment-completed-container button {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    position: relative;
    top: 20px; /* Shift further downwards */
}

.assessment-completed-container button:hover {
    background-color: var(--primary-hover-color);
}


.test-page-container h2 {
    color: var(--primary-hover-color);
    margin-bottom: 20px;
    text-align: center;
}

.test-page-container p {
    color: var(--text-muted-color);
    margin-bottom: 10px;
}

.test-item {
    background-color: var(--item-bg-color);
    border: 1px solid var(--border-light-color);
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 15px;
}

.test-item h3 {
    color: var(--text-color);
    margin-top: 0;
    margin-bottom: 10px;
}

.test-item img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px 0;
    border-radius: 4px;
}

.likert-scale label,
.options label {
    display: block;
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 16px;
}

.likert-scale input[type="radio"],
.options input[type="radio"] {
    margin-right: 8px;
}

textarea {
    width: calc(100% - 20px);
    padding: 10px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    border-radius: 4px;
    font-size: 16px;
    min-height: 100px;
    resize: vertical;
}

.test-page-container > button {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
    margin-right: 10px;
}

.test-page-container button:hover {
    background-color: var(--primary-hover-color);
}

.test-page-container button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}


.test-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.progress-text {
    font-size: 0.9em;
    color: var(--text-muted-color);
    white-space: nowrap; /* Prevent text from wrapping */
}

#inventory-progress {
    flex-grow: 1; /* Allow the progress bar to take up remaining space */
    height: 15px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 5px;
    overflow: hidden;
}

.test-page-actions {
    margin-top: 0; /* Reset margin */
    padding-top: 0; /* Reset padding */
}

#skip-btn {
    background-color: var(--secondary-color);
    padding: 8px 16px;
    font-size: 14px;
    margin: 0; /* Reset margin */
    color: white; /* Make text readable */
}

#skip-btn:hover {
    background-color: var(--secondary-hover-color);
}

/* Animation for item transition */
#test-item-container {
    transition: opacity 0.3s ease-in-out;
    flex-grow: 1; /* Allow item container to take up space */
    display: flex;
    align-items: center;
    justify-content: center;
}
#test-item-container.fade-out {
    opacity: 0;
}

/* === NEW INVENTORY UI STYLES === */

#progress-container {
    padding: 0 20px;
    margin-bottom: 20px;
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.progress-bar-container progress {
    flex-grow: 1;
    height: 15px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar-container span {
    font-size: 0.9em;
    color: var(--text-muted-color);
}

.timer {
    text-align: center;
    font-weight: bold;
    color: var(--primary-color);
}

.inventory-item-wrapper {
    width: 100%;
    text-align: center;
}

/* General rule for both real test and example */
.inventory-text {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-color);
    line-height: 1.4;
}

/* Specific rule for the REAL test page */
.test-page-container .inventory-text {
    margin-bottom: 40px;
    min-height: 4.2em; /* Reserve space for 3 lines (1.4 * 3) to prevent layout shift */
}

/* Specific rule for the EXAMPLE on the instruction page */
.example-container .inventory-text {
    margin-bottom: 20px; /* Smaller margin for the example */
    min-height: 2.8em; /* Reserve space for 2 lines (1.4 * 2) */
}

.likert-scale {
    margin-top: 30px;
}

.likert-options {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* Align columns at the top */
}

.likert-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    text-align: center;
    width: 20%;
    -webkit-tap-highlight-color: transparent; /* Disable tap flash */
}

.likert-option-main {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.likert-top-label {
    font-size: 0.9em;
    color: var(--text-muted-color);
    margin-bottom: 10px;
    min-height: 2.2em;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* FIX: Use a fixed height only for the instruction page example to ensure alignment */
.example-container .likert-top-label {
    height: 2.2em;
}

.likert-option input[type="radio"] {
    margin-bottom: 8px;
    width: 20px;
    height: 20px;
}

.likert-option span:not(.likert-top-label) {
    font-size: 18px;
}

/* Styling for the progress bar background */
#inventory-progress::-webkit-progress-bar {
    background-color: var(--progress-bar-bg);
    border-radius: 5px;
}

/* Styling for the progress bar value */
#inventory-progress::-webkit-progress-value {
    background-color: var(--primary-color);
    border-radius: 5px;
    transition: width 0.2s ease-in-out;
}

#inventory-progress::-moz-progress-bar {
    background-color: var(--primary-color);
    border-radius: 5px;
}

/* --- Inactivity Modal Styles --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.inactivity-modal {
    background-color: var(--container-bg-color);
    padding: 25px 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.inactivity-modal h2 {
    margin-top: 0;
    font-size: 1.5em;
    color: var(--primary-hover-color);
}

.inactivity-modal p {
    margin-bottom: 15px;
    font-size: 1em;
}

#modal-countdown {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 20px;
}

#modal-confirm-btn {
    background-color: var(--success-color);
    color: white;
    padding: 10px 20px;
    font-size: 1em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#modal-confirm-btn:hover {
    background-color: var(--success-hover-color);
}

/* --- Responsive Design --- */

/* For tablets and larger */
@media (min-width: 768px) {
    #app-container {
        width: 90%;
    }
}

/* For desktops and larger */
@media (min-width: 1200px) {
    body {
        font-size: 18px; /* Increase base font size */
    }
    h1 {
        font-size: 2.5rem;
    }
    .inventory-text {
        font-size: 28px;
        margin-bottom: 50px; /* Reverted to original margin below text */
    }
    .likert-option span {
        font-size: 20px;
    }

    #app-container {
        max-width: 1140px;
    }
    .login-container { max-width: 500px; } /* Wider login box for desktops */
    .assessment-list-container {
        max-width: 800px;
    }
    .test-page-container {
         max-width: 960px;
    }
}

/* For very large screens */
@media (min-width: 1600px) {
    body {
        font-size: 20px;
        line-height: 1.7; /* Further increase line height */
    }
    h1 {
        font-size: 3rem;
    }
    #app-container {
        max-width: 1400px;
    }
    .login-container { max-width: 600px; } /* Even wider login box for very large desktops */
    .test-page-container {
         max-width: 1100px;
    }
    .inventory-item-wrapper {
        padding: 40px;
    }
    .inventory-text {
        font-size: 32px;
        margin-bottom: 50px; /* Reverted to original margin below text */
    }
}

/* New styles for instruction page */
.instruction-container {
    max-width: 960px; /* Consistent max-width */
    margin: 20px auto; /* Center the container */
    padding: 20px;
    background-color: var(--container-bg-color); /* Use main container color */
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-color); /* Add shadow */
    line-height: 1.6;
    box-sizing: border-box;
}

.instruction-container h1 {
    margin-bottom: 30px;
}

.scale-explanation {
    display: flex;
    justify-content: center; /* Center content horizontally */
    flex-wrap: wrap;
    gap: 30px; /* Increased spacing between items */
    padding: 15px;
    background-color: var(--bg-color);
    border-radius: 5px;
    margin: 20px 0;
}

.example-container {
    border: 2px dashed var(--secondary-color);
    padding: 20px;
    margin-top: 30px;
    margin-bottom: 30px;
    border-radius: 8px;
}

.inventory-text-example {
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
    min-height: 3.6em; /* Reserve space for ~3 lines to prevent layout shift */
}

.likert-scale-example {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.example-caption {
    font-size: 0.9em;
    color: var(--text-muted-color);
    text-align: center;
}

#start-inventory-btn {
    display: block;
    width: 50%;
    margin: 20px auto 0 auto;
    padding: 15px;
    font-size: 1.2em;
    font-weight: bold;
    background-color: var(--primary-color); /* Changed to primary branding color */
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#start-inventory-btn:hover {
    background-color: var(--primary-hover-color); /* Changed to primary branding hover color */
}

/* New default responsive logic */
.likert-desktop-wrapper {
    display: flex;
    width: 100%;
    justify-content: space-between;
}
.likert-mobile-wrapper {
    display: none;
}

/* --- MOBILE RESPONSIVE FOR ASSESSMENT PAGE --- */
@media (max-width: 600px) {
    /* Hide Desktop UI on Mobile */
    .likert-desktop-wrapper {
        display: none;
    }
    /* Show Mobile UI on Mobile */
    .likert-mobile-wrapper {
        display: flex;
        flex-direction: column;
        gap: 10px;
        align-items: center;
        width: 100%;
    }

    /* Hide the scale explanation on mobile as the cards are self-explanatory */
    .scale-explanation {
        display: none;
    }

    .webcam-capture-container {
        width: 95%;
        margin: 20px auto;
        padding: 20px;
    }

    .webcam-capture-container button {
        padding: 8px 12px;
        font-size: 14px;
    }

    #captured-photo-preview {
        max-width: 200px !important; /* Force override of inline style */
    }

    .test-page-container {
        padding: 15px;
        margin: 10px;
        min-height: 0;
    }

    /* Make text area on real test page stable to prevent layout jank */
    .test-page-container .inventory-text {
        font-size: 20px; /* Smaller font for the statement on mobile */
        margin-bottom: 30px;
        min-height: 5.6em; /* Reserve space for 4 lines (1.4 * 4) to prevent layout shift */
    }

    /* Primary: Full-text card styles */
    .likert-card-button {
        display: block;
        width: 80%; /* Re-adjusted width as requested */
        padding: 15px;
        font-size: 1.1em;
        text-align: center;
        border: 1px solid var(--border-color);
        background-color: var(--item-bg-color) !important; /* Force background color */
        color: var(--text-color);
        border-radius: 8px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent !important; /* Force disable tap flash */
        outline: none !important; /* Force disable outline */
    }

    /* More robust fix for tap flash */
    .likert-card-button:focus,
    .likert-card-button:active {
        -webkit-tap-highlight-color: transparent !important;
        outline: none !important;
        -moz-focus-inner: none !important;
        background-color: var(--item-bg-color) !important; /* Explicitly force background on tap */
    }

    .likert-mobile-wrapper .likert-card-button.selected { /* Increased specificity */
        background-color: var(--secondary-color) !important; /* Forcing override for stubborn bug */
        color: white;
        border-color: var(--secondary-hover-color);
    }

    .progress-bar-container {
        flex-direction: column;
        gap: 5px;
    }

    .section-buttons-container {
        gap: 15px;
        flex-direction: column;
        align-items: center;
    }

    .section-buttons-container button {
        /* No width property, let it size to content */
    }
}

