/* Global Resets - Add this at the very top of your CSS file */
html {
    box-sizing: border-box;
}
*, *::before, *::after {
    box-sizing: inherit;
}

body {
    margin: 0;
    padding: 0; /* Good practice, though often not strictly necessary if body margin is 0 */
    overflow-x: hidden; /* Prevents horizontal scrollbar if any content accidentally overflows */
}

/* instructions.css */

/* Ensure text has consistent padding from the container edges */
.instructions-content {
    margin-bottom: 32px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 20px 24px; /* Increased horizontal padding slightly */
    border-radius: var(--border-radius-md);
    background-color: var(--light-bg);
}

/* Adjust heading margins for better flow */
.instructions-content h2 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-size: var(--font-size-lg);
    color: var(--primary-color);
    line-height: 1.3; /* Improve readability of headings */
}

.instructions-content h2:first-child {
    margin-top: 0;
}

/* Ensure paragraphs have bottom margin for separation */
.instructions-content p {
    margin-bottom: 16px; /* Add margin to paragraphs if they appear tightly packed */
    line-height: 1.6; /* Standard for good text readability */
}

/* List styling - you already have good basics, let's refine */
.instructions-content ul {
    padding-left: 28px; /* Slightly increase indentation for clarity */
    margin-bottom: 16px;
    list-style-type: disc; /* Ensure standard disc bullets if not appearing */
}

.instructions-content ol { /* Add styling for ordered lists too */
    padding-left: 28px;
    margin-bottom: 16px;
}

.instructions-content li {
    margin-bottom: 8px;
    line-height: 1.5; /* Ensure good line spacing within list items */
}

/* Table styling - you have good basics, ensuring internal cell spacing */
.instructions-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); /* Subtle shadow for table */
}

.instructions-content th,
.instructions-content td {
    padding: 12px 15px; /* Add slightly more horizontal padding inside cells */
    text-align: left;
    border: 1px solid var(--border-color);
}

.instructions-content th {
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600; /* Make table headers slightly bolder */
}

/* Add a specific rule for the dark mode table header if needed for contrast */
.dark-mode .instructions-content th {
    background-color: var(--primary-light); /* Will be dark in dark mode */
    color: var(--primary-color); /* Will be light in dark mode */
}

/* General text readability */
.instructions-content {
    font-size: var(--font-size-md); /* Ensure base font size is good */
    color: var(--text-color);
}

/* Responsive adjustments for instructions content padding */
@media screen and (max-width: 768px) {
    .instructions-content {
        padding: 16px 20px; /* Adjust padding for smaller screens */
    }
    .instructions-content ul,
    .instructions-content ol {
        padding-left: 24px;
    }
}

@media screen and (max-width: 576px) {
    .instructions-content {
        padding: 12px 16px; /* Further adjust for very small screens */
    }
    .instructions-content ul,
    .instructions-content ol {
        padding-left: 20px;
    }
}

/* Your existing CSS for #instructions-screen and other elements */
#instructions-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--light-bg);
    padding: 20px;
}

.instructions-container {
    background-color: var(--light-card-bg);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 8px 24px var(--shadow-color);
    width: 100%;
    max-width: 900px;
    padding: 32px;
    /* CHANGE STARTS HERE */
    margin: 20px auto; /* This sets top/bottom margin to 20px, and left/right to auto */
    /* OR, if you only want vertical margin, use: */
    /* margin-top: 20px; */
    /* margin-bottom: 20px; */
    /* margin-left: auto; */
    /* margin-right: auto; */
    /* My first suggestion (margin: 20px auto;) is cleaner and usually sufficient */
    /* CHANGE ENDS HERE */
    transition: all var(--transition-normal);
}

.instructions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.instructions-header h1 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-color);
}

.candidate-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.candidate-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--light-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.candidate-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.candidate-photo .material-symbols-rounded {
    font-size: 48px;
    color: var(--text-secondary);
}

.candidate-details p {
    margin-bottom: 8px;
    font-size: var(--font-size-sm);
}

.instructions-content {
    margin-bottom: 32px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 16px;
    border-radius: var(--border-radius-md);
    background-color: var(--light-bg);
}

.instructions-content::-webkit-scrollbar {
    width: 6px;
}

.instructions-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.instructions-content h2 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-size: var(--font-size-lg);
    color: var(--primary-color);
}

.instructions-content h2:first-child {
    margin-top: 0;
}

.instructions-content ul {
    padding-left: 24px;
    margin-bottom: 16px;
}

.instructions-content li {
    margin-bottom: 8px;
}

.instructions-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.instructions-content table, 
.instructions-content th, 
.instructions-content td {
    border: 1px solid var(--border-color);
}

.instructions-content th, 
.instructions-content td {
    padding: 12px;
    text-align: left;
}

.instructions-content th {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.agreement-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.agreement-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
}

.agreement-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: relative;
    display: inline-block;
    height: 20px;
    width: 20px;
    margin-right: 10px;
    background-color: var(--light-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.agreement-checkbox:hover input ~ .checkmark {
    background-color: var(--primary-light);
}

.agreement-checkbox input:checked ~ .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.agreement-checkbox input:checked ~ .checkmark:after {
    display: block;
}

.agreement-checkbox .checkmark:after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.agreement-container .primary-btn {
    width: 200px;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .instructions-container {
        padding: 24px;
    }
    
    .instructions-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .candidate-info {
        width: 100%;
    }
    
    .instructions-content {
        padding: 12px;
    }
}

@media screen and (max-width: 576px) {
    .agreement-container {
        width: 100%;
    }
    
    .agreement-container .primary-btn {
        width: 100%;
    }
}
