/*
Theme Name: Ascenso Studies Theme
Theme URI: https://ascenso-akademie.de
Author: Ascenso Akademie
Author URI: https://ascenso-akademie.de
Description: Modernes internes Studienportal für den Ascenso Studies Hub. Minimalistisch, schnell, mobil-first.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: Private
Text Domain: ascenso-studies
Tags: custom-post-types, ajax, dashboard, community
*/

/* ============================================================
   CSS DESIGN SYSTEM
   ============================================================ */

:root {
  /* Colors */
  --color-white:        #ffffff;
  --color-off-white:    #f9f8f6;
  --color-bg:           #f4f2ee;
  --color-bg-card:      #ffffff;
  --color-border:       #e6e3dc;
  --color-border-light: #eeebe5;

  --color-text-primary:   #1c1a17;
  --color-text-secondary: #6a6660;
  --color-text-muted:     #a09b95;

  --color-accent:       #622a80;
  --color-accent-dark:  #4e2066;
  --color-accent-light: #f3edf8;
  --color-accent-hover: #7a35a0;

  --color-secondary:       #ffcc01;
  --color-secondary-dark:  #e6b800;
  --color-secondary-light: #fffbe6;

  --color-success:  #3ea875;
  --color-error:    #d94f4f;
  --color-warning:  #e8962e;
  --color-info:     #4a7fd4;

  --color-announcement-bg:  #fff8ee;
  --color-announcement-border: #f0d49a;
  --color-question-bg:      #f0f6ff;
  --color-question-border:  #c0d4f5;

  /* Typography */
  --font-sans:  'Inter', 'Helvetica Neue', Arial, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;

  --font-normal:   400;
  --font-medium:   500;
  --font-semibold: 600;
  --font-bold:     700;

  --leading-tight:  1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm:  0 2px 6px rgba(0, 0, 0, 0.06);
  --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg:  0 8px 32px rgba(0, 0, 0, 0.10);
  --shadow-xl:  0 16px 48px rgba(0, 0, 0, 0.12);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
  --transition-slow:   400ms ease;

  /* Layout */
  --max-width:         1280px;
  --sidebar-width:     260px;
  --nav-height:        64px;
  --card-padding:      var(--space-6);

  /* Z-index */
  --z-base:     1;
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-modal:    900;
  --z-toast:    1000;

  /* Card left-accent (overridden per type) */
  --card-left-accent: transparent;
}

/* ============================================================
   RESET & BASE
   ============================================================ */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.logged-in {
  background-color: var(--color-bg);
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  color: var(--color-text-primary);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  line-height: var(--leading-relaxed);
  color: var(--color-text-secondary);
}

/* ============================================================
   LAYOUT
   ============================================================ */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.site-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-main {
  flex: 1;
}

/* Dashboard layout */
.studies-dashboard-layout {
  min-height: calc(100vh - var(--nav-height));
}

/* ============================================================
   NAVIGATION
   ============================================================ */

.site-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--nav-height);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-xs);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: var(--font-bold);
  font-size: var(--text-lg);
  color: var(--color-text-primary);
}

.nav-brand-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav-link {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
  background: var(--color-accent-light);
  color: var(--color-accent-dark);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.nav-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-accent-light), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-accent-dark);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.nav-avatar:hover {
  transform: scale(1.05);
}

.nav-mobile-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: background var(--transition-fast);
}

