/* Standardized typography */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, 'Open Sans', sans-serif;
    margin: 0;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    line-height: 1.5;
    min-height: 100vh;
    box-sizing: border-box;
    font-size: 16px; /* Base font size */
}

* {
    box-sizing: border-box;
}

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

header img {
    display: block;
    margin: 0 auto 15px auto;
    max-width: 250px;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.question-container {
    display: none;
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
    overflow: hidden;
    animation: fadeIn 0.3s ease-in;
}

.question-container.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.question-container .question-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 15px 25px;
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #0056b3;
}

.question-container .question-header p {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.question-container .question-header img {
    height: 32px;
    width: auto;
    filter: brightness(0) invert(1);
}

section {
    border: none;
    border-radius: 0;
    background: white;
    padding: 15px 20px;
    width: 100%;
    max-width: none;
    margin: 0;
}

section > p {
    font-size: 1rem; /* Standardized font size */
    color: #495057; /* Consistent black text */
    margin-bottom: 12px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 6px;
    border-left: 3px solid #007bff;
}

section > p:last-of-type {
    font-size: 1rem; /* Consistent font size with other text */
    color: #495057; /* Black text instead of gray */
    font-style: normal; /* Remove italics */
    background: #fff3cd;
    border-left: 3px solid #ffc107;
}

.user-info {
    max-width: 450px;
    margin: 0 auto;
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.1);
}

.user-info h2 {
    color: #007bff;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.6em;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px;
}

.user-info label {
    display: block;
    margin-top: 15px;
    margin-bottom: 6px;
    font-weight: 600;
    color: #495057;
    font-size: 0.95em;
}

.user-info label:first-child {
    margin-top: 0;
}

.user-info input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #dee2e6;
    border-radius: 5px;
    font-size: 15px;
    transition: all 0.2s;
    background-color: #f8f9fa;
}

.user-info input:focus {
    outline: none;
    border-color: #007bff;
    background-color: white;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.question {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    border: 1px solid #dee2e6;
}

.question-row {
    background: white;
    margin-bottom: 8px;
    padding: 10px 15px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    transition: all 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.question-row:hover {
    background: #e9ecef;
    border-color: #007bff;
    transform: translateX(3px);
}

.question-row:last-child {
    margin-bottom: 0;
}

.question-row input[type="checkbox"],
.question-row input[type="radio"] {
    margin-right: 10px;
    margin-top: 0;
    margin-bottom: 0;
    transform: scale(1.1);
    accent-color: #007bff;
    flex-shrink: 0;
}

.question-row label {
    cursor: pointer;
    font-size: 1rem; /* Standardized font size */
    color: #495057;
    display: flex;
    align-items: center;
    width: 100%;
    margin: 0;
    line-height: 1.4;
}

.question-row input:checked + label {
    color: #007bff;
    font-weight: 600;
}

.continue {
    margin: 0;
    width: 100%;
    padding: 20px 25px;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #dee2e6;
}

button, #start-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    color: white;
    padding: 12px 25px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 3px 5px rgba(0,0,0,0.1);
    text-transform: none;
    letter-spacing: 0.3px;
    order: 2;
}

button:hover, #start-btn:hover {
    background: linear-gradient(135deg, #20c997 0%, #17a2b8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

button:active, #start-btn:active {
    transform: translateY(0);
}

.time-container {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
    color: white;
    padding: 12px 18px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 15px;
    margin-left: 0;
    margin-right: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: none;
    order: 1;
}

/* Question-specific styles */
ul {
    background: white;
    border-radius: 5px;
    padding: 15px 20px;
    border: 1px solid #dee2e6;
    list-style: none;
    margin: 15px 0;
}

ul li {
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f4;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, 'Open Sans', sans-serif; /* Match page font */
    color: #495057;
    font-size: 1rem; /* Match standard font size used throughout page */
    font-weight: normal; /* Ensure consistent weight */
}

ul li:last-child {
    border-bottom: none;
}

.toprow {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    font-weight: 600;
    padding: 10px 8px;
    border-radius: 5px 5px 0 0;
    margin-bottom: 2px;
}

.toprow .ingredient,
.toprow .usedate,
.toprow .customer,
.toprow .score {
    display: inline-block;
    padding: 4px;
    font-size: 0.85em;
    text-align: center;
}
.toprow .ingredient {
    width: 150px;
    margin-left: 0;
}

.toprow .usedate {
    width: 110px;
}

.toprow .customer {
    width: 150px;
    margin-left: 0;
}

.toprow .score {
    width: 110px;
}

.question-row .ingredient,
.customer-row .ingredient {
    display: inline-block;
    width: 150px;
    border: 1px solid #dee2e6;
    padding: 8px 10px;
    background: white;
    border-radius: 3px;
    margin-right: 4px;
    margin-bottom: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    transition: all 0.2s;
}

.question-row .ingredient:hover,
.customer-row .ingredient:hover {
    border-color: #007bff;
    background: #f8f9fa;
}

.question-row .usedate,
.customer-row .score {
    display: inline-block;
    width: 110px;
    border: 1px solid #dee2e6;
    padding: 8px 10px;
    background: white;
    border-radius: 3px;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    transition: all 0.2s;
}

.question-row .usedate:hover,
.customer-row .score:hover {
    border-color: #007bff;
    background: #f8f9fa;
}

#q6 input {
    width: 50px;
    padding: 6px 8px;
    border: 2px solid #dee2e6;
    border-radius: 3px;
    text-align: center;
    font-size: 14px;
    background: #f8f9fa;
    transition: all 0.2s;
}

