:root {
    /* Cores Material You (Tons de Roxo/Azul Google) */
    --md-sys-color-primary: #6750A4;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #EADDFF;
    --md-sys-color-on-primary-container: #21005D;
    
    --md-sys-color-background: #FDFBFF;
    --md-sys-color-surface: #F3F3FA; /* Fundo levemente cinza/roxo */
    --md-sys-color-surface-variant: #E7E0EC;
    
    --md-sys-color-outline: #79747E;
    --md-sys-color-on-surface: #1C1B1F;
    
    /* Formas */
    --shape-corner-full: 999px;
    --shape-corner-large: 28px;
    --shape-corner-medium: 16px;
    
    /* Sombras */
    --elevation-1: 0 2px 6px rgba(0,0,0,0.05);
    --elevation-3: 0 4px 20px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Outfit', sans-serif;
    color: var(--md-sys-color-on-surface);
    background: var(--md-sys-color-surface);
}

/* --- TELA DE LOGIN PREMIUM --- */
.clq-login-screen {
    height: 100%; display: flex; flex-direction: column; 
    align-items: center; justify-content: center; padding: 24px;
    background: linear-gradient(135deg, #FDFBFF 0%, #EADDFF 100%);
}
.clq-login-card {
    width: 100%; max-width: 400px;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(20px);
    padding: 40px 24px;
    border-radius: 32px;
    box-shadow: var(--elevation-3);
}
.clq-brand-large {
    text-align: center; margin-bottom: 32px;
}
.clq-brand-large img { width: 64px; margin-bottom: 12px; }
.clq-brand-large h1 { margin: 0; font-size: 1.5rem; color: var(--md-sys-color-primary); }

/* Inputs Material */
.md-input-group { position: relative; margin-bottom: 24px; }
.md-input {
    width: 100%; padding: 16px; border: 1px solid var(--md-sys-color-outline);
    border-radius: 8px; background: transparent; font-size: 1rem;
    transition: 0.2s;
}
.md-input:focus { border-color: var(--md-sys-color-primary); border-width: 2px; outline: none; }
.md-label {
    position: absolute; left: 14px; top: 16px; background: transparent;
    padding: 0 4px; color: var(--md-sys-color-outline); font-size: 1rem;
    pointer-events: none; transition: 0.2s;
}
.md-input:focus ~ .md-label,
.md-input:not(:placeholder-shown) ~ .md-label {
    top: -10px; font-size: 0.75rem; background: #fff; color: var(--md-sys-color-primary); font-weight: 600;
}

/* Botões */
.md-btn {
    width: 100%; padding: 16px; border: none; border-radius: 100px;
    font-size: 1rem; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: transform 0.1s;
}
.md-btn:active { transform: scale(0.98); }
.md-filled {
    background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary);
    box-shadow: var(--elevation-1);
}
.md-tonal {
    background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container);
}
.md-text {
    background: transparent; color: var(--md-sys-color-primary);
    width: auto; padding: 8px 16px;
}

/* --- APP SHELL (Layout Principal) --- */
.clq-app-view {
    height: 100vh; display: flex; flex-direction: column;
    overflow: hidden; position: relative;
}

/* Header */
.clq-top-bar {
    height: 64px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px; background: var(--md-sys-color-surface);
    position: sticky; top: 0; z-index: 10;
}
.clq-back-btn {
    width: 40px; height: 40px; border-radius: 50%; border: none; background: transparent;
    display: flex; align-items: center; justify-content: center; color: var(--md-sys-color-on-surface);
    cursor: pointer; opacity: 0; pointer-events: none; transition: 0.2s;
}
.clq-back-btn.visible { opacity: 1; pointer-events: all; }
.clq-app-title { font-size: 1.25rem; font-weight: 500; }
.clq-avatar-mini {
    width: 32px; height: 32px; background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700;
}

/* Main Content Area */
.clq-content-area {
    flex: 1; overflow-y: auto; padding: 16px; padding-bottom: 100px;
    scroll-behavior: smooth;
}

/* Views (Tabs) */
.clq-view { display: none; animation: fadeIn 0.3s ease; }
.clq-view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Bottom Navigation (Instagram Style) */
.clq-bottom-nav {
    height: 80px; background: var(--md-sys-color-background);
    border-top: 1px solid var(--md-sys-color-surface-variant);
    display: flex; justify-content: space-around; align-items: center;
    padding-bottom: 16px; /* Safe area */
    position: fixed; bottom: 0; width: 100%; z-index: 20;
}
.clq-nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border: none; background: transparent; color: var(--md-sys-color-outline);
    gap: 4px; cursor: pointer; flex: 1;
}
.clq-nav-icon {
    width: 64px; height: 32px; border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
}
.clq-nav-label { font-size: 0.75rem; font-weight: 600; }

