/**
 * modern.css — Non-destructive UI modernization overlay for dPAC
 *
 * Loaded AFTER all existing stylesheets (main.css, custom.css,
 * light-overrides.css, dark-overrides.css) so it wins by cascade.
 *
 * Does NOT touch the Bootstrap 3 grid or responsive breakpoints.
 * All mobile compatibility is preserved.
 */

/* ==========================================================================
   1. CSS Custom Properties (Design Tokens)
   ========================================================================== */

:root {
  /* Brand */
  --color-primary: #f6be26;
  --color-primary-rgb: 246, 190, 38;
  --color-primary-hover: #e5ae1a;

  /* Semantic */
  --color-danger: #cc483f;
  --color-success: #2b602d;
  --color-info: #3a5e7d;
  --color-warning: #c17909;

  /* Dark theme (default) */
  --color-bg: #1c1e21;
  --color-surface: #252729;
  --color-surface-elevated: #2c2e31;
  --color-text: #e0e0e0;
  --color-text-secondary: #a0a0a0;
  --color-text-muted: #777;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-strong: rgba(255, 255, 255, 0.14);

  /* Navbar */
  --navbar-bg: rgba(6, 6, 6, 0.78);
  --navbar-border: rgba(255, 255, 255, 0.06);
  --navbar-shadow: 0 1px 24px rgba(0, 0, 0, 0.30);

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 100px;

  /* Shadows (layered for realistic depth) */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.16), 0 0.5px 1px rgba(0, 0, 0, 0.10);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.22), 0 1px 3px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.28), 0 2px 6px rgba(0, 0, 0, 0.12);
  --shadow-glow-primary: 0 0 20px rgba(var(--color-primary-rgb), 0.30);

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}


