/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: var(--text-sm);
    transition: all var(--transition-fast);
    white-space: nowrap;
    border: 1px solid transparent;
}

.btn--primary {
    background: var(--brand-gradient);
    color: #fff;
    border: none;
}

.btn--primary:hover {
    opacity: 0.9;
    box-shadow: var(--shadow-glow-purple);
}

.btn--secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
}

.btn--secondary:hover {
    background: var(--bg-elevated);
}

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

.btn--ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn--danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn--danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn--sm {
    padding: 4px 10px;
    font-size: var(--text-xs);
}

.btn--lg {
    padding: 12px 24px;
    font-size: var(--text-base);
}

.btn--icon {
    padding: 8px;
    border-radius: var(--radius-sm);
}

/* ---- Cards ---- */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
}

.card--hover:hover {
    border-color: var(--border-default);
    box-shadow: var(--shadow-md);
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.card__title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
}

/* ---- Badges / Tags ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
}

.badge--draft { background: rgba(107, 103, 128, 0.15); color: var(--status-draft); }
.badge--scheduled { background: rgba(245, 158, 11, 0.15); color: var(--status-scheduled); }
.badge--published { background: rgba(16, 185, 129, 0.15); color: var(--status-published); }
.badge--failed { background: rgba(239, 68, 68, 0.15); color: var(--status-failed); }

.badge--twitter { background: rgba(29, 161, 242, 0.15); color: var(--platform-twitter); }
.badge--facebook { background: rgba(24, 119, 242, 0.15); color: var(--platform-facebook); }
.badge--instagram { background: rgba(228, 64, 95, 0.15); color: var(--platform-instagram); }
.badge--linkedin { background: rgba(10, 102, 194, 0.15); color: var(--platform-linkedin); }
.badge--tiktok { background: rgba(255, 0, 80, 0.15); color: var(--platform-tiktok); }
.badge--youtube { background: rgba(255, 0, 0, 0.15); color: var(--platform-youtube); }

/* ---- Form Inputs ---- */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--text-sm);
    transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--brand-purple);
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-tertiary);
}

/* ---- Stat Card ---- */
.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
}

.stat-card__label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: var(--space-xs);
}

.stat-card__value {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card__trend {
    font-size: var(--text-xs);
    margin-top: var(--space-xs);
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-card__trend--up { color: var(--accent-green); }
.stat-card__trend--down { color: var(--accent-red); }

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-tertiary);
}

.empty-state__icon {
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state__title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

/* ---- Modal ---- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 150ms ease;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 200ms ease;
}

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

.modal__title {
    font-size: var(--text-lg);
    font-weight: 600;
}

.modal__close {
    color: var(--text-tertiary);
    padding: 4px;
}

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

.modal__body {
    padding: var(--space-lg);
}

.modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-lg);
    border-top: 1px solid var(--border-subtle);
}

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    box-shadow: var(--shadow-md);
    animation: slideIn 200ms ease;
    min-width: 280px;
}

.toast--success { border-left: 3px solid var(--accent-green); }
.toast--error { border-left: 3px solid var(--accent-red); }
.toast--info { border-left: 3px solid var(--brand-cyan); }

/* ---- Tabs ---- */
.tabs {
    display: flex;
    gap: var(--space-xs);
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--space-lg);
}

.tab {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-tertiary);
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
}

.tab:hover {
    color: var(--text-secondary);
}

.tab--active {
    color: var(--brand-purple);
    border-bottom-color: var(--brand-purple);
}

/* ---- Platform Icon ---- */
.platform-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 700;
    color: #fff;
}

.platform-icon--twitter { background: var(--platform-twitter); }
.platform-icon--facebook { background: var(--platform-facebook); }
.platform-icon--instagram { background: var(--platform-instagram); }
.platform-icon--linkedin { background: var(--platform-linkedin); }
.platform-icon--tiktok { background: var(--platform-tiktok); }
.platform-icon--youtube { background: var(--platform-youtube); }

/* ---- Animations ---- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---- Checkbox ---- */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand-purple);
    cursor: pointer;
}

/* ---- Avatar ---- */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--brand-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.avatar--lg { width: 40px; height: 40px; font-size: var(--text-sm); }

/* ---- Grid Helpers ---- */
.grid { display: grid; gap: var(--space-md); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid--4 { grid-template-columns: repeat(2, 1fr); }
    .grid--3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .grid--4, .grid--3, .grid--2 { grid-template-columns: 1fr; }
}
