/* Enhanced Accessibility and Styling for IMD Student Showcase */

/* ==========================================================================
   ACCESSIBILITY IMPROVEMENTS
   ========================================================================== */

/* Screen Reader Only Content */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.sr-only:focus,
.focus\:not-sr-only:focus {
  position: static !important;
  width: auto !important;
  height: auto !important;
  padding: 0.5rem 1rem !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
  border: 2px solid #F3992B !important;
  border-radius: 0.375rem !important;
  background-color: white !important;
  color: #014438 !important;
  font-weight: 600 !important;
  z-index: 9999 !important;
}

/* Skip to Main Content Link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #014438;
  color: white;
  padding: 8px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: bold;
  z-index: 10000;
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 6px;
}

/* ==========================================================================
   FOCUS MANAGEMENT
   ========================================================================== */

/* Enhanced Focus Indicators */
button:focus,
input:focus,
textarea:focus,
select:focus,
a:focus,
[role="button"]:focus {
  outline: 3px solid #F3992B !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 2px white, 0 0 0 5px #F3992B !important;
}

/* Focus within for containers */
.focus-within\:ring:focus-within {
  box-shadow: 0 0 0 3px rgba(243, 153, 43, 0.3);
}

/* Checkbox and Radio Focus */
input[type="checkbox"]:focus,
input[type="radio"]:focus {
  outline: 2px solid #F3992B;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(243, 153, 43, 0.2);
}

/* ==========================================================================
   HIGH CONTRAST MODE SUPPORT
   ========================================================================== */