/* ==========================================================================
   2. Typography & Global Defaults
   ========================================================================== */

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  letter-spacing: 0.01em;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: 'Inter', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.panel-title {
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Smoother link transitions */
a {
  transition: color var(--transition-fast), opacity var(--transition-fast);
}
a:hover {
  opacity: 0.9;
}


/* ==========================================================================
   3. Navbar — Frosted Glass
   ========================================================================== */

.navbar-inverse.navbar-fixed-top,
.navbar-inverse.navbar-fixed-top.top-bar {
  background-color: var(--navbar-bg);
  border-bottom: 1px solid var(--navbar-border);
  box-shadow: var(--navbar-shadow);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  transition: background-color var(--transition-normal), box-shadow var(--transition-normal);
}

/* Fallback for browsers without backdrop-filter */
@supports not (backdrop-filter: blur(1px)) {
  .navbar-inverse.navbar-fixed-top,
  .navbar-inverse.navbar-fixed-top.top-bar {
    background-color: #060606;
  }
}

/* Make collapsed area transparent so blur shows through */
.navbar-inverse .navbar-collapse {
  background-color: transparent;
}

/* Nav link hover glow */
.navbar-inverse .navbar-nav > li > a {
  transition: color var(--transition-fast), text-shadow var(--transition-fast);
  border-radius: var(--radius-xs);
}
.navbar-inverse .navbar-nav > li > a:hover,
.navbar-inverse .navbar-nav > li > a:focus {
  color: var(--color-primary);
  text-shadow: 0 0 12px rgba(var(--color-primary-rgb), 0.35);
}

/* Selected nav item — accent underline */
.selected {
  border-bottom: 3px solid var(--color-primary) !important;
  border-radius: 0;
}

/* Dropdown menus */
.dropdown-menu {
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: fadeSlideDown 0.18s ease-out;
}

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


/* ==========================================================================
   4. Panels (Cards) — Modern Elevated Style
   ========================================================================== */

.panel {
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.panel:hover {
  box-shadow: var(--shadow-md);
}

.panel-heading {
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
  border-bottom: 1px solid var(--color-border);
}

.panel-footer {
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

.panel-group .panel {
  border-radius: var(--radius-md);
}

/* Workout cards get a lift on hover */
.workout-border {
  border-radius: var(--radius-md);
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}
.workout-border:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.tab-pane .panel {
  border-top-left-radius: 0;
}

/* ==========================================================================
   5. Buttons — Refined Interactions
   ========================================================================== */

.btn {
  border-radius: var(--radius-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

/* Primary button glow on hover */
.btn-primary:hover,
.btn-primary:focus {
  box-shadow: 0 0 18px rgba(var(--color-primary-rgb), 0.40),
              0 4px 12px rgba(0, 0, 0, 0.20);
  transform: translateY(-1px);
}

/* Default button subtle lift */
.btn-default:hover,
.btn-default:focus {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Info button */
.btn-info:hover,
.btn-info:focus {
  box-shadow: 0 0 14px rgba(58, 94, 125, 0.40),
              0 4px 10px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

/* Danger button */
.btn-danger:hover,
.btn-danger:focus {
  box-shadow: 0 0 14px rgba(204, 72, 63, 0.40),
              0 4px 10px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

/* Success button */
.btn-success:hover,
.btn-success:focus {
  box-shadow: 0 0 14px rgba(43, 96, 45, 0.40),
              0 4px 10px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

/* Button sizes keep same radii */
.btn-lg,
.btn-group-lg > .btn {
  border-radius: var(--radius-sm);
}
.btn-sm,
.btn-group-sm > .btn {
  border-radius: var(--radius-xs);
}
.btn-xs,
.btn-group-xs > .btn {
  border-radius: var(--radius-xs);
}


/* ==========================================================================
   6. Form Controls — Cleaner, Modern Inputs
   ========================================================================== */

.form-control {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.20);
  outline: none;
}

.input-group-addon {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

/* Select dropdowns */
.select {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.28);
}
.select select {
  border-radius: var(--radius-sm);
  border: none;
}


/* ==========================================================================
   7. Tables — Softer Appearance
   ========================================================================== */

.table {
  border-radius: var(--radius-sm);
}

.table > thead > tr > th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8em;
  letter-spacing: 0.05em;
  opacity: 0.75;
}

.table-striped > tbody > tr:nth-child(odd) > td,
.table-striped > tbody > tr:nth-child(odd) > th {
  border-radius: 0;
}

.table-responsive {
  border-radius: var(--radius-sm);
}


/* ==========================================================================
   8. Labels & Badges — Pill-shaped
   ========================================================================== */

.label {
  border-radius: var(--radius-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge {
  border-radius: var(--radius-pill);
}


/* ==========================================================================
   9. Alerts — Softer, Modern Alerts
   ========================================================================== */

.alert {
  border-radius: var(--radius-md);
  border: none;
  box-shadow: var(--shadow-xs);
}

/* Power Record (PR) alert — celebratory gold standout */
.alert-pr {
  color: #f6be26;
  background-color: rgba(246, 190, 38, 0.12);
  border: 1px solid rgba(246, 190, 38, 0.4) !important;
  box-shadow: 0 0 20px rgba(246, 190, 38, 0.15), var(--shadow-sm);
}
.alert-pr .close {
  color: #f6be26;
  opacity: 0.7;
}
.alert-pr .close:hover {
  opacity: 1;
}


/* ==========================================================================
   10. Modals — Rounded, Elevated
   ========================================================================== */

.modal-content {
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  border-bottom: 1px solid var(--color-border);
}

.modal-footer {
  border-top: 1px solid var(--color-border);
}

.modal-dialog {
  border-radius: var(--radius-lg);
}


/* ==========================================================================
   11. Tabs — Modern Pill-ish Style
   ========================================================================== */

.nav-tabs {
  border-bottom: 2px solid var(--color-border);
}

.nav-tabs > li > a {
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: background-color var(--transition-fast), color var(--transition-fast),
              border-color var(--transition-fast);
  margin-right: 2px;
}


/* ==========================================================================
   12. Pagination — Rounded
   ========================================================================== */

.pagination > li:first-child > a,
.pagination > li:first-child > span {
  border-bottom-left-radius: var(--radius-sm);
  border-top-left-radius: var(--radius-sm);
}

.pagination > li:last-child > a,
.pagination > li:last-child > span {
  border-bottom-right-radius: var(--radius-sm);
  border-top-right-radius: var(--radius-sm);
}

.pagination > li > a,
.pagination > li > span {
  transition: all var(--transition-fast);
}


/* ==========================================================================
   13. Breadcrumbs
   ========================================================================== */

.breadcrumb {
  border-radius: var(--radius-sm);
}


/* ==========================================================================
   14. Progress Bars
   ========================================================================== */

.progress {
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar {
  border-radius: var(--radius-pill);
}


/* ==========================================================================
   15. Footer — Refined Spacing & Accent
   ========================================================================== */

footer.footer {
  padding-top: 40px;
  padding-bottom: 20px;
}

footer.footer hr {
  border: none;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--color-primary) 30%,
    var(--color-primary) 70%,
    transparent 100%
  );
  opacity: 0.35;
  margin-top: 30px;
  margin-bottom: 30px;
}

footer.footer h4 {
  font-weight: 600;
  font-size: 1.05em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

footer.footer p {
  line-height: 2.0;
}

.footer-link {
  transition: color var(--transition-fast), opacity var(--transition-fast);
}
.footer-link:hover {
  color: var(--color-primary) !important;
  opacity: 1;
}

/* Social icons in footer */
footer .fa-2x {
  transition: transform var(--transition-fast), color var(--transition-fast);
}
footer .fa-2x:hover {
  transform: scale(1.15);
  color: var(--color-primary) !important;
}


/* ==========================================================================
   16. Tooltips (Bootstrap 3) — Rounded
   ========================================================================== */

.tooltip-inner {
  border-radius: var(--radius-xs);
  font-size: 13px;
  padding: 8px 14px;
  max-width: 300px;
  line-height: 1.5;
}


/* ==========================================================================
   17. Miscellaneous Refinements
   ========================================================================== */

/* Scrollbar styling (Webkit) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.25);
}


/* Virtual Coach card */
.virtual-coach-card {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}
.virtual-coach-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* Search bar in nav */
.search-menu-bar .form-control {
  border-radius: var(--radius-pill);
  padding-left: 16px;
  padding-right: 16px;
}

/* Image thumbnails */
.img-thumbnail {
  border-radius: var(--radius-sm);
}

/* External connection panels */
.external-connection-panel {
  border-radius: var(--radius-md);
}

/* Summary card */
.summary-card {
  border-radius: var(--radius-md) !important;
}

/* Modal login button */
.modal-login-btn {
  min-width: 140px;
  border-radius: var(--radius-sm);
}

/* List group items */
.list-group-item {
  transition: background-color var(--transition-fast);
}
.list-group-item:first-child {
  border-top-left-radius: var(--radius-sm);
  border-top-right-radius: var(--radius-sm);
}
.list-group-item:last-child {
  border-bottom-left-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}

/* Workout metrics title */
.workout-metrics-title {
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Strava / TP sync loaders */
.strava-syncing-recent img,
.tp-syncing-recent img {
  border-radius: 50%;
}


/* ==========================================================================
   18. Light Theme Overrides (loaded via light-overrides.css cascade)
   ========================================================================== */

/*
   Since both light-overrides.css and dark-overrides.css are loaded,
   and the light overrides body bg is #f9f6ed, we detect that and
   adjust variables accordingly via the cascade (light-overrides
   already applies first, then dark-overrides overwrites).

   If in the future a body class .light-theme is added, these
   overrides can be scoped to that class:
*/

/* No JS-based theme toggle needed — the existing CSS cascade handles it.
   The custom properties above are set for dark theme by default. Both
   light-overrides.css and dark-overrides.css already handle colors.
   modern.css just layers visual refinements on top of whichever theme
   is active — border-radius, shadows, transitions, and typography
   work the same in both themes. */


/* ==========================================================================
   19. Subtle Animations
   ========================================================================== */

/* Page load fade-in for main content */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#page-wrapper {
  animation: fadeInUp 0.4s ease-out;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .panel:hover,
  .workout-border:hover,
  .btn:hover,
  .virtual-coach-card:hover {
    transform: none !important;
  }
}


/* ==========================================================================
   20. Mobile-Specific Tweaks (preserve existing + enhance)
   ========================================================================== */

@media (max-width: 767px) {
  /* Navbar: slightly more opaque on mobile for readability */
  .navbar-inverse.navbar-fixed-top,
  .navbar-inverse.navbar-fixed-top.top-bar {
    background-color: rgba(6, 6, 6, 0.92);
  }

  /* Disable hover lifts on mobile (touch) */
  .panel:hover,
  .workout-border:hover {
    transform: none;
  }

  /* Ensure panels don't overflow */
  .panel {
    border-radius: var(--radius-sm);
  }

  /* Modal full-width on mobile */
  .modal-content {
    border-radius: var(--radius-sm);
  }

  /* Smaller footer top padding */
  footer.footer {
    padding-top: 20px;
  }
}