.nav-mobile-toggle:hover {
  background: var(--color-border-light);
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-mobile-toggle { display: flex; }
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.studies-sidebar {
  width: var(--sidebar-width);
  background: var(--color-white);
  border-right: 1px solid var(--color-border-light);
  padding: var(--space-6) 0;
  position: sticky;
  top: var(--nav-height);
  height: calc(100vh - var(--nav-height));
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar-section {
  padding: 0 var(--space-4) var(--space-6);
}

.sidebar-label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 var(--space-2) var(--space-2);
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.sidebar-nav-item:hover {
  background: var(--color-off-white);
  color: var(--color-text-primary);
}

.sidebar-nav-item.active {
  background: var(--color-accent-light);
  color: var(--color-accent-dark);
}

.sidebar-nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-nav-item.active svg {
  opacity: 1;
}

@media (max-width: 1024px) {
  .studies-sidebar {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    z-index: var(--z-dropdown);
    width: var(--sidebar-width);
    height: calc(100vh - var(--nav-height));
    box-shadow: var(--shadow-lg);
  }

  .studies-sidebar.open {
    display: block;
  }
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: var(--card-padding);
  box-shadow: inset 3px 0 0 var(--card-left-accent), 0 1px 4px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  transition: box-shadow var(--transition-base), transform var(--transition-base), border-color var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.card:hover {
  box-shadow: inset 3px 0 0 var(--card-left-accent), 0 4px 16px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.06);
  transform: translateY(-2px);
  border-color: #c8c4bc;
}

/* Per-type left accent colors */
.card-text        { --card-left-accent: #b0acaa; }
.card-link        { --card-left-accent: #4a7fd4; }
.card-image       { --card-left-accent: #3ea875; }
.card-video       { --card-left-accent: #d94f4f; }
.card-audio       { --card-left-accent: #8b5cf6; }
.card-file        { --card-left-accent: #e8962e; }
.announcement-card { --card-left-accent: var(--color-accent); }
.question-card    { --card-left-accent: var(--color-info); }

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.card-author-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: linear-gradient(140deg, var(--color-accent-light) 0%, #e0ccf0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-accent-dark);
  flex-shrink: 0;
  border: 2px solid var(--color-white);
  box-shadow: 0 0 0 1.5px var(--color-border);
}

.card-author-name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--color-text-primary);
}

.card-time {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.card-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: var(--font-semibold);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--color-off-white);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border-light);
  flex-shrink: 0;
  line-height: 1;
}

.card-type-badge svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

.card-type-badge.type-link    { background: #eef4ff; color: #4a7fd4; border-color: #c8d9f5; }
.card-type-badge.type-image   { background: #f0faf5; color: #3ea875; border-color: #b8e8d4; }
.card-type-badge.type-video   { background: #fff0f0; color: #d94f4f; border-color: #f5c8c8; }
.card-type-badge.type-audio   { background: #f5f0ff; color: #8b5cf6; border-color: #d8c8f5; }
.card-type-badge.type-file    { background: #fff8ee; color: #e8962e; border-color: #f5d8a8; }
.card-type-badge.type-announcement { background: var(--color-announcement-bg); color: var(--color-accent-dark); border-color: var(--color-announcement-border); }
.card-type-badge.type-question { background: var(--color-question-bg); color: var(--color-info); border-color: var(--color-question-border); }

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-text-primary);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-2);
}

.card-body {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-light);
}

.card-category-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  background: var(--color-accent-light);
  color: var(--color-accent-dark);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.card-action-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
}

.card-action-btn:hover {
  color: var(--color-accent);
}

.card-action-btn svg {
  width: 14px;
  height: 14px;
}

/* Link Card */
.link-card-preview {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--color-off-white);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
  margin: var(--space-4) 0;
  transition: background var(--transition-fast);
  text-decoration: none;
}

.link-card-preview:hover {
  background: var(--color-accent-light);
}

.link-favicon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.link-url-text {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Image Card */
.card-image-wrapper {
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: var(--space-4) 0;
  background: var(--color-border-light);
  aspect-ratio: 16/9;
}

.card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.card:hover .card-image-wrapper img {
  transform: scale(1.02);
}

/* Video Card */
.video-embed-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: #000;
  margin: var(--space-4) 0;
}

.video-embed-wrapper iframe,
.video-embed-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
}

/* Audio Card */
.audio-player {
  background: var(--color-off-white);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin: var(--space-4) 0;
}

.audio-player audio {
  width: 100%;
}

/* File Card */
.file-download-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--color-off-white);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
  margin: var(--space-4) 0;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.file-download-card:hover {
  background: var(--color-accent-light);
  border-color: var(--color-accent);
}

.file-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--color-warning);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
}

.file-name {
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
}

.file-size {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Announcement Card */
.card.announcement-card {
  background: var(--color-announcement-bg);
  border-color: var(--color-announcement-border);
}

/* Question Card */
.card.question-card {
  background: var(--color-question-bg);
  border-color: var(--color-question-border);
}

.question-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--color-info);
  color: white;
  font-weight: var(--font-bold);
  font-size: var(--text-sm);
  margin-right: var(--space-2);
}

/* ============================================================
   FEED
   ============================================================ */

.studies-feed-container {
  padding: var(--space-6);
  max-width: 720px;
}

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.feed-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
}

.feed-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.feed-filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  overflow-x: auto;
  padding: var(--space-1) 0 var(--space-2);
  scrollbar-width: none;
}

.feed-filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.filter-divider {
  width: 1px;
  height: 18px;
  background: var(--color-border);
  flex-shrink: 0;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: var(--font-medium);
  white-space: nowrap;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  background: var(--color-white);
  transition: all var(--transition-fast);
  cursor: pointer;
  line-height: 1;
}

