/* Base styles */
:root {
    --primary-color: #1d4ed8;
    --primary-hover: #1e40af;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --bg-light: #f9fafb;
    --white: #ffffff;
    --focus-color: rgba(37, 99, 235, 0.5);
    --transition-speed: 0.3s;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: 3.5rem;
}

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

header {
    text-align: center;
    margin-bottom: 3rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.subtitle {
    font-size: 1.1rem;
    color: #64748b;
}

.upload-section {
    margin-bottom: 2rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Upload Zone Styles */
.upload-box {
    border: 2px dashed #e5e7eb;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    background-color: var(--bg-secondary);
    transition: all 0.3s ease;
}

.upload-box:hover, .upload-box.drag-over {
    border-color: var(--primary-color);
    background-color: #f8fafc;
}

.upload-box img {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
}

.upload-button {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.upload-button:hover {
    background-color: var(--primary-hover);
}

.file-info {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Results Section Styles */
.results-container {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.result-item {
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.result-item h3 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.result-item p {
    color: var(--text-secondary);
}

.full-width {
    grid-column: 1 / -1;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    .results-container {
        grid-template-columns: 1fr;
    }

    .result-item {
        grid-column: 1;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f9fafb;
        --text-secondary: #9ca3af;
        --bg-primary: #111827;
        --bg-secondary: #1f2937;
    }

    .upload-box {
        border-color: #374151;
    }

    .upload-box:hover, .upload-box.drag-over {
        background-color: #1f2937;
    }

    .spinner {
        border-color: #374151;
        border-top-color: var(--primary-color);
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

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

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

/* Utility Classes */
.hidden {
    display: none !important;
}

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

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

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

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid #e5e7eb;
    color: var(--text-primary);
}

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

/* Card Styles */
.card {
    background-color: var(--bg-secondary);
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

.card-header {
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    color: var(--text-secondary);
}

/* Modern CSS variables for theming */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --primary-bg: #f0f7ff;
    --border-radius: 0.5rem;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease-in-out;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f5f8fa;
    padding-top: 72px;
}

/* Enhanced styles for drop zone */
.upload-container {
    background-color: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.drop-zone {
    border: 2px dashed #ccc;
    border-radius: var(--border-radius);
    padding: 2.5rem;
    text-align: center;
    transition: var(--transition);
    background-color: var(--primary-bg);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.drop-zone:hover {
    border-color: var(--primary-color);
    background-color: #e6f0ff;
}

.drop-zone.highlight {
    border-color: var(--primary-color);
    background-color: #e6f0ff;
    transform: scale(1.02);
}

.drop-zone p {
    margin-top: 1rem;
    color: var(--secondary-color);
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    fill: var(--primary-color);
}

.upload-icon-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

#fileInfo {
    margin-top: 1rem;
    font-weight: 500;
    color: var(--primary-color);
}

/* Loading spinner improvements */
.spinner-container {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 2rem auto;
    padding: 2rem;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    max-width: 400px;
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.1); }
    70% { box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner-text {
    margin-top: 1rem;
    font-weight: 500;
    color: var(--secondary-color);
}

/* Results section improvements */
.results-container {
    background-color: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
    display: none;
}

.results-header {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.result-section {
    margin-bottom: 1.5rem;
}

.result-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.result-value {
    background-color: #f8fafc;
    border: 1px solid #e5e7eb;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #374151;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.result-value:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.priority-urgent {
    color: #b91c1c;
    font-weight: 600;
    background-color: #fee2e2;
    border-color: #fecaca;
    position: relative;
    padding-left: 1.5rem;
}

.priority-urgent::before {
    content: "!";
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
    font-size: 1rem;
}

.priority-routine {
    color: #15803d;
    font-weight: 600;
    background-color: #dcfce7;
    border-color: #bbf7d0;
    position: relative;
    padding-left: 1.5rem;
}

.priority-routine::before {
    content: "✓";
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
    font-size: 0.875rem;
}

/* Findings list styling */
#clinicalFindings ul {
    margin: 0;
    padding-left: 1.2rem;
}

#clinicalFindings li {
    margin-bottom: 0.5rem;
}

/* Notification system */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 15px 25px;
    border-radius: var(--border-radius);
    background-color: #fff;
    color: var(--dark-color);
    box-shadow: var(--box-shadow);
    max-width: 300px;
    z-index: 1000;
    animation: slideIn 0.3s ease-out forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.notification.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

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

.notification.info {
    border-left: 4px solid var(--info-color);
}

.notification.success {
    border-left: 4px solid var(--success-color);
}

.notification.error {
    border-left: 4px solid var(--danger-color);
}

.notification.warning {
    border-left: 4px solid var(--warning-color);
}

.close-notification {
    position: absolute;
    top: 5px;
    right: 10px;
    cursor: pointer;
    font-size: 20px;
    color: var(--secondary-color);
}

/* Fade-in animation for results */
.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

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

/* Responsive design improvements */
@media (max-width: 768px) {
    .upload-container, .results-container {
        padding: 1.5rem;
    }
    
    .drop-zone {
        padding: 1.5rem;
    }
    
    .notification {
        max-width: 90%;
        right: 5%;
        left: 5%;
    }
}

/* Footer styling */
footer {
    margin-top: 2rem;
    padding: 1.5rem 0;
    background-color: #fff;
    border-top: 1px solid #eee;
    text-align: center;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

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

/* Focus states for better accessibility */
button:focus, a:focus, input:focus, .drop-zone:focus {
    outline: 3px solid rgba(13, 110, 253, 0.5);
    outline-offset: 2px;
}

/* Additional responsive styles */
@media (max-width: 640px) {
    body {
        padding-top: 2.5rem;
    }
    
    .results-container {
        padding: 1rem;
    }
    
    .result-section {
        margin-bottom: 0.75rem;
    }
    
    .result-value {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    #clinicalFindings ul {
        padding-left: 1rem;
    }
    
    .notification {
        width: 90%;
        right: 5%;
        left: 5%;
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}

/* Fix some layout issues on small devices */
@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }
    
    .drop-zone {
        padding: 1.25rem 0.75rem;
        min-height: auto;
    }
    
    .upload-icon {
        width: 40px;
        height: 40px;
    }
    
    .mt-6 {
        margin-top: 0.75rem;
    }
    
    button {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* Improve navbar on mobile */
@media (max-width: 767px) {
    nav {
        padding: 0.5rem 0;
    }
    
    #navbar-default {
        margin-top: 0.5rem;
    }
}

/* Ensure the page takes up full height to keep footer at bottom */
html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
    padding-top: 1rem;
}

/* Adding CSS variables for better maintainability */
:root {
    --primary-color: #1d4ed8;
    --primary-hover: #1e40af;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --bg-light: #f9fafb;
    --white: #ffffff;
    --focus-color: rgba(37, 99, 235, 0.5);
    --transition-speed: 0.3s;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Fixes to prevent navbar from blocking content */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: 3.5rem;
    font-family: 'Inter', sans-serif;
}

main {
    flex: 1;
    padding-top: 1rem;
}

@media (max-width: 640px) {
    body {
        padding-top: 2.5rem;
    }
    
    .pt-24 {
        padding-top: 4rem !important;
    }
    
    nav {
        height: auto;
        min-height: 3rem;
    }
    
    .results-container {
        padding: 1rem;
    }
    
    .result-section {
        margin-bottom: 0.75rem;
    }
    
    .result-value {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
}

/* Improved mobile navbar */
nav {
    box-shadow: var(--shadow-sm);
}

nav .text-xl {
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    nav {
        padding: 0;
    }
    
    nav .p-4 {
        padding: 0.5rem 1rem;
    }
    
    .max-w-screen-xl {
        padding: 0 0.75rem;
    }
    
    #navbar-default {
        margin-top: 0.25rem;
        width: 100%;
    }
    
    nav .text-lg, nav .text-xl {
        font-size: 1rem;
    }
}

/* Better responsive container for file upload */
.upload-container {
    margin-top: 0.5rem;
}

.drop-zone {
    transition: all var(--transition-speed) ease;
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }
    
    .drop-zone {
        padding: 1.25rem 0.75rem;
        min-height: auto;
    }
    
    .upload-icon {
        width: 40px;
        height: 40px;
    }
    
    .mt-6 {
        margin-top: 0.75rem;
    }
    
    button {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* Print styles for better printing */
@media print {
    nav, footer, button {
        display: none !important;
    }
    
    body {
        padding: 0;
        background: white;
    }
    
    main {
        width: 100%;
        padding: 0;
        margin: 0;
    }
    
    .results-container {
        box-shadow: none;
        border: none;
        padding: 0;
    }
    
    h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .result-value {
        background-color: white;
        border: 1px solid #ddd;
    }
}

/* Enhanced accessibility */
.visually-hidden:focus {
    outline: none;
}

button:focus, a:focus, input:focus, .drop-zone:focus {
    outline: 2px solid var(--focus-color);
    outline-offset: 2px;
}

/* Performance optimizations */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Fixed footer */
footer {
    width: 100%;
    padding: 0.75rem 0;
    background-color: var(--white);
    border-top: 1px solid var(--border-color);
}

/* Layout adjustments for better reading */
#clinicalFindings ul {
    padding-left: 1.5rem;
    margin-top: 0.5rem;
}

#clinicalFindings li {
    margin-bottom: 0.5rem;
    position: relative;
}

#clinicalFindings li:last-child {
    margin-bottom: 0;
}

/* Support for contrast modes */
@media (prefers-contrast: more) {
    .result-value, .drop-zone, button {
        border-width: 2px;
    }
    
    .priority-urgent, .priority-routine {
        font-weight: 700;
    }
}

/* Print optimizations */
@media print {
    .results-container {
        page-break-inside: avoid;
    }
    
    .result-section {
        margin-bottom: 1.5rem;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    .result-value {
        page-break-inside: avoid;
    }
}

/* Progressive enhancement for slower connections */
@media (prefers-reduced-motion: reduce) {
    .spinner, .fade-in, .notification {
        animation: none !important;
    }
}

/* Enhanced drag and drop experience */
body.dragging:before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(59, 130, 246, 0.1);
    border: 3px dashed rgba(59, 130, 246, 0.5);
    z-index: 100;
    pointer-events: none;
    animation: pulseBorder 1.5s infinite;
}

@keyframes pulseBorder {
    0% { border-color: rgba(59, 130, 246, 0.3); }
    50% { border-color: rgba(59, 130, 246, 0.7); }
    100% { border-color: rgba(59, 130, 246, 0.3); }
}

/* Responsive file info display */
#fileInfo {
    margin-top: 0.75rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
    background-color: rgba(239, 246, 255, 0.7);
    border: 1px solid rgba(191, 219, 254, 0.5);
    transition: all 0.2s ease;
}

#fileInfo:not(:empty) {
    animation: slideDown 0.3s ease-out;
}

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

/* Improve upload container */
.upload-container {
    transition: all 0.3s ease;
}

/* Add fade-out animation */
.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

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

/* Loading state improvements */
.spinner {
    position: relative;
    opacity: 0.85;
}

.spinner:before, .spinner:after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: rgba(59, 130, 246, 0.3);
    width: 140%;
    height: 140%;
    animation: spin 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    top: -20%;
    left: -20%;
}

.spinner:before {
    animation-delay: -0.5s;
}

/* Responsive improvement for small devices */
@media (max-width: 400px) {
    .result-label {
        font-size: 0.9rem;
    }
    
    .spinner-text {
        font-size: 0.85rem;
    }
    
    .notification {
        font-size: 0.85rem;
        padding: 0.75rem 1rem;
    }
}

/* Target high density displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .drop-zone {
        background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' stroke='%232563EB' stroke-width='1.5' stroke-dasharray='6%2c 6' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e");
    }
}

/* Dark mode optimizations */
@media (prefers-color-scheme: dark) {
    .drop-zone {
        background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' stroke='%233b82f6' stroke-width='2' stroke-dasharray='6%2c 6' stroke-dashoffset='0' stroke-linecap='square'/%3e%3c/svg%3e");
    }
    
    body.dragging:before {
        background-color: rgba(30, 64, 175, 0.15);
        border-color: rgba(59, 130, 246, 0.7);
    }
    
    #fileInfo {
        background-color: rgba(30, 58, 138, 0.1);
        border-color: rgba(59, 130, 246, 0.3);
    }
} 