.clq-nav-item.active .clq-nav-icon {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}
.clq-nav-item.active .clq-nav-label { color: var(--md-sys-color-on-surface); }

/* --- COMPONENTES DAS PÁGINAS --- */

/* Home: Card de Criação */
.clq-create-card {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border-radius: var(--shape-corner-large);
    padding: 24px; text-align: center;
    margin-bottom: 24px;
    display: flex; flex-direction: column; align-items: center;
}
.clq-fab {
    width: 56px; height: 56px; border-radius: 16px;
    background: var(--md-sys-color-primary); color: #fff;
    border: none; box-shadow: var(--elevation-3);
    display: flex; align-items: center; justify-content: center;
    margin-top: 16px; cursor: pointer;
}

/* Galeria: Grid */
.clq-gallery-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.clq-gallery-item {
    aspect-ratio: 1; background: #ddd; border-radius: 12px;
    position: relative; overflow: hidden;
}
.clq-gallery-item img { width: 100%; height: 100%; object-fit: cover; }

/* Conta: Lista */
.clq-list-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px; background: #fff; border-radius: 16px;
    margin-bottom: 8px; cursor: pointer;
}
.clq-list-icon { margin-right: 16px; color: var(--md-sys-color-primary); }

/* --- WIZARD / EDITOR (Slide Over) --- */
.clq-wizard-overlay {
    position: fixed; inset: 42px 0 0 0; background: #fff; z-index: 50;
    transform: translateY(100%); transition: transform 0.4s cubic-bezier(0.2, 0, 0, 1);
    display: flex; flex-direction: column;
}
.clq-wizard-overlay.open { transform: translateY(0); }

.clq-wizard-header {
    padding: 16px; display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #eee;
}
.clq-wizard-body { flex: 1; padding: 24px; overflow-y: auto; }

/* Canvas Area no Wizard */
.clq-canvas-area {
    background: #F3F3FA; border-radius: 24px; aspect-ratio: 1;
    display: flex; align-items: center; justify-content: center;
    border: 2px dashed #ccc; margin-bottom: 24px;
}

/* ===== Header global fino e fixo (logo 16:9 centralizada) ===== */
.clq-global-header{
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 42px;
  background: var(--md-sys-color-surface);
  z-index: 999;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.clq-global-header__inner{
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
}
.clq-global-header__logo{
  height: 70px;
  width: auto;
  max-width: 80vw;
  object-fit: contain;
  aspect-ratio: 16 / 9;
}
.clq-global-header__text{
  font-weight: 600;
  letter-spacing: .2px;
  opacity: .9;
}

/* Empurra o app para baixo sem alterar layout interno */
.clq-app-view{ padding-top: 42px; }


/* ===== Home: card 'Criar novo post' ajustes (sem alterar identidade visual) ===== */
.clq-create-card{ padding-top: 18px; }

/* FAB 30% menor */
.clq-fab{
  width: 44px !important;
  height: 44px !important;
  border-radius: 14px !important;
}
.clq-fab .material-icons-round{
  font-size: 22px !important;
  line-height: 22px !important;
}


/* Toast simples (não altera UI base) */
.clq-toast{
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%) translateY(12px);
  background: rgba(0,0,0,.86);
  color: #fff;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  max-width: 86vw;
  text-align: center;
}
.clq-toast.show{
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* Loading state for 'Criar Mágica' button (subtle blink) */
@keyframes clqBlink {
  0% { opacity: 1; }
  50% { opacity: .55; }
  100% { opacity: 1; }
}
.md-btn.clq-btn-loading{
  animation: clqBlink 0.9s ease-in-out infinite;
  cursor: not-allowed;
}


.clq-magic-icon{ margin-left:8px; }


/* Magic button: deterministic states (no DOM text rewriting) */
#clqDoMagic .clq-magic-loading{ display:none; }
#clqDoMagic.clq-magic-is-loading .clq-magic-idle,
#clqDoMagic.clq-magic-is-loading .clq-magic-icon{ display:none; }
#clqDoMagic.clq-magic-is-loading .clq-magic-loading{ display:inline; }

#clqDoMagic.clq-magic-is-locked .clq-magic-idle,
#clqDoMagic.clq-magic-is-locked .clq-magic-icon,
#clqDoMagic.clq-magic-is-locked .clq-magic-loading{ display:none; }
#clqDoMagic.clq-magic-is-locked::after{
  content: attr(data-clq-locked-msg);
}

/* spacing for icon */
#clqDoMagic .clq-magic-icon{ margin-left:8px; }


/* CLQ_CLICKFIX_092: ensure account list items are tappable */
.clq-list-item, .clq-list-item * { pointer-events: auto; }
.clq-list-item { cursor: pointer; -webkit-tap-highlight-color: rgba(0,0,0,0.08); }