.filter-chip svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.7;
}

.filter-chip:hover {
  border-color: #b0a8a0;
  color: var(--color-text-primary);
  background: var(--color-off-white);
}

/* Sort chips: dark active state */
.sort-chip.active {
  background: var(--color-text-primary);
  border-color: var(--color-text-primary);
  color: #fff;
}

.sort-chip.active svg { opacity: 1; }

/* Type chips: accent active state */
.type-chip.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.type-chip.active svg { opacity: 1; }

/* Legacy .active for backwards compat */
.filter-chip.active {
  background: var(--color-text-primary);
  border-color: var(--color-text-primary);
  color: #fff;
}

.feed-posts {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.load-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: 10px var(--space-4);
  text-align: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text-secondary);
  background: var(--color-white);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: var(--space-3);
}

.load-more-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent-dark);
  background: var(--color-accent-light);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   SEARCH
   ============================================================ */

.search-wrapper {
  position: relative;
}

.search-input {
  width: 100%;
  padding: var(--space-3) var(--space-4) var(--space-3) var(--space-10);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-white);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  transition: all var(--transition-fast);
  outline: none;
}

.search-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.15);
}

.search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

/* ============================================================
   FORMS & INPUTS
   ============================================================ */

.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.form-label.required::after {
  content: ' *';
  color: var(--color-error);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-white);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  transition: all var(--transition-fast);
  outline: none;
  appearance: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-muted);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: var(--leading-relaxed);
}

.form-select {
  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='%23a09b95' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: var(--space-10);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-error);
  margin-top: var(--space-1);
}

.form-input.has-error,
.form-textarea.has-error {
  border-color: var(--color-error);
}

/* File Upload */
.file-upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-10);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--color-off-white);
}

.file-upload-zone:hover,
.file-upload-zone.dragging {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
}

.file-upload-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-3);
  color: var(--color-text-muted);
}

.file-upload-text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.file-upload-text strong {
  color: var(--color-accent-dark);
}

.file-upload-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

/* Type Selector */
.type-selector-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}

.type-selector-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-2);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-white);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.type-selector-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent-dark);
  background: var(--color-accent-light);
}

.type-selector-btn.active {
  border-color: var(--color-accent);
  background: var(--color-accent-light);
  color: var(--color-accent-dark);
}

.type-selector-btn svg {
  width: 20px;
  height: 20px;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1.5px solid transparent;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  color: white;
  border-color: var(--color-accent-dark);
  box-shadow: 0 2px 8px rgba(201, 169, 110, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(201, 169, 110, 0.4);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--color-white);
  color: var(--color-text-primary);
  border-color: var(--color-border);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--color-accent);
  color: var(--color-accent-dark);
  background: var(--color-accent-light);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-off-white);
  color: var(--color-text-primary);
}

.btn-danger {
  background: var(--color-error);
  color: white;
  border-color: var(--color-error);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

.btn-full {
  width: 100%;
}

.btn-loading {
  position: relative;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ============================================================
   MODALS
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px) scale(0.97);
  transition: transform var(--transition-base);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

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

.modal-title {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--color-off-white);
  color: var(--color-text-primary);
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border-light);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */

.toast-container {
  position: fixed;
  top: calc(var(--nav-height) + var(--space-4));
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
  min-width: 280px;
  max-width: 380px;
  pointer-events: all;
  transform: translateX(120%);
  transition: transform var(--transition-base);
}

.toast.show {
  transform: translateX(0);
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-message {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  flex: 1;
}

.toast.success { border-left: 3px solid var(--color-success); }
.toast.error   { border-left: 3px solid var(--color-error); }
.toast.warning { border-left: 3px solid var(--color-warning); }
.toast.info    { border-left: 3px solid var(--color-info); }

.toast.success .toast-icon { color: var(--color-success); }
.toast.error   .toast-icon { color: var(--color-error); }
.toast.warning .toast-icon { color: var(--color-warning); }
.toast.info    .toast-icon { color: var(--color-info); }

/* ============================================================
   SKELETON LOADER
   ============================================================ */

.skeleton {
  background: linear-gradient(90deg, var(--color-border-light) 25%, var(--color-border) 50%, var(--color-border-light) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--card-padding);
}

.skeleton-line {
  height: 14px;
  margin-bottom: var(--space-2);
}

.skeleton-line.w-full { width: 100%; }
.skeleton-line.w-3-4  { width: 75%; }
.skeleton-line.w-1-2  { width: 50%; }
.skeleton-line.w-1-4  { width: 25%; }

.skeleton-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
}

