﻿:root {
  --color-bg: #f8f9fb;
  --color-surface: #ffffff;
  --color-navy: #1a3a5c;
  --color-gold: #d4a574;
  --color-gold-hover: #c9a86a;
  --color-text-body: #2d3748;
  --color-text-header: #1a3a5c;
  --color-muted: #6b7280;
  --color-border: #e2e8f0;
  --header-height: 72px;
  --hero-height: 240px;
  --metadata-height: 64px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-bg);
  font-family: 'Helvetica Neue', Arial, sans-serif;
  color: var(--color-text-body);
  overflow-x: hidden;
}

/* Accessibility - Skip Link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-navy);
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  font-weight: 600;
  z-index: 10000;
  border-radius: 0 0 4px 0;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--color-gold);
  outline-offset: 2px;
}

/* Accessibility - Screen Reader Only */
.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;
}

/* Accessibility - Global Focus Styles */
*:focus {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}

button:focus,
a:focus,
.view-toggle:focus,
.download-button:focus,
.download-option:focus {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--color-navy);
  color: #ffffff;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 2rem;
  padding: 0 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid rgba(212, 165, 116, 0.2);
  z-index: 1000;
  transition: box-shadow 0.3s ease;
}

.header.scrolled {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Logo Section */
.header-logo {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1;
}

.header-logo-main {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0;
  color: #ffffff;
}

.header-logo-sub {
  font-size: 0.625rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 2px;
}

/* Breadcrumb Navigation */
.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.9);
  justify-self: center;
}

.header-breadcrumb-separator {
  color: var(--color-gold);
  opacity: 0.6;
}

.header-breadcrumb-current {
  font-weight: 600;
  color: #ffffff;
}

/* Download Actions */
.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  position: relative;
}

.download-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  background: #ffffff;
  color: var(--color-navy);
  border: 2px solid var(--color-navy);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  position: relative;
}

.download-button:hover {
  border-color: var(--color-gold);
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(212, 165, 116, 0.3);
}

.download-button:active {
  transform: scale(0.98);
  background: var(--color-gold);
  color: #ffffff;
  border-color: var(--color-gold);
}

.download-button::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231a3a5c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'%3E%3C/path%3E%3Cpolyline points='7 10 12 15 17 10'%3E%3C/polyline%3E%3Cline x1='12' y1='15' x2='12' y2='3'%3E%3C/line%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 0.2s ease;
}

.download-button:active::before {
  filter: brightness(0) invert(1);
}

/* Download Dropdown */
.download-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 320px;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 16px;
  z-index: 2000;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.download-dropdown.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.download-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.download-option:hover {
  background: #f8f9fb;
  transform: translateX(2px);
}

.download-option + .download-option {
  margin-top: 8px;
  border-top: 1px solid #e5e7eb;
  padding-top: 20px;
}

.download-option-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 0.2s ease;
}

.download-option.loading .download-option-icon {
  background-image: none !important;
  border: 2px solid #e5e7eb;
  border-top-color: var(--color-gold);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.download-option.success .download-option-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E") !important;
  animation: checkmark 0.3s ease;
}

@keyframes checkmark {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.download-option[data-type="pdf"] .download-option-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%231a3a5c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'%3E%3C/path%3E%3Cpolyline points='14 2 14 8 20 8'%3E%3C/polyline%3E%3Cline x1='16' y1='13' x2='8' y2='13'%3E%3C/line%3E%3Cline x1='16' y1='17' x2='8' y2='17'%3E%3C/line%3E%3Cpolyline points='10 9 9 9 8 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.download-option[data-type="excel"] .download-option-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%231a3a5c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'%3E%3C/path%3E%3Cpolyline points='14 2 14 8 20 8'%3E%3C/polyline%3E%3Crect x='8' y='12' width='8' height='6'%3E%3C/rect%3E%3Cline x1='8' y1='15' x2='16' y2='15'%3E%3C/line%3E%3Cline x1='12' y1='12' x2='12' y2='18'%3E%3C/line%3E%3C/svg%3E");
}

.download-option-content {
  flex: 1;
}

.download-option-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-navy);
  margin: 0 0 4px;
}

.download-option-description {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin: 0 0 6px;
  line-height: 1.4;
}

.download-option-size {
  font-size: 0.75rem;
  color: var(--color-muted);
  font-weight: 500;
}

/* Toast Notification System */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + 1rem);
  right: 1rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--color-navy);
  color: #ffffff;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  min-width: 280px;
  max-width: 400px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border-left: 4px solid var(--color-gold);
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: all;
  opacity: 0;
  transform: translateX(100%);
  animation: toastSlideIn 0.3s ease forwards;
}

.toast.hiding {
  animation: toastSlideOut 0.2s ease forwards;
}

@keyframes toastSlideIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastSlideOut {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23d4a574' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.toast-content {
  flex: 1;
}

