/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Accessibility improvements */
*:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Skip link for screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.focus\:not-sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bg-blue-600 {
        background-color: #000080;
    }
    
    .text-gray-600 {
        color: #000000;
    }
    
    .border-gray-300 {
        border-color: #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Layout Classes */
.min-h-screen {
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-1 {
    flex: 1;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

/* Background Colors */
.bg-gradient-to-br {
    background: linear-gradient(135deg, #eff6ff 0%, #e0e7ff 100%);
}

.bg-white {
    background-color: #ffffff;
}

.bg-blue-50 {
    background-color: #eff6ff;
}

.bg-blue-100 {
    background-color: #dbeafe;
}

.bg-blue-500 {
    background-color: #3b82f6;
}

.bg-blue-600 {
    background-color: #2563eb;
}

.bg-blue-700 {
    background-color: #1d4ed8;
}

.bg-green-500 {
    background-color: #10b981;
}

.bg-green-100 {
    background-color: #dcfce7;
}

.bg-purple-500 {
    background-color: #8b5cf6;
}

.bg-orange-500 {
    background-color: #f97316;
}

.bg-red-500 {
    background-color: #ef4444;
}

.bg-pink-500 {
    background-color: #ec4899;
}

.bg-indigo-500 {
    background-color: #6366f1;
}

.bg-teal-500 {
    background-color: #14b8a6;
}

.bg-cyan-500 {
    background-color: #06b6d4;
}

.bg-yellow-500 {
    background-color: #eab308;
}

.bg-yellow-600 {
    background-color: #ca8a04;
}

.bg-gray-100 {
    background-color: #f3f4f6;
}

.bg-gray-200 {
    background-color: #e5e7eb;
}

.bg-gray-500 {
    background-color: #6b7280;
}

.bg-gray-700 {
    background-color: #374151;
}

.bg-red-50 {
    background-color: #fef2f2;
}

.bg-gray-50 {
    background-color: #f9fafb;
}

/* Text Colors */
.text-white {
    color: #ffffff;
}

.text-gray-500 {
    color: #6b7280;
}

.text-gray-600 {
    color: #4b5563;
}

.text-gray-700 {
    color: #374151;
}

.text-gray-900 {
    color: #111827;
}

.text-blue-600 {
    color: #2563eb;
}

.text-blue-700 {
    color: #1d4ed8;
}

.text-blue-800 {
    color: #1e40af;
}

.text-red-500 {
    color: #ef4444;
}

.text-red-600 {
    color: #dc2626;
}

.text-red-700 {
    color: #b91c1c;
}

.text-orange-600 {
    color: #ea580c;
}

.text-green-600 {
    color: #059669;
}

/* Typography */
.text-xs {
    font-size: 0.75rem;
    line-height: 1rem;
}

.text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.text-xl {
    font-size: 1.25rem;
    line-height: 1.75rem;
}

.text-2xl {
    font-size: 1.5rem;
    line-height: 2rem;
}

.text-3xl {
    font-size: 1.875rem;
    line-height: 2.25rem;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* Spacing - Padding */
.p-3 {
    padding: 0.75rem;
}

.p-4 {
    padding: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

.p-8 {
    padding: 2rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.px-6 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.px-3 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.py-6 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.py-8 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.p-2 {
    padding: 0.5rem;
}

/* Spacing - Margin */
.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.mt-auto {
    margin-top: auto;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

/* Sizing */
.w-5 {
    width: 1.25rem;
}

.w-6 {
    width: 1.5rem;
}

.w-8 {
    width: 2rem;
}

.w-12 {
    width: 3rem;
}

.w-16 {
    width: 4rem;
}

.w-20 {
    width: 5rem;
}

.w-auto {
    width: auto;
}

.w-full {
    width: 100%;
}

.h-5 {
    height: 1.25rem;
}

.h-6 {
    height: 1.5rem;
}

.h-8 {
    height: 2rem;
}

.h-12 {
    height: 3rem;
}

.h-16 {
    height: 4rem;
}

.h-20 {
    height: 5rem;
}

.h-2 {
    height: 0.5rem;
}

.h-auto {
    height: auto;
}

.max-w-md {
    max-width: 28rem;
}

.max-w-2xl {
    max-width: 42rem;
}

.max-h-96 {
    max-height: 24rem;
}

.min-w-0 {
    min-width: 0;
}

.z-50 {
    z-index: 50;
}

/* Borders and Shadows */
.border {
    border: 1px solid #d1d5db;
}

.border-2 {
    border: 2px solid #d1d5db;
}

.border-b {
    border-bottom: 1px solid #e5e7eb;
}

.border-t {
    border-top: 1px solid #e5e7eb;
}

.border-gray-200 {
    border-color: #e5e7eb;
}

.border-gray-300 {
    border-color: #d1d5db;
}

.border-blue-200 {
    border-color: #bfdbfe;
}

.border-red-200 {
    border-color: #fecaca;
}

.border-red-500 {
    border-color: #ef4444;
}

.rounded-lg {
    border-radius: 0.5rem;
}

.rounded-xl {
    border-radius: 0.75rem;
}

.rounded-full {
    border-radius: 9999px;
}

.rounded-md {
    border-radius: 0.375rem;
}

.shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.shadow-md {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Form Elements */
input, select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Enhanced focus styles for accessibility */
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

button {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

button:hover {
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Button Variants */
.btn-primary {
    background-color: #2563eb;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #1d4ed8;
}

.btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #e5e7eb;
}

/* Spacing Utilities */
.space-x-2 > * + * {
    margin-left: 0.5rem;
}

.space-x-4 > * + * {
    margin-left: 1rem;
}

.space-x-6 > * + * {
    margin-left: 1.5rem;
}

.space-y-4 > * + * {
    margin-top: 1rem;
}

.space-y-6 > * + * {
    margin-top: 1.5rem;
}

.space-y-8 > * + * {
    margin-top: 2rem;
}

.space-y-3 > * + * {
    margin-top: 0.75rem;
}

/* Display Utilities */
.block {
    display: block;
}

.inline-flex {
    display: inline-flex;
}

.overflow-y-auto {
    overflow-y: auto;
}

.flex-shrink-0 {
    flex-shrink: 0;
}

.absolute {
    position: absolute;
}

.relative {
    position: relative;
}

.static {
    position: static;
}

.top-4 {
    top: 1rem;
}

.left-4 {
    left: 1rem;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 0.5rem;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.progress-fill {
    height: 100%;
    background-color: #2563eb;
    transition: width 0.5s ease;
}

/* Role Selection */
.role-option {
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: block;
    margin-bottom: 1rem;
}

.role-option:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.role-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.role-option input[type="radio"]:checked + div {
    border-color: #2563eb;
    background-color: #eff6ff;
}

.radio-indicator {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    position: relative;
}

.role-option input[type="radio"]:checked + div .radio-indicator {
    border-color: #2563eb;
    background-color: #2563eb;
}

.role-option input[type="radio"]:checked + div .radio-indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0.5rem;
    height: 0.5rem;
    background-color: white;
    border-radius: 50%;
}

/* Focus within for role options */
.focus-within\:ring-2:focus-within {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.5);
}

.focus-within\:ring-blue-500:focus-within {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.5);
}

/* Header and Footer */
header {
    background-color: white;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

footer {
    background-color: white;
    border-top: 1px solid #e5e7eb;
    margin-top: auto;
}

/* Logo */
header img {
    max-height: 3rem;
    height: auto;
    width: auto;
}

/* Alert/Error Messages */
.alert {
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.alert-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.alert-success {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.alert-info {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Character Counter */
.character-counter {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    text-align: right;
    transition: color 0.2s ease;
}

/* Responsive Design */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    header img {
        max-height: 2.5rem;
    }
    
    .text-3xl {
        font-size: 1.5rem;
        line-height: 2rem;
    }
    
    .p-8 {
        padding: 1.5rem;
    }
    
    .role-option {
        padding: 1rem;
    }
    
    .space-y-4 > * + * {
        margin-top: 0.75rem;
    }
}

/* Focus States */
.focus\:ring-2:focus {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.5);
}

.focus\:ring-blue-500:focus {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.5);
}

.focus\:ring-gray-500:focus {
    box-shadow: 0 0 0 2px rgba(107, 114, 128, 0.5);
}

.focus\:ring-offset-2:focus {
    box-shadow: 0 0 0 2px white, 0 0 0 4px rgba(37, 99, 235, 0.5);
}

.focus\:border-transparent:focus {
    border-color: transparent;
}

/* Transition Classes */
.transition-colors {
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.transition-all {
    transition: all 0.15s ease;
}

.duration-500 {
    transition-duration: 500ms;
}

.ease-out {
    transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
}

/* Hover States */
.hover\:bg-blue-700:hover {
    background-color: #1d4ed8;
}

.hover\:bg-gray-200:hover {
    background-color: #e5e7eb;
}

.hover\:shadow-md:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Disabled States */
.disabled\:opacity-50:disabled {
    opacity: 0.5;
}

.disabled\:cursor-not-allowed:disabled {
    cursor: not-allowed;
}

/* Grid Layout for Role Cards */
@media (min-width: 768px) {
    .role-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .role-option {
        margin-bottom: 0;
    }
}

/* Enhanced Role Selection Visual */
.role-option .role-icon {
    flex-shrink: 0;
}

.role-option .role-content {
    flex-grow: 1;
    min-width: 0;
}

.role-option .role-title {
    font-weight: 500;
    color: #111827;
    margin-bottom: 0.25rem;
}

.role-option .role-description {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.4;
}

/* Improved form validation styles */
.form-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.error-message {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Better textarea styling */
textarea {
    resize: vertical;
    min-height: 120px;
}

.resize-none {
    resize: none;
}

/* Enhanced button states */
button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

button:active {
    transform: translateY(0);
}

/* Loading state for buttons */
.btn-loading {
    position: relative;
    color: transparent;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    top: 50%;
    left: 50%;
    margin-left: -0.5rem;
    margin-top: -0.5rem;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Additional spacing utilities */
.pr-2 {
    padding-right: 0.5rem;
}

.pt-4 {
    padding-top: 1rem;
}

.leading-relaxed {
    line-height: 1.625;
}

.leading-tight {
    line-height: 1.25;
}

/* Culture Assessment Rating Styles */
.rating-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.rating-scale {
    display: flex;
    gap: 1rem;
    flex: 1;
    justify-content: center;
}

.rating-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rating-circle {
    width: 2rem;
    height: 2rem;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #6b7280;
}

.rating-option:hover .rating-circle {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

.rating-option input[type="radio"]:checked + .rating-circle {
    background-color: #2563eb;
    border-color: #2563eb;
    color: white;
}

.rating-label {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
    margin: 0 0.5rem;
}

/* Print styles for accessibility */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .bg-blue-600, .bg-blue-700 {
        background-color: #000080 !important;
        color: white !important;
    }
}