/* 
 * Eagle Rock Neuropathy and Pain - Main Stylesheet
 * A clean, modern stylesheet for Eagle Rock Neuropathy and Pain website
 * This file contains non-critical CSS to be loaded after initial page rendering
 */

/* Base Styles
-------------------------------------------------- */
html {
    scroll-behavior: smooth;
}

body {
    color: #1E293B; /* secondary-800 */
    line-height: 1.6;
}

a:focus {
    outline: 2px solid #2563EB; /* primary-600 */
    outline-offset: 2px;
}

img {
    max-width: 100%;
    height: auto;
}

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

/* Focus visible polyfill */
.js-focus-visible :focus:not(.focus-visible) {
    outline: none;
}

/* Form Elements
-------------------------------------------------- */
input, select, textarea, button {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3); /* primary-600 with opacity */
}

::placeholder {
    color: #94A3B8; /* secondary-400 */
}

/* Form validation styles */
.form-error {
    border-color: #EF4444 !important; /* red-500 */
    background-color: #FEF2F2 !important; /* red-50 */
}

.error-message {
    color: #DC2626; /* red-600 */
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-success {
    border-color: #10B981 !important; /* green-500 */
    background-color: #ECFDF5 !important; /* green-50 */
}

/* Custom focus styles for form elements with validation */
.form-error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3); /* red-500 with opacity */
}

.form-success:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3); /* green-500 with opacity */
}

/* Status messages */
.status-message {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.status-success {
    background-color: #ECFDF5; /* green-50 */
    color: #065F46; /* green-800 */
    border: 1px solid #A7F3D0; /* green-200 */
}

.status-error {
    background-color: #FEF2F2; /* red-50 */
    color: #991B1B; /* red-800 */
    border: 1px solid #FCA5A5; /* red-200 */
}

.status-info {
    background-color: #EFF6FF; /* blue-50 */
    color: #1E40AF; /* blue-800 */
    border: 1px solid #BFDBFE; /* blue-200 */
}

/* Animations and Transitions
-------------------------------------------------- */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-up {
    animation: slideUp 0.7s ease-out;
}

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

.slide-in-left {
    animation: slideInLeft 0.7s ease-out;
}

@keyframes slideInLeft {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.slide-in-right {
    animation: slideInRight 0.7s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Content animations - these will be applied with JavaScript */
.animate-on-scroll {
    opacity: 0;
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

.animate-on-scroll.from-bottom {
    transform: translateY(20px);
}

.animate-on-scroll.from-left {
    transform: translateX(-20px);
}

.animate-on-scroll.from-right {
    transform: translateX(20px);
}

/* Link Styles
-------------------------------------------------- */
.link-underline {
    position: relative;
}

.link-underline:after {
    content: '';
    position: absolute;
    width: 100%;
    transform: scaleX(0);
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: #2563EB; /* primary-600 */
    transform-origin: bottom right;
    transition: transform 0.3s ease-out;
}

.link-underline:hover:after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

/* Button Enhancements
-------------------------------------------------- */
.btn {
    transition: all 0.2s ease-in-out;
}

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

.btn:active {
    transform: translateY(1px);
}

/* Print Styles
-------------------------------------------------- */
@media print {
    header, footer, nav, .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }
    
    a {
        color: #000;
        text-decoration: underline;
    }
    
    a:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
    }
    
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        page-break-inside: avoid;
    }
    
    img {
        page-break-inside: avoid;
        max-width: 100% !important;
    }
    
    p, h2, h3 {
        orphans: 3;
        widows: 3;
    }
    
    @page {
        margin: 2cm;
    }
}

/* Responsive adjustments beyond Tailwind defaults
-------------------------------------------------- */
@media (max-width: 640px) {
    h1 {
        font-size: 1.875rem !important; /* Override for smallest screens */
    }
    
    h2 {
        font-size: 1.5rem !important; /* Appropriate heading size for mobile */
    }
    
    .xs-full-width {
        width: 100% !important;
    }
    
    .xs-center {
        text-align: center !important;
    }
    
    /* Improve button tap targets on mobile */
    button, 
    .btn, 
    a.btn, 
    input[type="submit"] {
        min-height: 44px !important;
        min-width: 44px !important;
        padding: 10px 20px !important;
    }
    
    /* Increase form input touch targets */
    input, 
    select, 
    textarea {
        min-height: 44px !important;
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }
    
    /* Improve spacing for stacked elements */
    .stack-mobile > * {
        margin-bottom: 1rem !important;
    }
}

/* Custom responsive table styles */
.responsive-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .responsive-table table {
        min-width: 45rem;
    }
    
    /* Improved spacing for mobile tables */
    td, th {
        padding: 0.75rem !important;
    }
}

/* Utility Classes
-------------------------------------------------- */
.prose p:not(:last-child) {
    margin-bottom: 1.25em;
}

.prose ul, .prose ol {
    padding-left: 1.25rem;
}

.prose ul {
    list-style-type: disc;
}

.prose ol {
    list-style-type: decimal;
}

.prose a {
    color: #2563EB; /* primary-600 */
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s ease-in-out;
}

.prose a:hover {
    color: #1D4ED8; /* primary-700 */
}

.max-h-75vh {
    max-height: 75vh;
}

.max-h-50vh {
    max-height: 50vh;
}

/* Skip to content link - accessibility enhancement */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #2563EB; /* primary-600 */
    color: white;
    padding: 8px;
    z-index: 100;
    transition: top 0.3s ease;
}

.skip-to-content:focus {
    top: 0;
}
