/* ============================================================
   AutoPost Tabajara! — Design system
   Papel kraft + carimbos + vermelho/amarelo, sidebar escura.
   ============================================================ */

:root {
    --cream: #F4EFE6;
    --cream-2: #EAE2D3;
    --red: #E74C3C;
    --red-dark: #C0392B;
    --yellow: #F2C94C;
    --ink: #111111;
    --ink-2: #1D1D1F;
    --muted-purple: #6B6BBB;
    --white: #FFFFFF;
    --gray-text: #6E6E73;
    --gray-border: #DCD4C4;
    --green: #34C759;

    --font-display: 'Oswald', 'Arial Narrow', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

    --radius: 12px;
    --radius-lg: 18px;
    --shadow-card: 0 2px 10px rgba(17, 17, 17, 0.06);
    --shadow-modal: 0 20px 60px rgba(17, 17, 17, 0.35);
}

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

body {
    font-family: var(--font-body);
    background: var(--cream);
    color: var(--ink-2);
    line-height: 1.5;
}

.hidden {
    display: none !important;
}

button {
    font-family: inherit;
    cursor: pointer;
}

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

.muted-text {
    color: var(--gray-text);
    font-size: 14px;
}

.empty-state {
    color: var(--gray-text);
    font-size: 14px;
    padding: 12px 0;
}

/* ============================================================
   CARIMBO / LOGO "AutoPost Tabajara!"
   ============================================================ */

.stamp-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 12px;
    text-align: center;
}

.stamp-logo-top {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    color: var(--ink-2);
}

.stamp-logo-main {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--red);
    border: 3px solid var(--red);
    border-radius: 6px;
    padding: 4px 14px;
    transform: rotate(-2deg);
    text-transform: uppercase;
}

.stamp-logo-tag {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.5px;
    background: var(--ink);
    color: var(--cream);
    padding: 3px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    margin-top: 2px;
}

.stamp-logo-sm .stamp-logo-main {
    font-size: 20px;
}

/* ============================================================
   LOGIN
   ============================================================ */

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ink);
    padding: 20px;
}

.login-card {
    background: var(--cream);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    width: 100%;
    max-width: 360px;
    box-shadow: var(--shadow-modal);
}

.login-sub {
    text-align: center;
    color: var(--gray-text);
    font-size: 14px;
    margin: 8px 0 20px;
}

.field-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-2);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
}

.login-card input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--gray-border);
    border-radius: var(--radius);
    font-size: 15px;
    margin-bottom: 6px;
    background: var(--white);
}

.login-card input:focus {
    outline: none;
    border-color: var(--red);
}

.login-error {
    color: var(--red-dark) !important;
    font-weight: 600;
    font-size: 13px;
    margin: 6px 0 12px !important;
}

.btn-block {
    width: 100%;
    margin-top: 14px;
}

/* ============================================================
   BOTÕES
   ============================================================ */

.btn {
    border: none;
    border-radius: var(--radius);
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.08s ease, opacity 0.15s ease;
}

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

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

.btn-primary {
    background: var(--red);
    color: var(--white);
}

.btn-primary:hover:not(:disabled) {
    background: var(--red-dark);
}

.btn-secondary {
    background: var(--white);
    color: var(--ink-2);
    border: 2px solid var(--gray-border);
}

.btn-danger {
    background: var(--red-dark);
    color: var(--white);
}

.btn-ai {
    background: #FBF0D9;
    color: #8A6D1D;
    border: 1px solid var(--yellow);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
}

.link-btn {
    background: none;
    border: none;
    color: var(--red);
    font-weight: 600;
    font-size: 13px;
    padding: 8px 0 0;
    text-align: left;
}

/* ============================================================
   APP SHELL
   ============================================================ */

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--ink);
    color: var(--cream);
    display: flex;
    flex-direction: column;
    padding: 8px 16px 20px;
}

.sidebar .stamp-logo-top {
    color: var(--cream);
}

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 12px;
    flex: 1;
}

.side-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    color: #B8B8B8;
    font-size: 14px;
    font-weight: 500;
    padding: 11px 12px;
    border-radius: 9px;
    text-align: left;
}

.side-nav-item:hover {
    background: #1E1E1E;
    color: var(--cream);
}

.side-nav-item.active {
    background: var(--red);
    color: var(--white);
}

/* Link de volta ao site do clube (30ºS) - separado do resto da navegação */
.club-back-link {
    text-decoration: none;
    margin-top: 10px;
    border-top: 1px solid #2A2A2A;
    padding-top: 14px;
    color: #9A9A9A;
}

.club-back-link:hover {
    background: #1E1E1E;
    color: var(--cream);
}

.side-nav-icon {
    font-size: 16px;
}

.sticky-note {
    background: var(--yellow);
    color: var(--ink);
    border-radius: 4px;
    padding: 14px;
    margin-top: 16px;
    transform: rotate(-1.5deg);
    position: relative;
    font-family: var(--font-mono);
}

