/* Shadcn-inspired design with warm earth tones */

:root {
  /* Warm Earth Tone Palette */
  --color-bg: #FEFCF8;
  --color-surface: #FFFFFF;
  --color-border: #E8E3DB;
  --color-text: #3D3935;
  --color-text-muted: #857A70;
  --color-primary: #A0826D;
  --color-primary-hover: #8B6F5C;
  --color-accent: #C9A88A;
  --color-error: #C86B5F;

  /* Spacing (Shadcn-style) */
  --radius: 0.5rem;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Auth Page Layout */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 3rem;
  width: 100%;
  max-width: 420px;
}

.auth-card h1 {
  font-size: 1.875rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.auth-card p {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

/* Form Elements */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

input[type="email"],
input[type="text"] {
  width: 100%;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  transition: all 0.2s;
}

input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(160, 130, 109, 0.1);
}

input::placeholder {
  color: var(--color-text-muted);
}

/* Buttons */
button {
  width: 100%;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: white;
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

button:hover {
  background: var(--color-primary-hover);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

button.secondary:hover {
  background: var(--color-bg);
}

/* Alert Messages */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.alert-error {
  background: rgba(200, 107, 95, 0.1);
  color: var(--color-error);
  border: 1px solid rgba(200, 107, 95, 0.2);
}

.alert-success {
  background: rgba(160, 130, 109, 0.1);
  color: var(--color-primary);
  border: 1px solid rgba(160, 130, 109, 0.2);
}

/* Branding */
.brand-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--color-border);
}

.brand-name {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

.brand-tagline {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin: 0;
}

/* Disclaimer */
.disclaimer {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.disclaimer p {
  font-size: 0.6875rem;
  line-height: 1.5;
  color: var(--color-text-muted);
  margin: 0;
  text-align: left;
}

.disclaimer strong {
  color: var(--color-text);
  font-weight: 600;
}

/* Library Page */
.header {
  padding: 2rem 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-brand {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.header-brand .brand-name {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--color-primary);
  margin: 0;
  letter-spacing: -0.025em;
}

.brand-separator {
  color: var(--color-text-muted);
  font-weight: 400;
  margin: 0 0.5rem;
}

.disclaimer-link {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  cursor: pointer;
  text-decoration: underline;
  font-weight: 400;
  display: inline;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  font-family: inherit;
  line-height: inherit;
  vertical-align: baseline;
  width: auto;
}

.disclaimer-link:hover {
  color: var(--color-primary);
}

.brand-subtitle {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  font-weight: 400;
  margin: 0.5rem 0 0 0;
}

.research-link {
  color: var(--color-primary);
  text-decoration: none;
  transition: all 0.2s;
}

.research-link:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

.logout-btn {
  width: auto;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Section */
.section {
  margin-bottom: 4rem;
}

.section-header {
  margin-bottom: 2rem;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

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

/* Video Grid */
.video-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

/* Video Player Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  padding: 2rem;
  overflow-y: auto;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--color-surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 1000px;
  overflow: hidden;
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0;
  width: auto;
  height: auto;
  line-height: 1;
}

.close-btn:hover {
  color: var(--color-text);
}

.modal-body {
  padding: 0;
}

.video-player {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
}

/* Loading State */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--color-text-muted);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--color-text-muted);
}

.empty-state svg {
  width: 4rem;
  height: 4rem;
  margin-bottom: 1rem;
  opacity: 0.3;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .auth-card {
    padding: 2rem;
  }

  .header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .header-brand {
    text-align: center;
  }

  .logout-btn {
    width: 100%;
  }

  .modal {
    padding: 0;
  }

  .modal-content {
    border-radius: 0;
    max-width: 100%;
    height: 100%;
  }
}

/* Utility Classes */
.hidden {
  display: none;
}

.text-center {
  text-align: center;
}

.mt-4 {
  margin-top: 1rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0;
  overflow-x: auto;
}

.tab-btn {
  background: none;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tab-btn.new-content-tab {
  position: relative;
  padding-right: 2.75rem;
}

.new-content-badge {
  position: absolute;
  top: 0.35rem;
  right: 0.5rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  color: #ffffff;
  background: #ff3b30;
  border-radius: 999px;
  padding: 0.25rem 0.4rem;
  box-shadow: 0 2px 6px rgba(255, 59, 48, 0.4);
  animation: newBadgePulse 1.2s ease-in-out 3;
}

.tab-btn:hover {
  color: var(--color-text);
}

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-disclaimer-link {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-decoration: underline;
  padding: 0.75rem 0.5rem;
  white-space: nowrap;
  align-self: center;
  cursor: pointer;
  transition: color 0.2s;
}

.tab-disclaimer-link:hover {
  color: var(--color-primary);
}

.tab-content {
  padding-top: 2rem;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

@media (max-width: 768px) {
  .tab-btn.new-content-tab {
    padding-right: 2.4rem;
  }

  .new-content-badge {
    top: 0.4rem;
    right: 0.35rem;
    font-size: 0.5625rem;
    padding: 0.22rem 0.34rem;
  }
}

@keyframes newBadgePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 6px rgba(255, 59, 48, 0.4);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.55);
  }
}

/* Video Cards with Thumbnails */
.video-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.video-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.video-thumbnail {
  width: 100%;
  aspect-ratio: 748/288;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-primary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  position: relative;
  overflow: hidden;
}

.video-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--color-bg);
}

.video-thumbnail svg {
  width: 3rem;
  height: 3rem;
  opacity: 0.5;
}

.video-info {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.video-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.video-description {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.5;
  flex: 1;
}

.video-duration {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* Coming Soon Message */
.coming-soon {
  text-align: center;
  padding: 4rem 2rem;
}

.coming-soon svg {
  width: 4rem;
  height: 4rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  opacity: 0.3;
}

.coming-soon p {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* Responsive Grid for Videos */
@media (min-width: 640px) {
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

@media (min-width: 1024px) {
  .video-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }
}

/* Tag Filters */
.tag-filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-right: 0.5rem;
}

.tag-filter-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s;
  border-radius: var(--radius);
}

.tag-filter-btn:hover {
  background: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-primary);
}

.tag-filter-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.tag-filter-btn.all-btn {
  background: var(--color-accent);
  color: var(--color-text);
  border-color: var(--color-accent);
}

.tag-filter-btn.all-btn.active {
  background: var(--color-primary);
  color: white;
}

/* Checkbox Filters (for Movement tab) */
.checkbox-filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.checkbox-label:hover {
  background: var(--color-bg);
  border-color: var(--color-primary);
}

.checkbox-label:has(input:checked) {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.tag-checkbox {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: white;
}


/* Mobile checkbox fixes */
@media (max-width: 768px) {
  .tag-checkbox {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--color-border);
    border-radius: 3px;
    background-color: var(--color-surface);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
  }

  .tag-checkbox:checked {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
  }

  .tag-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
  }
}

/* Video modal disclaimer */
.video-disclaimer {
  margin-top: 1rem;
  padding: 1rem 1.5rem 1.5rem 1.5rem;
  border-top: 1px solid var(--color-border);
}

.video-disclaimer p {
  font-size: 10px;
  line-height: 1.3;
  color: rgba(133, 122, 112, 0.65);
  margin: 0;
  text-align: left;
}

.video-disclaimer strong {
  color: rgba(133, 122, 112, 0.8);
  font-weight: 500;
}
