/* ==========================================================================
   Social Post Studio — page-specific styles only.
   Shared UI (.card, .tool-textarea, .btn-tool, .tool-label) comes from
   tools-common.css. RTL-safe: logical properties throughout.
   ========================================================================== */

/* ── Composer ───────────────────────────────────────────────────────────── */
.sps-composer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.sps-clear {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    padding: 4px 6px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color .15s ease, background .15s ease;
}
.sps-clear:hover { color: var(--text-dark); background: var(--bg-light); }

.sps-composer .tool-textarea { min-height: 150px; resize: vertical; }

/* ── Hashtag suggestion bar ─────────────────────────────────────────────── */
.sps-tagbar {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}
.sps-tagbar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.sps-tagbar-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.sps-tagbar-title .fa-hashtag { color: var(--primary); }
.sps-inpost { font-size: 12px; font-weight: 600; color: var(--primary); }
.sps-tagbar-hint {
    font-size: 12.5px;
    color: var(--text-light);
    margin: 4px 0 12px;
    line-height: 1.5;
}
.sps-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sps-chip {
    border: 1px solid var(--border-light);
    background: var(--bg-light);
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: transform .1s ease, background .15s ease, border-color .15s ease, color .15s ease;
}
.sps-chip:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    transform: translateY(-1px);
}
.sps-chips-empty { font-size: 13px; color: var(--text-light); font-style: italic; }

/* ── Platform panels grid ───────────────────────────────────────────────── */
.sps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.sps-panel { padding: 18px; display: flex; flex-direction: column; }

.sps-panel-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.sps-badge {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--sps-accent, var(--primary));
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: lowercase;
}
.sps-panel-name { font-size: 15px; font-weight: 700; color: var(--text-dark); }
.sps-count {
    margin-inline-start: auto;
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-medium);
    white-space: nowrap;
}
.sps-count.is-warn { color: #b26a00; }
.sps-count.is-over { color: #c0261c; }

/* Meter */
.sps-meter {
    height: 6px;
    border-radius: 999px;
    background: var(--border-light);
    overflow: hidden;
    margin-bottom: 6px;
}
.sps-meter-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--primary);
    transition: width .18s ease, background .18s ease;
}
.sps-meter-fill.is-warn { background: #e39a1a; }
.sps-meter-fill.is-over { background: #d0392c; }

.sps-count-sub {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 14px;
    min-height: 15px;
}
.sps-count-sub.is-over { color: #c0261c; }

/* Preview card */
.sps-preview {
    display: flex;
    gap: 10px;
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 14px;
    flex: 1 1 auto;
}
.sps-avatar {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--sps-accent, var(--primary));
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: lowercase;
}
.sps-preview-body { min-width: 0; flex: 1 1 auto; }
.sps-preview-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 3px;
}
.sps-preview-text {
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text-medium);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.sps-preview-text .sps-hl { color: var(--primary); font-weight: 600; }
.sps-preview-empty { color: var(--text-light); font-style: italic; }

/* Footer: guidance + copy */
.sps-panel-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
}
.sps-guide {
    font-size: 12px;
    color: var(--text-light);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    line-height: 1.3;
}
.sps-guide .fa-hashtag { color: var(--primary); opacity: .8; }
.sps-copy {
    flex: 0 0 auto;
    padding: 8px 16px;
    font-size: 13px;
}
.sps-copy.is-copied { background: #1a9d5a; border-color: #1a9d5a; }
.sps-copy.is-err { background: #c0261c; border-color: #c0261c; }

/* ── Best posting times table ───────────────────────────────────────────── */
.sps-times-scroll { overflow-x: auto; }
.sps-times-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 460px;
}
.sps-times-table th,
.sps-times-table td {
    text-align: start;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-light);
}
.sps-times-table th {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-light);
    background: var(--bg-light);
}
.sps-times-table td { color: var(--text-medium); }
.sps-times-table td:first-child { font-weight: 700; color: var(--text-dark); }
.sps-times-table tbody tr:last-child td { border-bottom: none; }

@media (max-width: 560px) {
    .sps-panel-foot { flex-direction: column; align-items: stretch; }
    .sps-copy { width: 100%; justify-content: center; }
}