.sticky-note p {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    text-transform: uppercase;
}

.sticky-note-small {
    font-size: 10px !important;
    font-weight: 500 !important;
    margin-top: 2px;
}

.sticky-note-thumb {
    position: absolute;
    bottom: 8px;
    right: 10px;
    font-size: 18px;
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    min-width: 0;
    padding: 28px 36px 60px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.topbar h1 {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 700;
    color: var(--ink);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--white);
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-card);
}

/* Indicador global de processamento (topo, discreto) */
.topbar-spinner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--ink);
    color: var(--cream);
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-card);
}

.spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: var(--yellow);
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

/* Variante escura da rodinha, para usar sobre fundo claro (ex: dropzone) */
.spinner.spinner-dark {
    border: 2px solid rgba(17, 17, 17, 0.15);
    border-top-color: var(--red);
}

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

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--red);
}

.status-dot.connected {
    background: var(--green);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--cream);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 13px;
}

/* PAGES */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* CARDS */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow-card);
    margin-bottom: 20px;
}

.card h3 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.card-header-row h3 {
    margin-bottom: 0;
}

/* ============================================================
   DASHBOARD GRID
   ============================================================ */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    grid-auto-rows: min-content;
    gap: 20px;
    align-items: start;
}

/* min-width:0 impede que conteúdo largo (legendas longas sem quebra) estufe
   a coluna do grid; overflow:hidden garante o corte da legenda com "...". */
.dashboard-grid > .card {
    min-width: 0;
    overflow: hidden;
}

.dropzone-card {
    grid-column: 1;
}

.progress-card {
    grid-column: 1;
}

.next-posts-card {
    grid-column: 2;
    grid-row: 1 / 3;
}

.last-post-card {
    grid-column: 1;
}

.mini-calendar-card {
    grid-column: 2;
}

.dropzone-inner {
    border: 2px dashed var(--gray-border);
    border-radius: var(--radius);
    padding: 44px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone-inner:hover, .dropzone-inner.drag-over {
    border-color: var(--red);
    background: #FDF3F1;
}

.dropzone-icon {
    font-size: 34px;
    display: block;
    margin-bottom: 8px;
}

.dropzone-spinner {
    width: 34px;
    height: 34px;
    border-width: 3px;
    margin: 0 auto 8px;
    display: block;
}

.dropzone-text {
    font-weight: 600;
    font-size: 15px;
}

.dropzone-hint {
    color: var(--gray-text);
    font-size: 12px;
    margin-top: 4px;
}

/* PROGRESS CHECKLIST */
.progress-checklist {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-checklist li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-text);
}

.progress-checklist li.done {
    color: var(--ink-2);
}

.progress-checklist li .check {
    width: 16px;
}

/* MINI POST LIST (proximas postagens / dia do calendario) */
.mini-post-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mini-post-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    background: var(--cream);
}