#q6 input:focus {
    outline: none;
    border-color: #007bff;
    background: white;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

/* Visual Pattern Styling for Question 8 */
#q8 .pattern-container {
    background: white;
    border: 2px solid #007bff;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
    text-align: center;
    font-family: 'Courier New', monospace;
    line-height: 1.2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Responsive design improvements */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .question-container .question-header {
        padding: 12px 20px;
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    section {
        padding: 15px 20px;
    }
    
    .continue {
        flex-direction: column-reverse;
        gap: 12px;
        padding: 15px 20px;
    }
    
    .time-container {
        margin-right: 0;
        text-align: center;
        order: 1;
    }
    
    button {
        order: 2;
    }
    
    .question-row .ingredient,
    .question-row .usedate,
    .customer-row .ingredient,
    .customer-row .score {
        width: 100%;
        margin-right: 0;
        margin-bottom: 8px;
    }
}

/* Dropdown Styles */
.dropdown-container {
    max-width: 300px;
    margin: 20px auto;
    text-align: center;
}

.dropdown-container label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 1.1rem; /* Larger font size for dropdown labels */
}

.dropdown-container select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 1.1rem; /* Larger font size for dropdown options */
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropdown-container select:hover {
    border-color: #007bff;
}

.dropdown-container select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Table Styles */
.ingredients-table table,
.rating-table {
    width: 100%;
    margin: 20px auto;
    border-collapse: collapse;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.ingredients-table th,
.ingredients-table td,
.rating-table th,
.rating-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    font-size: 1.1rem; /* Larger font size for better readability */
}

.ingredients-table th,
.rating-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    font-size: 1.1rem; /* Larger font size for headers */
}

.ingredients-table tr:hover,
.rating-table tr:hover {
    background: #f8f9ff;
}

.ingredients-table input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.ingredients-table label {
    margin: 0;
    cursor: pointer;
    display: block;
    width: 100%;
}

/* Lines Display for Question 8 */
.lines-display {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 20px auto;
    max-width: 500px;
    font-family: 'Courier New', monospace;
    text-align: center;
}

.line-row {
    font-size: 24px;
    line-height: 1.8;
    margin: 12px 0;
    color: #007bff;
    font-weight: bold;
    letter-spacing: 2px;
}

/* Drag and Drop Styles for Question 6 */
.drag-instructions {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 15px 0;
    font-size: 14px;
}

.drag-instructions p {
    margin: 0;
    color: #1565c0;
}

