/* MAD Content Studio - Clean Light Mode UI (Recoleta & Outfit Typography) */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400..700;1,9..144,400..700&family=Outfit:wght@400;500;600;700;800;900&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Light Theme Color Palette */
  --bg-app: #F9F7F2;          /* Warm Paper Off-White */
  --bg-surface: #FFFFFF;      /* Clean White Surface */
  --bg-card: #F3EFE6;         /* Soft Cream Card */
  --bg-card-hover: #E8E2D5;
  --bg-input: #FAFAFA;
  --bg-stage-wrapper: #E5DFC8; /* Stage Background */

  /* Typography Colors (High Contrast WCAG AA) */
  --text-primary: #18181B;    /* Deep Charcoal Text */
  --text-secondary: #52525B;  /* Muted Text */
  --text-tertiary: #71717A;

  /* Borders & Shadows */
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-medium: rgba(0, 0, 0, 0.16);
  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.06);

  /* MAD Brand Accents */
  --accent-primary: #BD3717;  /* Terracotta Red */
  --accent-olive: #324D00;    /* Olive Green */
  --accent-cream: #FFF0E6;    /* Cream */
  
  /* Typography Families */
  --font-display: 'Recoleta', 'Fraunces', 'DM Serif Display', Georgia, serif;
  --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Inter', sans-serif;

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Easing */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

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

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, .font-display {
  font-family: var(--font-display);
}

.hidden {
  display: none !important;
}

/* Form Elements */
input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  outline: none;
}

input[type="text"],
input[type="password"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 9px 13px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color 0.2s var(--ease-out);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(189, 55, 23, 0.1);
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

/* Button System (Responsive & Tactile) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  transition: transform 160ms var(--ease-out), background 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent-primary);
  color: #FFFFFF;
}

.btn-primary:hover {
  background: #9E2D12;
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
}

.btn-outline {
  background: #FFFFFF;
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: #F3EFE6;
}

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

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.05);
}

.btn-danger-outline {
  background: #FFFFFF;
  border-color: rgba(220, 38, 38, 0.3);
  color: #DC2626;
}

.btn-danger-outline:hover {
  background: #FEE2E2;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
}

.btn-icon:hover {
  background: #F3EFE6;
}

/* Login Screen */
.screen-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 30%, rgba(189, 55, 23, 0.08) 0%, transparent 60%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05);
}

.brand-header {
  text-align: center;
  margin-bottom: 28px;
}

.brand-badge-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent-primary);
  background: rgba(189, 55, 23, 0.08);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(189, 55, 23, 0.2);
  margin-bottom: 12px;
}

.brand-logo {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 500;
  letter-spacing: -1px;
}

.brand-logo span {
  color: var(--accent-primary);
}

.brand-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.error-msg {
  color: #DC2626;
  font-size: 12px;
  margin-top: 12px;
  text-align: center;
}

/* App Navbar Header */
.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-navbar {
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 20;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo-sm {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
}

.brand-logo-sm span {
  color: var(--accent-primary);
}

.nav-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  background: rgba(189, 55, 23, 0.08);
  color: var(--accent-primary);
  border-radius: var(--radius-xs);
  border: 1px solid rgba(189, 55, 23, 0.2);
}

.nav-center {
  display: flex;
}

.nav-segmented-control {
  display: flex;
  background: var(--bg-card);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  gap: 2px;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms var(--ease-out), color 160ms var(--ease-out);
}

.nav-tab.active {
  background: #FFFFFF;
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Calendar View */
.view-container {
  flex: 1;
  padding: 20px;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.calendar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.calendar-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
}

.calendar-stats {
  display: flex;
  gap: 8px;
}

.stat-pill {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
}

.stat-pill span {
  font-weight: 700;
  color: var(--text-primary);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  min-height: calc(100vh - 160px);
}

.day-column {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day-header {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: center;
}

.day-name {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-tertiary);
  letter-spacing: 1px;
}

.day-date {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.post-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.post-card-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-primary);
}

.post-card-title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 10px;
  color: var(--text-tertiary);
}

/* Editor Workspace Layout */
.editor-layout {
  display: grid;
  grid-template-columns: 310px 1fr 290px;
  gap: 16px;
  height: calc(100vh - 96px);
}

.editor-sidebar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: var(--shadow-card);
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.sidebar-subtitle {
  font-size: 11px;
  color: var(--text-tertiary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Center Stage Preview Area */
.editor-main {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.preview-toolbar {
  height: 48px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
}

.carousel-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slide-counter-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 3px 10px;
  background: var(--bg-card);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

.action-buttons {
  display: flex;
  gap: 6px;
}

/* UN-SQUEEZED 100% PERFECT 4:5 INSTAGRAM STAGE SCALING */
.stage-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
  background: var(--bg-stage-wrapper);
  position: relative;
}

.stage-viewport {
  width: 1080px;
  height: 1350px;
  min-width: 1080px;
  min-height: 1350px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
  border-radius: 12px;
  overflow: hidden;
}

.stage-frame {
  width: 1080px;
  height: 1350px;
  min-width: 1080px;
  min-height: 1350px;
  flex-shrink: 0;
  border-radius: 12px;
  overflow: hidden;
}

/* Layers Toggle List */
.layers-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Figma Color Swatches Grid */
.color-swatches-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.color-swatch-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.15s var(--ease-out), border-color 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out);
  padding: 0;
  position: relative;
  background-clip: padding-box;
}

.color-swatch-btn:hover {
  transform: scale(1.2);
  border-color: var(--accent-primary);
}

.color-swatch-btn.active {
  border-color: var(--accent-primary);
  transform: scale(1.15);
  box-shadow: 0 0 0 2px rgba(189, 55, 23, 0.3);
}

.layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: var(--bg-card);
  border-radius: var(--radius-xs);
  font-size: 11px;
  border: 1px solid var(--border-subtle);
}

.layer-toggle-btn {
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 600;
  transition: color 0.15s;
}

.layer-toggle-btn:hover {
  color: var(--text-primary);
}

/* Modal Window */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  animation: modalEnter 0.2s var(--ease-out);
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 20px;
  cursor: pointer;
}

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

.file-dropzone {
  border: 2px dashed var(--border-medium);
  padding: 16px;
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  background: var(--bg-card);
  transition: border-color 0.2s;
}

.file-dropzone:hover {
  border-color: var(--accent-primary);
}

.file-dropzone input {
  display: none;
}

.validation-output {
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  max-height: 130px;
  overflow-y: auto;
}