.mini-post-item img {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.mini-post-item-info {
    flex: 1;
    min-width: 0;
}

.mini-post-item-caption {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-post-item-meta {
    font-size: 11px;
    color: var(--gray-text);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.status-badge.pending {
    background: #FDF0D5;
    color: #8A6D1D;
}

.status-badge.posted {
    background: #E3F6E8;
    color: #1E7B37;
}

/* LAST POST CARD */
.last-post-box {
    display: flex;
    gap: 12px;
    align-items: center;
}

.last-post-box img {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    object-fit: cover;
}

.last-post-caption {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

/* ============================================================
   CALENDÁRIO
   ============================================================ */

.mini-calendar-grid, .full-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-weekday {
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    color: var(--gray-text);
    text-transform: uppercase;
    padding-bottom: 4px;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 12px;
    position: relative;
    cursor: default;
    color: var(--ink-2);
}

.cal-day.empty {
    visibility: hidden;
}

.cal-day.today {
    background: var(--ink);
    color: var(--cream);
    font-weight: 700;
}

.cal-day.clickable {
    cursor: pointer;
}

.cal-day.clickable:hover {
    background: var(--cream-2);
}

.cal-day.selected {
    outline: 2px solid var(--red);
}

.cal-dots {
    display: flex;
    gap: 2px;
    margin-top: 2px;
}

.cal-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

.cal-dot.pending {
    background: var(--yellow);
}

.cal-dot.posted {
    background: var(--green);
}

.full-calendar-grid .cal-day {
    aspect-ratio: unset;
    height: 64px;
    align-items: flex-start;
    padding: 6px;
    border: 1px solid var(--cream-2);
}

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

/* ============================================================
   FILTROS (dashboard filters)
   ============================================================ */

.dashboard-filters {
    display: flex;
    gap: 6px;
}

.filter-btn {
    background: var(--cream);
    border: none;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-text);
}

.filter-btn.active {
    background: var(--ink);
    color: var(--cream);
}

/* ============================================================
   CONTEÚDO (galeria)
   ============================================================ */

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.content-grid-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 1;
    cursor: pointer;
}

.content-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.content-grid-item .status-badge {
    position: absolute;
    top: 6px;
    left: 6px;
}

/* ============================================================
   QUEUE LIST (histórico)
   ============================================================ */

.queue-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 10px;
    background: var(--cream);
}

.queue-item img {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.queue-item-info {
    flex: 1;
    min-width: 0;
}

.queue-item-caption {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--gray-text);
}

.queue-item-actions {
    display: flex;
    gap: 4px;
}

.queue-item-actions button {
    background: none;
    border: none;
    font-size: 16px;
    padding: 6px;
    border-radius: 8px;
}

.queue-item-actions button:hover {
    background: var(--cream-2);
}

.queue-item-error {
    color: var(--red-dark);
    font-weight: 700;
    font-size: 11px;
}

/* ============================================================
   MODAIS
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 17, 17, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-panel {
    background: var(--cream);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.new-post-modal {
    max-width: 880px;
}

.modal-panel-sm {
    max-width: 380px;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--gray-border);
    background: var(--white);
}

.modal-header h2 {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 600;
    flex: 1;
}

.modal-position {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-text);
    background: var(--cream);
    padding: 4px 10px;
    border-radius: 999px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 16px;
    color: var(--gray-text);
    padding: 4px 8px;
}

.modal-body {
    padding: 20px 22px;
    overflow-y: auto;
    flex: 1;
}

.modal-body h3 {
    font-family: var(--font-display);
    margin-bottom: 8px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 22px;
    border-top: 1px solid var(--gray-border);
    background: var(--white);
}

.new-post-modal .modal-body {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 22px;
}

.new-post-photo-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.new-post-image {
    width: 100%;
    border-radius: var(--radius);
    object-fit: cover;
    aspect-ratio: 1;
    background: var(--cream-2);
}

.exif-box {
    background: var(--white);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 12px;
    color: var(--gray-text);
}

.exif-box p {
    padding: 1px 0;
}

.new-post-fields-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.field-block textarea,
.field-block input[type="text"],
.field-block input[type="password"],
.field-block input[type="datetime-local"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--gray-border);
    border-radius: var(--radius);
    background: var(--white);
    resize: vertical;
}

.field-block textarea:focus,
.field-block input:focus {
    outline: none;
    border-color: var(--red);
}

/* MOOD CHIPS */
.mood-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.mood-chip {
    background: var(--white);
    border: 1.5px solid var(--gray-border);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-2);
}

.mood-chip:hover:not(:disabled) {
    border-color: var(--muted-purple);
}

.mood-chip.active {
    background: var(--muted-purple);
    border-color: var(--muted-purple);
    color: var(--white);
}

.mood-chip:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* HASHTAGS */
.hashtag-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.hashtag-input-row input {
    flex: 1;
    padding: 9px 12px;
    border: 2px solid var(--gray-border);
    border-radius: var(--radius);
}

.hashtag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hashtag-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #FDECEA;
    color: var(--red-dark);
    border-radius: 999px;
    padding: 4px 6px 4px 12px;
    font-size: 12px;
    font-weight: 600;
}

.hashtag-chip button {
    background: none;
    border: none;
    color: var(--red-dark);
    font-size: 14px;
    line-height: 1;
    padding: 2px 4px;
}

/* NAV ROW (anterior/proxima) */
.nav-row {
    display: flex;
    gap: 8px;
}

/* SCHEDULE MODAL */
.schedule-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.summary-label {
    font-size: 11px;
    color: var(--gray-text);
    text-transform: uppercase;
    font-weight: 600;
}

.summary-value {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
}

.freq-buttons {
    display: flex;
    gap: 8px;
}

.freq-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--gray-border);
    background: var(--white);
    border-radius: var(--radius);
    font-weight: 700;
    color: var(--ink-2);
}

.freq-btn.active {
    background: var(--muted-purple);
    border-color: var(--muted-purple);
    color: var(--white);
}

.edit-modal-body {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 16px;
}

.edit-modal-body .new-post-image {
    aspect-ratio: 1;
}

/* ============================================================
   TOASTS
   ============================================================ */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 200;
}

.toast {
    background: var(--ink);
    color: var(--cream);
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-modal);
    max-width: 320px;
    animation: toast-in 0.2s ease;
}

.toast.error {
    background: var(--red-dark);
}

.toast.success {
    background: #1E7B37;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   RESPONSIVO
   ============================================================ */

@media (max-width: 900px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        padding: 10px 14px;
        overflow-x: auto;
    }

    .sidebar .stamp-logo {
        padding: 6px;
    }

    .side-nav {
        flex-direction: row;
        margin-top: 0;
    }

    .side-nav-item span:last-child {
        display: none;
    }

    .sticky-note {
        display: none;
    }

    .main-content {
        padding: 20px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .next-posts-card {
        grid-column: 1;
        grid-row: auto;
    }

    .new-post-modal .modal-body {
        grid-template-columns: 1fr;
    }

    .edit-modal-body {
        grid-template-columns: 1fr;
    }
}