.sortable-container {
    max-width: 600px;
    margin: 20px auto;
    padding: 15px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    min-height: 400px;
    counter-reset: item-counter;
}

.sortable-item {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 8px 0;
    cursor: grab;
    transition: all 0.3s ease;
    user-select: none;
    position: relative;
    touch-action: none; /* Prevent default touch scrolling */
}

.sortable-item:hover {
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
    transform: translateY(-2px);
    background: #f8f9ff;
}

.sortable-item:active {
    cursor: grabbing;
}

.sortable-item.dragging {
    opacity: 0.8;
    transform: rotate(3deg) scale(1.05);
    z-index: 1000;
    box-shadow: 0 12px 24px rgba(0,0,0,0.3);
    border-color: #007bff;
    background: linear-gradient(135deg, #e3f2fd 0%, #f8f9ff 100%);
}

.sortable-item.drag-over {
    border-color: #28a745;
    background: linear-gradient(135deg, #f8fff9 0%, #e8f5e8 100%);
    transform: scale(1.03);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

.drag-handle {
    color: #6c757d;
    font-size: 18px;
    margin-right: 12px;
    cursor: grab;
    user-select: none;
    padding: 6px;
    min-width: 24px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.drag-handle:hover {
    color: #007bff;
    background: #f8f9ff;
    transform: scale(1.1);
}

.yarn-code {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, 'Open Sans', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: #212529;
    letter-spacing: 0.5px;
    flex: 1;
}

.sortable-item::before {
    content: counter(item-counter);
    counter-increment: item-counter;
    position: absolute;
    left: -25px;
    top: 50%;
    transform: translateY(-50%);
    background: #007bff;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

/* Responsive adjustments for above-the-fold experience */
@media (max-width: 768px) {
    body {
        padding: 8px;
    }
    
    .question-container {
        margin: 10px 0;
    }
    
    .question-container .question-header {
        padding: 12px 15px;
    }
    
    .question-container .question-header p {
        margin: 8px 0;
        font-size: 16px;
    }
    
    .question-container .question-header img {
        max-height: 40px;
    }
    
    .question-container section {
        padding: 15px 20px;
    }
    
    .question-container section p {
        margin: 8px 0;
        font-size: 15px;
    }
    
    .question-container section ul {
        margin: 10px 0;
        padding-left: 20px;
    }
    
    .question-container section ul li {
        margin: 3px 0;
        font-size: 14px;
        font-family: 'Courier New', monospace;
    }
    
    .continue {
        flex-direction: column-reverse;
        gap: 12px;
        padding: 15px 20px;
    }
    
    .time-container {
        margin-right: 0;
        text-align: center;
        order: 1;
        font-size: 14px;
    }
    
    button {
        order: 2;
        padding: 10px 20px;
        font-size: 16px;
    }
    
    /* Compact table styles */
    .ingredients-table th,
    .ingredients-table td,
    .rating-table th,
    .rating-table td {
        padding: 6px 8px;
        font-size: 14px;
    }
    
    /* Compact dropdown */
    .dropdown-container {
        margin: 15px auto;
    }
    
    .dropdown-container select {
        padding: 8px 10px;
        font-size: 15px;
    }
    
    /* Compact lines display */
    .lines-display {
        padding: 15px;
        margin: 15px auto;
    }
    
    .line-row {
        font-size: 20px;
        margin: 8px 0;
    }
    
    /* Compact sortable container */
    .sortable-container {
        margin: 15px 10px;
        padding: 10px;
        max-width: none;
        min-height: 300px;
    }
    
    .sortable-item {
        padding: 10px 12px;
        margin: 6px 0;
    }
    
    .sortable-item::before {
        left: -20px;
        width: 18px;
        height: 18px;
        font-size: 11px;
    }
    
    .yarn-code {
        font-size: 14px;
        letter-spacing: 0.3px;
    }
    
    .drag-handle {
        font-size: 14px;
        margin-right: 8px;
    }
    
    .drag-instructions {
        margin: 10px 0;
        padding: 10px 12px;
        font-size: 13px;
    }
}