/* Modern DanceScore CSS - Mobile First Approach */

/* CSS Custom Properties (Variables) */
:root {
  /* Colors */
  --color-primary: #0447a9;
  --color-secondary: #c00;
  --color-text: #333;
  --color-text-light: #666;
  --color-background: #fff;
  --color-border: #ddd;
  --color-error: #c00;
  --color-success: #090;
  
  /* Typography */
  --font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-size-base: 1rem;
  --font-size-small: 0.875rem;
  --font-size-large: 1.125rem;
  --line-height-base: 1.5;
  --line-height-tight: 1.2;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-xxl: 3rem;
  
  /* Layout */
  --container-max-width: 1100px;
  --border-radius: 0.5rem;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Reset and Base Styles */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-background);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Modern Container */
#content {
  flex: 1;
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: var(--space-md);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}

/* Header */
#header {
  margin-bottom:0;
}

#header img {
  width: 100%;
  height: auto;
  border-radius: var(--border-radius);
}

/* Main Content Layout */
@media (min-width: 768px) {
  #content {
    grid-template-columns: 2fr 1fr;
    grid-template-areas: 
      "header header"
      "article sidebar";
  }
  
  #header {
    grid-area: header;
  }
  
  #article {
    grid-area: article;
  }
  
  #side {
    grid-area: sidebar;
  }
}

/* Article Styles */
#article {
  background-color: var(--color-background);
  padding: var(--space-lg);
  border-radius: var(--border-radius);
}

/* Sidebar */
#side {
  background-color: var(--color-background);
  padding: var(--space-lg);
  border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family);
  line-height: var(--line-height-tight);
  margin: 0 0 var(--space-md) 0;
  color: var(--color-text);
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--space-xl);
  color: var(--color-primary);
}

h2 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 600;
  margin-top: var(--space-xl);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--color-primary);
}

h3 {
  font-size: var(--font-size-large);
  font-weight: 600;
  color: var(--color-primary);
  margin-top: var(--space-lg);
}

h4 {
  font-size: var(--font-size-base);
  font-weight: 500;
  margin-bottom: var(--space-sm);
}

p {
  margin: 0 0 var(--space-md) 0;
  line-height: var(--line-height-base);
}

/* Links */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s ease, box-shadow 0.2s ease;
}

a:hover,
a:focus {
  color: var(--color-secondary);
  outline: none;
}

a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Download Links */
#side h4 a {
  display: block;
  padding: var(--space-sm) var(--space-md);
  background-color: var(--color-background);
  border: 2px solid var(--color-primary);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-sm);
  transition: all 0.2s ease;
  font-weight: 500;
}

#side h4 a:hover,
#side h4 a:focus {
  background-color: var(--color-primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* Navigation */
#nav {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

#nav li a {
  display: block;
  padding: var(--space-md);
  background-color: var(--color-secondary);
  color: white;
  text-align: center;
  border-radius: var(--border-radius);
  font-weight: 500;
  transition: all 0.2s ease;
}

#nav li a:hover,
#nav li a:focus {
  background-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* Forms */
input,
select,
button {
  font-family: inherit;
  font-size: var(--font-size-base);
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: var(--space-sm) var(--space-md);
  transition: all 0.2s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(4, 71, 169, 0.1);
}

button,
input[type="submit"] {
  background-color: var(--color-primary);
  color: white;
  border: 2px solid var(--color-primary);
  cursor: pointer;
  font-weight: 500;
  min-width: 120px;
}

button:hover,
input[type="submit"]:hover,
button:focus,
input[type="submit"]:focus {
  background-color: var(--color-secondary);
  border-color: var(--color-secondary);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-lg) 0;
}

#viewtable tr:nth-child(even) {
  background-color: #f8f9fa;
}

#viewtable th,
#viewtable td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

/* Images */
img {
  max-width: 100%;
  height: auto;
}

.figure,
.figure-portrait {
  margin: var(--space-lg) 0;
}

.figure {
  width: 100%;
  max-width: 600px;
}

.figure-portrait {
  width: 100%;
  max-width: 400px;
}

.figcaption {
  font-weight: 600;
  text-align: center;
  font-size: var(--font-size-small);
  margin-top: var(--space-sm);
  color: var(--color-text-light);
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.text-error {
  color: var(--color-error);
}

.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;
}

/* Animations */
.w3-animate-top {
  animation: slideInFromTop 0.4s ease-out;
}

.w3-animate-left {
  animation: slideInFromLeft 0.4s ease-out;
}

.w3-animate-right {
  animation: slideInFromRight 0.4s ease-out;
}

.w3-animate-bottom {
  animation: slideInFromBottom 0.4s ease-out;
}

.w3-animate-fading {
  animation: fade 15s infinite;
}

@keyframes slideInFromTop {
  from {
    transform: translateY(-100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInFromLeft {
  from {
    transform: translateX(-100px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInFromRight {
  from {
    transform: translateX(100px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInFromBottom {
  from {
    transform: translateY(100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fade {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

/* Slideshow */
.w3-content {
  margin: var(--space-lg) 0;
  position: relative;
}

.mySlides {
  display: none;
  width: 100%;
  border-radius: var(--border-radius);
}

.mySlides.active {
  display: block;
}

/* Footer */
#footer {
  background-color: var(--color-text);
  color: white;
  padding: var(--space-lg);
  text-align: center;
  font-size: var(--font-size-small);
  margin-top: auto;
}

/* Error Styles */
.error-page {
  text-align: center;
  padding: var(--space-xxl);
}

.error-page h1 {
  color: var(--color-error);
  margin-bottom: var(--space-xl);
}

/* Responsive Design */
@media (max-width: 767px) {
  :root {
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.5rem;
  }
  
  #content {
    padding: var(--space-sm);
  }
  
  #article,
  #side {
    padding: var(--space-md);
  }
  
  #footer {
    display: none;
  }
  
  #nav {
    margin-bottom: var(--space-xl);
  }
}

@media (min-width: 1024px) {
  #content {
    padding: var(--space-xl);
  }
  
  #article,
  #side {
    padding: var(--space-xl);
  }
}

/* Print Styles */
@media print {
  #nav,
  #footer,
  .no-print {
    display: none !important;
  }
  
  #content {
    grid-template-columns: 1fr;
    max-width: none;
    margin: 0;
    padding: 0;
  }
  
  #article,
  #side {
    float: none;
    width: 100%;
    padding: 0;
    box-shadow: none;
    border: none;
  }
  
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }
  
  img,
  .figure,
  .figure-portrait {
    page-break-inside: avoid;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --color-primary: #000080;
    --color-secondary: #800000;
    --color-border: #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;
  }
}