.toast-message {
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0;
  line-height: 1.4;
}

.toast-close {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.toast-close:hover {
  opacity: 1;
}

/* User Section */
.header-user {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
}

.header-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-gold) 0%, var(--color-gold-hover) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--color-navy);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Hero Section */
.hero {
  margin-top: var(--header-height);
  background: linear-gradient(135deg, var(--color-navy) 0%, #264163 100%);
  padding: 2.5rem 2rem 2rem;
  color: #ffffff;
}

.hero-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 1rem;
  font-weight: 400;
  margin: 0 0 2rem;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.01em;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.metric-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 1.75rem 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-top: 3px solid var(--color-gold);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.metric-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.5rem;
}

.metric-value {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--color-navy);
  margin: 0;
  letter-spacing: -0.02em;
}

.metric-change {
  font-size: 0.875rem;
  margin-top: 0.5rem;
  color: var(--color-muted);
}

.metric-change.positive {
  color: #10b981;
}

.metric-change.negative {
  color: #ef4444;
}

/* Dashboard Content */
.dashboard-content {
  padding: 2rem;
  max-width: 1600px;
  margin: 0 auto;
}

.dashboard-frame {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  position: relative;
  min-height: 800px;
}

.dashboard-frame iframe {
  width: 100%;
  height: 100%;
  min-height: 800px;
  border: none;
  display: block;
}

/* Loading State */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  opacity: 1;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.loading-overlay.hidden {
  opacity: 0;
}

.loading-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-navy);
  letter-spacing: 0.08em;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-text {
  font-size: 0.875rem;
  color: var(--color-muted);
}

@media (max-width: 1024px) {
  .header {
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    height: auto;
    padding: 1rem 1.5rem;
    gap: 1rem;
  }

  .header-logo {
    grid-column: 1;
    grid-row: 1;
  }

  .header-user {
    grid-column: 3;
    grid-row: 1;
  }

  .header-breadcrumb {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: flex-start;
    font-size: 0.8rem;
  }

  .header-actions {
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
  }

  .header-actions a {
    flex: 1 1 45%;
    justify-content: center;
  }

  .hero {
    padding: 2rem 1.5rem 1.5rem;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .dashboard-content {
    padding: 1.5rem 1rem;
  }

  .download-dropdown {
    width: 100%;
    left: 0;
    right: 0;
    max-width: 320px;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .footer-left,
  .footer-right {
    align-items: center;
  }

  .footer-links {
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .header-logo-main {
    font-size: 1rem;
  }

  .header-logo-sub {
    font-size: 0.55rem;
  }

  .header-user-name {
    display: none;
  }

  .header-breadcrumb {
    font-size: 0.75rem;
  }

  .header-actions a {
    font-size: 0.8rem;
    padding: 0.45rem 1rem;
  }

  .hero {
    padding: 1.5rem 1rem;
  }

  .hero-title {
    font-size: 1.25rem;
  }

  .hero-subtitle {
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
  }

  .metric-card {
    padding: 1.25rem 1rem;
  }

  .metric-value {
    font-size: 1.75rem;
  }

  .dashboard-content {
    padding: 1rem 0.5rem;
  }

  .dashboard-frame {
    border-radius: 6px;
  }

  .download-dropdown {
    width: calc(100vw - 2rem);
    left: 1rem;
    right: 1rem;
    max-width: none;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }

  .site-footer {
    padding: 2rem 1rem 1.5rem;
    margin-top: 2rem;
  }

  .footer-content {
    gap: 1.5rem;
  }

  .footer-confidential {
    font-size: 0.8rem;
    padding: 0.75rem 1rem;
  }

  .footer-links {
    flex-direction: column;
    gap: 0.75rem;
  }
}

/* Site Footer */
.site-footer {
  background: var(--color-navy);
  color: rgba(255, 255, 255, 0.85);
  padding: 2.5rem 2rem 2rem;
  margin-top: 4rem;
  border-top: 3px solid var(--color-gold);
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  gap: 3rem;
  align-items: start;
}

.footer-left {
  display: flex;
  flex-direction: column;
}

.footer-logo {
  margin-bottom: 1rem;
}

.footer-logo-main {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ffffff;
  margin-bottom: 4px;
}

.footer-logo-sub {
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.75);
}

.footer-copyright {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

.footer-center {
  display: flex;
  align-items: center;
}

.footer-confidential {
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 1rem 1.5rem;
  background: rgba(212, 165, 116, 0.1);
  border-left: 3px solid var(--color-gold);
  border-radius: 4px;
  margin: 0;
}

.footer-confidential strong {
  color: var(--color-gold);
  font-weight: 600;
}

.footer-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--color-gold);
  text-decoration: underline;
}

.footer-version {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
  font-family: 'Courier New', monospace;
}