@media (prefers-contrast: high) {
  .bg-primary-green { background-color: #000000 !important; }
  .bg-primary-orange { background-color: #FF6600 !important; }
  .text-primary-green { color: #000000 !important; }
  .text-primary-orange { color: #FF6600 !important; }
  .border-primary-green { border-color: #000000 !important; }
  .border-primary-orange { border-color: #FF6600 !important; }
  
  /* Ensure sufficient contrast for text */
  .text-text-light { color: #333333 !important; }
  .bg-gray-50 { background-color: #FFFFFF !important; }
}

/* ==========================================================================
   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;
    scroll-behavior: auto !important;
  }
  
  /* Disable spinning animation for reduced motion users */
  .animate-spin {
    animation: none !important;
  }
}

/* ==========================================================================
   MODAL ACCESSIBILITY
   ========================================================================== */

/* Modal Backdrop */
.modal-backdrop {
  backdrop-filter: blur(2px);
}

/* Modal Focus Trap */
.modal-open {
  overflow: hidden;
}

/* Modal Content */
.modal-content {
  max-height: 90vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #F3992B #E5E7EB;
}

.modal-content::-webkit-scrollbar {
  width: 8px;
}

.modal-content::-webkit-scrollbar-track {
  background: #E5E7EB;
  border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
  background: #F3992B;
  border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: #E5922A;
}

/* ==========================================================================
   FORM ACCESSIBILITY ENHANCEMENTS
   ========================================================================== */

/* Required Field Indicators */
label[for] .required::after,
.required-field::after {
  content: " *";
  color: #DC2626;
  font-weight: bold;
  font-size: 1.1em;
}

/* Error States */
.field-error {
  color: #DC2626;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
}

.field-error::before {
  content: "⚠";
  margin-right: 0.25rem;
  color: #DC2626;
}

input.error,
textarea.error,
select.error {
  border-color: #DC2626 !important;
  background-color: #FEF2F2 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}

/* Success States */
input.success,
textarea.success,
select.success {
  border-color: #10B981 !important;
  background-color: #F0FDF4 !important;
}

/* ==========================================================================
   PROGRESS BAR ACCESSIBILITY
   ========================================================================== */

.progress-bar {
  position: relative;
  overflow: hidden;
}

.progress-bar::after {
  content: attr(aria-valuenow) "%";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   BUTTON ACCESSIBILITY
   ========================================================================== */

/* Button States */
button:disabled,
.btn-disabled {
  opacity: 0.6 !important;
  cursor: not-allowed !important;
  pointer-events: none;
}

/* Loading State */
.btn-loading {
  position: relative;
  color: transparent !important;
}

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

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

/* ==========================================================================
   RESPONSIVE TEXT SCALING
   ========================================================================== */

/* Support for user text scaling preferences */
@media (min-resolution: 192dpi) {
  body {
    font-size: 16px;
    line-height: 1.6;
  }
}

/* Large text support */
.text-scale-large {
  font-size: 1.25em;
  line-height: 1.6;
}

/* ==========================================================================
   COOKIE BANNER ACCESSIBILITY
   ========================================================================== */

.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  transform: translateY(100%);
  transition: transform 0.3s ease-in-out;
  z-index: 1000;
}

.cookie-banner.show {
  transform: translateY(0);
}

.cookie-banner:focus-within {
  transform: translateY(0);
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
  .cookie-banner,
  .modal-backdrop,
  #policyModal,
  .fixed,
  button:not(.print-visible),
  .no-print {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
    font-size: 12pt !important;
  }
  
  .form-container {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
  
  input,
  textarea,
  select {
    border: 1px solid #999 !important;
    background: #f9f9f9 !important;
  }
}

/* ==========================================================================
   TOUCH DEVICE OPTIMIZATIONS
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets for mobile */
  button,
  input[type="checkbox"],
  input[type="radio"],
  select,
  .clickable {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Increased spacing for touch */
  .form-group {
    margin-bottom: 1rem;
  }
  
  /* Better mobile input styling */
  input,
  textarea,
  select {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px;
  }
}

/* ==========================================================================
   DARK MODE SUPPORT (if enabled)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
  .dark-mode-auto {
    background-color: #1f2937;
    color: #f9fafb;
  }
  
  .dark-mode-auto input,
  .dark-mode-auto textarea,
  .dark-mode-auto select {
    background-color: #374151;
    color: #f9fafb;
    border-color: #4b5563;
  }
  
  .dark-mode-auto .bg-white {
    background-color: #1f2937 !important;
  }
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

/* Visually Hidden but Accessible */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Focus Visible Only */
.focus-visible:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

/* Smooth Scrolling */
.smooth-scroll {
  scroll-behavior: smooth;
}

/* High Contrast Text */
.high-contrast-text {
  color: #000000;
  text-shadow: 1px 1px 1px #FFFFFF;
}

/* ==========================================================================
   ANIMATION CLASSES
   ========================================================================== */

.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

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

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

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

/* ==========================================================================
   CUSTOM SCROLLBARS
   ========================================================================== */

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

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

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

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

/* Firefox Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #F3992B #f1f1f1;
}

/* ==========================================================================
   FOOTER ENHANCEMENTS
   ========================================================================== */

/* Footer Container */
footer {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%) !important;
  border: 1px solid rgba(243, 153, 43, 0.1) !important;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05) !important;
}

/* Footer Section Headers */
footer h3 {
  color: #014438 !important;
  font-weight: 600 !important;
  margin-bottom: 0.75rem !important;
  display: flex !important;
  align-items: center !important;
  font-size: 0.875rem !important;
}

footer h3::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 16px;
  background: linear-gradient(180deg, #F3992B, #014438);
  margin-right: 0.5rem;
  border-radius: 2px;
}

/* Policy Links Grid - Updated to match HTML structure */
footer .grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
  gap: 0.75rem !important;
  margin-bottom: 1.5rem !important;
}

footer .grid button {
  background: rgba(243, 153, 43, 0.05) !important;
  border: 1px solid rgba(243, 153, 43, 0.2) !important;
  border-radius: 6px !important;
  padding: 0.5rem 0.75rem !important;
  text-align: left !important;
  justify-content: flex-start !important;
  transition: all 0.2s ease !important;
  font-size: 0.75rem !important;
  color: #F3992B !important;
  text-decoration: none !important;
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
}

footer .grid button:hover {
  background: rgba(243, 153, 43, 0.1) !important;
  border-color: rgba(243, 153, 43, 0.4) !important;
  color: #014438 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 4px rgba(243, 153, 43, 0.2) !important;
}

footer .grid button:focus {
  outline: 2px solid #F3992B !important;
  outline-offset: 2px !important;
}

/* Footer Information Sections */
footer .mb-2 {
  background: rgba(1, 68, 56, 0.03) !important;
  border-left: 3px solid !important;
  padding: 0.875rem !important;
  margin-bottom: 0.75rem !important;
  border-radius: 0 6px 6px 0 !important;
  transition: all 0.2s ease !important;
}

footer .mb-2:hover {
  background: rgba(1, 68, 56, 0.05) !important;
  transform: translateX(2px) !important;
}

footer .mb-2:nth-of-type(1) {
  border-left-color: #014438 !important;
}

footer .mb-2:nth-of-type(2) {
  border-left-color: #F3992B !important;
}

footer .mb-2:nth-of-type(3) {
  border-left-color: #AACC14 !important;
}

footer .mb-2 .font-semibold {
  font-weight: 600 !important;
  margin-bottom: 0.5rem !important;
  display: block !important;
  font-size: 0.75rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.025em !important;
}

footer .mb-2 p {
  font-size: 0.75rem !important;
  line-height: 1.5 !important;
  color: #4B5563 !important;
  margin: 0 !important;
}

/* Footer Divider */
footer hr {
  border: none !important;
  height: 1px !important;
  background: linear-gradient(90deg, transparent, #F3992B, transparent) !important;
  margin: 1.5rem 0 !important;
  opacity: 0.6 !important;
}

/* Version Badge */
footer .inline-block {
  display: inline-flex !important;
  align-items: center !important;
  background: linear-gradient(135deg, #F3992B, #014438) !important;
  color: white !important;
  padding: 0.375rem 0.75rem !important;
  border-radius: 20px !important;
  font-size: 0.625rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.025em !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
  margin-top: 1rem !important;
}

footer .inline-block::before {
  content: "🏷️";
  margin-right: 0.375rem;
  font-size: 0.75rem;
}

/* Responsive Footer */
@media (max-width: 640px) {
  footer {
    margin: 1rem !important;
    border-radius: 12px !important;
  }
  
  footer .grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
  }
  
  footer .grid button {
    padding: 0.625rem !important;
    font-size: 0.6875rem !important;
    text-align: left !important;
    justify-content: flex-start !important;
    display: flex !important;
  }
  
  footer .mb-2 {
    padding: 0.75rem !important;
  }
  
  footer h3 {
    font-size: 0.8125rem !important;
  }
}

/* Dark mode support for footer */
@media (prefers-color-scheme: dark) {
  .dark-mode-auto footer {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%) !important;
    border-color: rgba(243, 153, 43, 0.2) !important;
  }
  
  .dark-mode-auto footer .mb-2 {
    background: rgba(243, 153, 43, 0.05) !important;
    color: #D1D5DB !important;
  }
  
  .dark-mode-auto footer .mb-2 p {
    color: #9CA3AF !important;
  }
}

/* Print styles for footer */
@media print {
  footer {
    background: white !important;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
  }
  
  footer .grid button {
    border: 1px solid #666 !important;
    background: #f9f9f9 !important;
  }
}

/* ==========================================================================
   POLICY MODAL STYLING
   ========================================================================== */

/* Policy Content Container */
.policy-content {
  font-family: 'Roboto', sans-serif;
  line-height: 1.6;
  color: #374151;
  max-width: 100%;
}

/* Policy Header */
.policy-header {
  background: linear-gradient(135deg, #F3992B, #014438);
  color: white;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  text-align: center;
}

.policy-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.policy-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  font-size: 0.875rem;
  opacity: 0.9;
}

.effective-date,
.updated-date {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-weight: 500;
}

/* Policy Introduction */
.policy-intro {
  background: #F0FDF4;
  border-left: 4px solid #10B981;
  padding: 1rem 1.5rem;
  border-radius: 0 8px 8px 0;
  margin-bottom: 1.5rem;
}

.policy-intro p {
  margin: 0;
  font-weight: 500;
  color: #065F46;
}

/* Policy Sections */
.policy-section {
  background: #FAFAFA;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: all 0.2s ease;
}

.policy-section:hover {
  background: #F9FAFB;
  border-color: #F3992B;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(243, 153, 43, 0.1);
}

/* Section Titles */
.section-title {
  color: #014438;
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #F3992B;
}

/* Policy Text */
.policy-text {
  margin: 0 0 0.75rem 0;
  color: #4B5563;
  line-height: 1.7;
}

.policy-text:last-child {
  margin-bottom: 0;
}

/* Policy Lists */
.policy-list {
  margin: 0 0 0.75rem 0;
  padding-left: 1.5rem;
  color: #4B5563;
}

.policy-list li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
  position: relative;
}

.policy-list li::marker {
  color: #F3992B;
  font-weight: bold;
}

/* List Highlights */
.list-highlight {
  color: #014438;
  font-weight: 600;
}

/* Contact Section */
.policy-contact {
  background: linear-gradient(135deg, #014438, #F3992B);
  color: white;
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 1.5rem;
  text-align: center;
}

.policy-contact .section-title {
  color: white;
  border-bottom-color: rgba(255, 255, 255, 0.3);
  justify-content: center;
}

.policy-contact .policy-text {
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 0;
}

/* Contact Email Styling */
.contact-email {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-weight: 600;
  display: inline-block;
  margin: 0.25rem 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Policy Links */
.policy-link {
  color: #F3992B;
  text-decoration: underline;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
  transition: color 0.2s ease;
}

.policy-link:hover {
  color: #014438;
  text-decoration: none;
}

/* Modal Enhancements */
#policyModal .bg-white {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

#policyModal .border-gray-200 {
  border-color: rgba(243, 153, 43, 0.2);
}

/* Responsive Policy Styling */
@media (max-width: 640px) {
  .policy-header {
    padding: 1rem;
  }
  
  .policy-title {
    font-size: 1.25rem;
  }
  
  .policy-meta {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .policy-section {
    padding: 1rem;
  }
  
  .section-title {
    font-size: 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  
  .policy-list {
    padding-left: 1rem;
  }
  
  .policy-contact {
    padding: 1rem;
  }
}

/* Print Styles for Policies */
@media print {
  .policy-content {
    background: white !important;
    color: black !important;
  }
  
  .policy-header,
  .policy-contact {
    background: #f0f0f0 !important;
    color: black !important;
  }
  
  .policy-section {
    border: 1px solid #ccc !important;
    background: white !important;
    break-inside: avoid;
  }
  
  .section-title {
    color: black !important;
    border-bottom-color: #ccc !important;
  }
}