:root {
    /* Colors */
    --primary-color: HSL(175, 47%, 18%);
    --primary-hover: #0056b3;
    --success-color: hsl(113 100% 40% / .8);
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-gray: #f8f9fa;
    --border-color: #dee2e6;
    --text-color: #212529;
    --text-muted: #6c757d;
    --aspit-red: hsl(5, 100%, 64%);

    --hue: 175; /* Aspit default: 175 */
    --saturation-value: 47; /* Aspit default: 47 */

    /* Color calculations */
    --saturation: calc(var(--saturation-value) * 1%);
    --aspit-night-green: hsl(var(--hue), var(--saturation), 12%);
    --aspit-darkest-green: hsl(var(--hue), var(--saturation), 15%);

    /* Additional colors */
    --aspit-red: hsl(5, 100%, 64%);
    --aspit-white: hsl(0, 0%, 100%);

    /* Spacing between content */
    --gutter: 1;
    --gutter-small: calc(var(--gutter) * 1rem);
    --gutter-large: calc(var(--gutter) * 2rem);

    --line-height: 1.5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-gray);
    padding-top: 3rem;
}

.page-header {
  height: 3rem;
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  right: 0;
  bottom: auto;
  background-color: var(--aspit-night-green);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
  color: var(--aspit-white);
  padding: 0 var(--gutter-small);
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.header {
    background: var(--primary-color);
    color: white;
    padding: 2rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.site-title {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
  font-weight: bold;
}

.site-title:last-of-type {
  text-align: right;
}
.site-title:last-of-type > time:first-child {
  display: none;
}

.site-title time::first-letter {
  text-transform: capitalize;
}

.site-logo {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem;
  background-color: var(--aspit-night-green);
  transition: width 0.3s, height 0.3s;
}

.white-fill {
  fill: var(--aspit-white);
}

.red-fill {
  fill: var(--aspit-red);
}

.site-logo .aspit-dot {
  animation: bounce 0.5s ease-out alternate infinite;
}

@keyframes bounce {
  to {
    transform: translateY(-7%);
  }
}

.site-logo svg {
  width: 100%;
  height: 100%;
}


/* Main Content */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

/* Filter Section */
.filter-section {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.filter-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.filter-group select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

/* Test List */
.test-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.test-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: grid;
    grid-template-rows: auto 1fr auto auto;
}

.test-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.test-card h3 {
    font-size: 1.4rem;
    color: var(--text-color);
    flex: 1;
}

.test-description {
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.test-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem 1rem;
    margin: 1rem 0;
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-muted);
}

.btn-start {
    width: 100%;
    padding: 0.75rem;
    background: var(--aspit-red);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.2s;
}

/* Test View */
.test-header {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.test-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.btn-back {
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-reset {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.test-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.test-progress {
    display: flex;
    gap: 2rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.timer {
    font-weight: 600;
    color: var(--primary-color);
}

.timer.warning {
    color: var(--warning-color);
}

.timer.danger {
    color: var(--danger-color);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* User Name Section */
.user-name-section {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-name-section label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

#user-name-input {
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    flex: 1;
    max-width: 500px;
    width: 250px;
}

#user-name-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

#user-name-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Print-specific styles for name */
@media print {
    .user-name-section {
        display: none;
    }
}

/* Responsive - navn felt */
@media (max-width: 768px) {
    .user-name-section {
        flex-direction: column;
        align-items: flex-start;
    }
    
    #user-name-input {
        max-width: 100%;
        width: 100%;
    }
}


/* Question Container */
.question-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.question-text {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.options-list {
    list-style: none;
}

.option-item {
    margin-bottom: 1rem;
}

.option-label {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.option-label input[type="radio"] {
    margin-right: 1rem;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.option-label.selected {
    border-color: var(--primary-color);
    background: rgba(0, 123, 255, 0.1);
}

.option-label.correct {
    border-color: var(--success-color);
    background: rgba(40, 167, 69, 0.1);
}

.option-label.incorrect {
    border-color: var(--danger-color);
    background: rgba(220, 53, 69, 0.1);
}

.explanation {
    margin-top: 1rem;
}

.explanation-title {
    font-weight: 600;
}

/* Navigation Buttons */
.navigation-buttons {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.btn-nav, .btn-submit, .btn-primary, .btn-secondary, .btn-print {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-nav {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-submit, .btn-primary {
    background: hsl(113 100% 40% / .8);
    color: white;
}

.btn-print {
    background-color: #333;
    color: #fff;
}

.btn-secondary {
    background: var(--aspit-red);
    color: white;
}

/* Result View */
.result-container {
    background: white;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.result-header {
    padding: 2rem;
    background-color: var(--light-gray);
    border-radius: 1rem;
}
 .result-header h2 {
    font-size: 2rem;
 }
.result-score {
    font-size: 3.5rem;
    font-weight: 700;
    margin: 1rem 0;
}

.result-score.passed {
    color: var(--success-color);
}

.result-score.failed {
    color: var(--danger-color);
}

.result-message {
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.result-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
    text-align: left;
}

.result-detail {
    padding: 1rem;
    background: #eee;
    border-radius: 8px;
}

.result-detail-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.result-detail-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.result-actions {
    margin: 2rem 0 0 0;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.question-review {
    text-align: left;
    margin-top: 2rem;
    padding-top: 2rem;
}

.question-review h3 {
    margin-bottom: 1rem;
    font-size: 1.6rem;
}

.review-item {
    padding: 2rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    background: var(--light-gray);
}

.review-item.correct {
        background-color: hsl(120 100% 95% / 1);
}

.review-item.incorrect {
    background-color: hsl(0 100% 95%);;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.modal h2 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.resume-info {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--light-gray);
    border-radius: 4px;
}

.resume-info p {
    margin: 0.5rem 0;
    color: var(--text-muted);
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.modal-buttons button {
    flex: 1;
}

/* Footer */
.footer {
    background: white;
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

.footer a {
    color: inherit;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .header, .footer, .no-print, .page-header {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .result-container {
        box-shadow: none;
        padding: 1rem;
    }

    .result-header {
    padding: 2rem;
    background-color: #eee;
    color: #333;
    -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
}
    
    .result-score {
        font-size: 2rem;
    }
    
    .review-item {
        page-break-inside: avoid;
        break-inside: avoid;
        margin-bottom: 1rem;
    }
    
    .question-review {
        page-break-before: auto;
    }
    
    .result-details {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .filter-section {
        flex-direction: column;
    }
    
    .test-list {
        grid-template-columns: 1fr;
    }
    
    .test-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .test-header-top {
        flex-direction: column;
        align-items: stretch;
    }
    
    .navigation-buttons {
        flex-direction: column;
    }
    
    .result-details {
        grid-template-columns: 1fr;
    }
    
    .modal {
        width: 95%;
        padding: 1.5rem;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
}