/* Additional custom styles for Patient Authorization Form */

/* Remove heavy global transitions for a cleaner feel */
/* Intentionally avoid universal transitions; use element-specific ones below */

/* Custom focus states for better accessibility */
input:focus, textarea:focus, select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    border-color: #3B82F6;
}

/* Enhanced button hover effects */
button {
    position: relative;
    overflow: hidden;
}

button:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:hover:before {
    width: 300px;
    height: 300px;
}

/* Signature pad styling */
#signature-pad {
    border: 2px dashed #E5E7EB;
    border-radius: 8px;
    cursor: crosshair;
}

#signature-pad:hover {
    border-color: #3B82F6;
    background-color: #FAFBFF;
}

/* Progress bar animation removed (progress UI no longer shown) */

/* Form section animations */
.form-section {
    transform: translateY(10px);
    opacity: 0;
    animation: slideInUp 0.6s ease-out forwards;
}

@keyframes slideInUp {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Stagger animation for form sections */
.form-section:nth-child(1) { animation-delay: 0.1s; }
.form-section:nth-child(2) { animation-delay: 0.2s; }
.form-section:nth-child(3) { animation-delay: 0.3s; }
.form-section:nth-child(4) { animation-delay: 0.4s; }

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

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

/* Notification animation */
.notification-enter {
    transform: translateX(100%);
    opacity: 0;
}

.notification-enter-active {
    transform: translateX(0);
    opacity: 1;
    transition: all 0.3s ease-out;
}

/* Error field highlighting */
.field-error {
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Success message animation */
#success-message {
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
    70% {
        transform: scale(0.9);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive improvements */
@media (max-width: 640px) {
    .form-container {
        margin: 1rem;
        border-radius: 1rem;
    }
    
    .form-section {
        padding: 1.5rem;
    }
    
    .grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .form-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    input, textarea, select {
        border-width: 2px;
        border-color: #000;
    }
    
    button {
        border: 2px solid #000;
    }
}

/* 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;
    }
}

/* Dark mode support (if needed in future) */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles would go here */
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #2563EB;
}

/* Tooltip styles */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1F2937;
    color: white;
    padding: 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
}

/* Form validation states */
.field-valid {
    border-color: #10B981;
    background-color: #F0FDF4;
}

.field-invalid {
    border-color: #EF4444;
    background-color: #FEF2F2;
}

/* Loading states */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #3B82F6;
    border-radius: 50%;
    border-right-color: transparent;
    animation: spin 1s linear infinite;
}

/* Enhanced mobile experience */
@media (max-width: 768px) {
    /* Prevent iOS zoom on form inputs */
    input[type="date"], 
    input[type="tel"], 
    input[type="email"], 
    input[type="text"], 
    input[type="number"], 
    textarea, 
    select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        -webkit-appearance: none;
        appearance: none;
        border-radius: 8px;
    }
    
    /* Mobile-friendly form container */
    .form-container {
        margin: 0.5rem;
        border-radius: 1rem;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }
    
    /* Adjust section padding for mobile */
    .form-section {
        padding: 1rem !important;
    }
    
    /* Stack all form grids on mobile */
    .grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    /* Mobile signature section adjustments */
    .signature-section {
        position: relative;
        background: white;
        border-top: 1px solid #E5E7EB;
    }
    /* Ensure signature square fits small screens */
    .signature-section .aspect-square {
        max-width: 100%;
    }
    
    /* Ensure signature canvas is touch-friendly */
    #signature-pad {
        touch-action: none;
        min-height: 120px;
    }
    
    /* Mobile button adjustments */
    button {
        min-height: 44px; /* iOS touch target minimum */
        touch-action: manipulation;
    }
    
    /* Progress indicator removed */
    
    /* Mobile-friendly header */
    header {
        position: sticky;
        top: 0;
        z-index: 40;
        backdrop-filter: blur(8px);
        background-color: rgba(255, 255, 255, 0.95);
    }
    
    /* Mobile input focus improvements */
    input:focus, 
    textarea:focus, 
    select:focus {
        transform: none; /* Prevent layout shifts */
        border-width: 2px;
    }
    
    /* Mobile toast notifications */
    .notification-mobile {
        position: fixed;
        top: 1rem;
        left: 1rem;
        right: 1rem;
        z-index: 1000;
        border-radius: 0.5rem;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    }
}

/* Accessibility improvements */
.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 indicators for keyboard navigation */
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

/* Custom file input styling */
input[type="file"] {
    opacity: 0;
    position: absolute;
    pointer-events: none;
}

.file-input-label {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: #F9FAFB;
    border: 2px dashed #D1D5DB;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.file-input-label:hover {
    background: #F3F4F6;
    border-color: #3B82F6;
}

/* Progress indicator styles removed */

/* Card hover effects */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}