/* ========================================
   BASE STYLES - Second Street Music
   Global variables, resets, and utilities
   ======================================== */

/* CSS Variables (set by global-theme.js, fallbacks provided) */
:root {
  --theme-primary: #667eea;
  --theme-primary-alt: #764ba2;
  --theme-secondary: #f093fb;
  --theme-secondary-alt: #4facfe;
  --theme-accent: #43e97b;
  --theme-accent-alt: #38f9d7;
  --theme-neutral: #ffffff;
  --theme-neutral-alt: #f8f9fa;
  --theme-success: #10b981;
  --theme-warning: #f59e0b;
  --theme-error: #ef4444;
  --theme-info: #3b82f6;
  --theme-text-on-primary: #ffffff;
  --theme-text-on-secondary: #000000;
  --theme-text-on-accent: #000000;
  --theme-text-on-neutral: #000000;
  --theme-text: #1a1a1a;
  --theme-text-secondary: #666666;
  --theme-background: #ffffff;
  --theme-surface: #f8f9fa;
  --theme-border: #e0e0e0;
}

/* Body reset */
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--theme-background);
  color: var(--theme-text);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ========================================
   SITE-WIDE NAVIGATION
   ======================================== */

/* Desktop only - Main Site Navigation */
@media (min-width: 1280px) {
  #main-site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: calc(var(--month-card-width, 416px) + 26px);
    height: 77px;
    background: var(--theme-background);
    border-bottom: 2px solid var(--theme-border);
    z-index: 1000;
    display: flex;
    align-items: stretch;
    padding: 0 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease, border-color 0.3s ease;
  }

  body.calendar-hidden #main-site-nav {
    right: 0;
  }

  .main-nav-content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
  }

  .main-nav-left {
    display: flex;
    align-items: center;
    padding: 12px 0;
  }

  .site-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--theme-text);
  }

  .main-nav-right {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
  }

  .header-btn {
    padding: 8px 16px;
    border: 2px solid var(--theme-border);
    border-radius: 6px;
    background: var(--theme-background);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--theme-text);
    transition: all 0.3s ease;
  }

  .header-btn:hover {
    background: var(--theme-surface);
    border-color: var(--theme-primary);
  }

  .section-nav-btn.active {
    background: var(--theme-primary);
    color: var(--theme-text-on-primary);
    border-color: var(--theme-primary);
  }

  .book-studio-btn {
    background: var(--theme-success);
    color: var(--theme-text-on-primary);
    border-color: var(--theme-success);
  }

  .book-studio-btn:hover {
    background: var(--theme-accent);
    border-color: var(--theme-accent);
  }

  .account-btn {
    background: var(--theme-secondary);
    color: var(--theme-text-on-secondary);
    border-color: var(--theme-secondary);
  }

  .account-btn:hover {
    background: var(--theme-secondary-alt);
    border-color: var(--theme-secondary-alt);
  }
}

/* ========================================
   CONTENT SECTION CONTAINERS
   ======================================== */

@media (min-width: 1280px) {
  /* Marketplace Container */
  #marketplace-container {
    position: fixed;
    top: 77px;
    left: 0;
    right: calc(var(--month-card-width, 416px) + 26px);
    bottom: 50vh;
    background: #f5f5f5;
    overflow-y: auto;
    z-index: 1;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1), bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  body.calendar-hidden #marketplace-container {
    right: 0;
    bottom: 0;
  }

  /* Project Tracker Container */
  #projects-container {
    position: fixed;
    top: 77px;
    left: 0;
    right: calc(var(--month-card-width, 416px) + 26px);
    bottom: 50vh;
    background: #f5f5f5;
    overflow-y: auto;
    z-index: 1;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1), bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  body.calendar-hidden #projects-container {
    right: 0;
    bottom: 0;
  }

  /* Project Tracker Content Padding */
  #projects-app {
    padding: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .project-tracker-nav {
    margin: 0;
    padding: 16px 20px;
  }

  .template-browser-header,
  .projects-header {
    margin-bottom: 20px;
  }

  .template-filters,
  .projects-actions {
    margin-bottom: 20px;
  }

  .templates-grid,
  .projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px 0;
  }

  .loading-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--theme-text-secondary);
  }

  .loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--theme-border);
    border-top-color: var(--theme-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
  }

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

  /* Calendar panel visibility */
  body.calendar-hidden #mainPanel {
    opacity: 0;
    pointer-events: none;
  }

  body:not(.calendar-hidden) #mainPanel {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ========================================
   ACCOUNT DROPDOWN
   ======================================== */

/* Account dropdown styles (site-wide) */
#account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--theme-background, white);
  border: 1px solid var(--theme-border, #e0e0e0);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 200px;
  z-index: 10000;
  overflow: hidden;
}

#account-dropdown > div {
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s;
  color: var(--theme-text, #1a1a1a);
  display: flex;
  align-items: center;
  gap: 8px;
}

#account-dropdown > div:hover {
  background: var(--theme-primary-light, rgba(102, 126, 234, 0.1));
}