.skeleton-image {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius-md);
}

/* ============================================================
   AUTH PAGES
   ============================================================ */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  padding: var(--space-4);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-white);
  border-radius: var(--radius-xl);
  padding: var(--space-10) var(--space-8);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border-light);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.auth-logo-mark {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
}

.auth-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-1);
}

.auth-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-6) 0;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.auth-footer-text {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-6);
}

.auth-footer-text a {
  color: var(--color-accent-dark);
  font-weight: var(--font-medium);
}

.auth-footer-text a:hover {
  text-decoration: underline;
}

/* ============================================================
   DASHBOARD WIDGETS
   ============================================================ */

.widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-widget {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--color-text-primary);
  line-height: 1;
  margin-bottom: var(--space-1);
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Quick Create Widget */
.quick-create-widget {
  background: linear-gradient(135deg, var(--color-accent-light) 0%, var(--color-white) 100%);
  border: 1px solid var(--color-announcement-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-6);
  cursor: pointer;
  transition: all var(--transition-base);
}

.quick-create-widget:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.quick-create-inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.quick-create-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-accent-light);
  border: 1.5px solid var(--color-accent);
  flex-shrink: 0;
}

.quick-create-placeholder {
  flex: 1;
  height: 40px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 0 var(--space-4);
  display: flex;
  align-items: center;
  background: var(--color-white);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* ============================================================
   COMMENTS
   ============================================================ */

.comments-section {
  margin-top: var(--space-8);
}

.comment-item {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-accent-light), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-accent-dark);
  flex-shrink: 0;
}

.comment-body {
  flex: 1;
  background: var(--color-off-white);
  border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
  padding: var(--space-3) var(--space-4);
}

.comment-author {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}

.comment-text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
}

.comment-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.comment-action {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.comment-action:hover {
  color: var(--color-accent);
}

.comment-form {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.comment-input {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  background: var(--color-white);
  outline: none;
  transition: border-color var(--transition-fast);
}

.comment-input:focus {
  border-color: var(--color-accent);
}

/* ============================================================
   LANDING PAGE
   ============================================================ */

.hero-section {
  padding: var(--space-20) 0;
  text-align: center;
  background: linear-gradient(180deg, var(--color-white) 0%, var(--color-bg) 100%);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-full);
  background: var(--color-accent-light);
  color: var(--color-accent-dark);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: var(--space-6);
  border: 1px solid var(--color-announcement-border);
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: var(--font-bold);
  line-height: 1.1;
  margin-bottom: var(--space-5);
  letter-spacing: -0.02em;
}

.hero-title span {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  max-width: 540px;
  margin: 0 auto var(--space-8);
  line-height: var(--leading-relaxed);
}

.hero-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* ============================================================
   SINGLE POST
   ============================================================ */

.single-post-header {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-10) var(--space-6) var(--space-8);
}

.single-post-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--space-6) var(--space-10);
}

.single-post-content p { margin-bottom: var(--space-4); }
.single-post-content h2 { margin: var(--space-8) 0 var(--space-4); }
.single-post-content h3 { margin: var(--space-6) 0 var(--space-3); }
.single-post-content ul, .single-post-content ol {
  margin-bottom: var(--space-4);
  padding-left: var(--space-6);
  list-style: disc;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

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

@keyframes skeleton-loading {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

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

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.animate-fade-in-up {
  animation: fadeInUp 0.4s ease both;
}

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

.stagger-children > * {
  animation: fadeInUp 0.4s ease both;
}

.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 60ms; }
.stagger-children > *:nth-child(3) { animation-delay: 120ms; }
.stagger-children > *:nth-child(4) { animation-delay: 180ms; }
.stagger-children > *:nth-child(5) { animation-delay: 240ms; }
.stagger-children > *:nth-child(6) { animation-delay: 300ms; }

/* ============================================================
   UTILITIES
   ============================================================ */

.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;
}

.text-center { text-align: center; }
.text-muted  { color: var(--color-text-muted); }
.text-accent { color: var(--color-accent-dark); }
.text-sm     { font-size: var(--text-sm); }
.font-semibold { font-weight: var(--font-semibold); }

.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.gap-3 { gap: var(--space-3); }

.flex          { display: flex; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-col      { flex-direction: column; }
.flex-wrap     { flex-wrap: wrap; }

.hidden { display: none !important; }

/* ============================================================
   PRINT & REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .site-nav, .studies-sidebar, .toast-container { display: none; }
}
