/* ============================================
   P2P COMPONENT STYLES
   ============================================ */

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-normal);
    position: relative;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    color: var(--color-text-inverse);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

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

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

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

.btn-danger:hover {
    background: #DC2626;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.3);
}

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

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

.btn-full {
    width: 100%;
}

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

.btn-google {
    background: white;
    border: 2px solid var(--border-color);
    color: var(--color-text-primary);
    font-weight: var(--font-weight-medium);
    gap: 12px;
}

.btn-google:hover {
    background: var(--color-bg-secondary);
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-sm);
}

.btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn.loading span {
    opacity: 0;
}

.btn.loading .btn-spinner {
    display: inline-block !important;
}

/* ── Cards ── */
.card {
    background: var(--color-bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: var(--space-lg);
    transition: all var(--transition-normal);
}

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

.post-card {
    background: var(--color-bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: var(--space-lg);
    transition: all var(--transition-normal);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.post-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    transition: all var(--transition-normal);
}

.post-card[data-category="qa"]::before {
    background: var(--color-qa);
}

.post-card[data-category="sell"]::before {
    background: var(--color-sell);
}

.post-card[data-category="buy"]::before {
    background: var(--color-buy);
}

.post-card[data-category="need"]::before {
    background: var(--color-need);
}

.post-card[data-category="lost"]::before {
    background: var(--color-lost);
}

.post-card[data-category="found"]::before {
    background: var(--color-found);
}

.post-card[data-category="teamup"]::before {
    background: var(--color-teamup);
}

.post-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-color-hover);
    transform: translateY(-2px);
}

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

.post-card-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.post-card-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-full);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    flex-shrink: 0;
}

.post-card-author {
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
}

.post-card-time {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.post-card-actions-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
    position: relative;
}

.post-card-actions-btn:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
}

.post-card-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--color-bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 100;
    padding: 4px;
    display: none;
}

.post-card-dropdown.show {
    display: block;
    animation: fadeInDown 0.15s ease;
}

.post-card-dropdown button {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: 8px 12px;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.post-card-dropdown button:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
}

.post-card-dropdown button.danger {
    color: var(--color-danger);
}

.post-card-dropdown button.danger:hover {
    background: var(--color-danger-bg);
}

/* Category Badge */
.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-badge.qa {
    background: rgba(123, 47, 246, 0.1);
    color: var(--color-qa);
}

.category-badge.sell {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-sell);
}

.category-badge.buy {
    background: rgba(59, 130, 246, 0.1);
    color: var(--color-buy);
}

.category-badge.need {
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-need);
}

.category-badge.lost {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-lost);
}

.category-badge.found {
    background: rgba(6, 182, 212, 0.1);
    color: var(--color-found);
}

.category-badge.teamup {
    background: rgba(236, 72, 153, 0.1);
    color: var(--color-teamup);
}

.post-card-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-sm);
    color: var(--color-text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-desc {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: var(--line-height-relaxed);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: var(--space-md);
}

.post-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: var(--border-radius-sm);
    margin-bottom: var(--space-md);
}

.post-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.post-card-footer-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.post-card-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.post-card-msg-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-accent);
    background: rgba(123, 47, 246, 0.08);
    border-radius: 20px;
    transition: all var(--transition-fast);
}

.post-card-msg-btn:hover {
    background: rgba(123, 47, 246, 0.15);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
}

.status-badge.active {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.status-badge.resolved {
    background: var(--color-bg-secondary);
    color: var(--color-text-muted);
}

/* ── Avatar ── */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-full);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-md);
    flex-shrink: 0;
    text-transform: uppercase;
}

.avatar.small {
    width: 32px;
    height: 32px;
    font-size: var(--font-size-sm);
}

.avatar.large {
    width: 56px;
    height: 56px;
    font-size: var(--font-size-xl);
}

/* ── Input Groups ── */
.input-group {
    margin-bottom: var(--space-md);
}

.input-group label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    margin-bottom: 6px;
}

.password-wrapper {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    padding: 4px;
}

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

.input-hint {
    display: block;
    margin-top: 6px;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.privacy-badge {
    font-size: var(--font-size-xs);
    color: var(--color-success);
    font-weight: var(--font-weight-normal);
}

.char-count {
    display: block;
    text-align: right;
    margin-top: 4px;
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

/* ── Image Upload ── */
.image-upload-area {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-md);
    padding: var(--space-xl);
    text-align: center;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.image-upload-area:hover {
    border-color: var(--color-accent);
    background: rgba(123, 47, 246, 0.02);
}

.image-upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-placeholder {
    color: var(--color-text-muted);
}

.upload-placeholder svg {
    margin: 0 auto var(--space-sm);
}

.upload-placeholder p {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
}

.upload-preview {
    max-height: 200px;
    border-radius: var(--border-radius-sm);
    margin: 0 auto;
    object-fit: contain;
}

/* ── Modals ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--color-bg-modal);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    animation: fadeIn 0.2s ease;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--color-bg-card);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

.modal.small {
    max-width: 440px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--color-bg-card);
    z-index: 1;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.modal-header h2 {
    font-size: var(--font-size-xl);
}

.modal-close-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
}

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

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

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding-top: var(--space-lg);
}

/* ── Filter Tabs ── */
.filter-tabs {
    display: flex;
    gap: var(--space-sm);
    padding-bottom: var(--space-lg);
    overflow-x: auto;
    scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
    display: none;
}

.filter-tab {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
    background: var(--color-bg-card);
    border: 1px solid var(--border-color);
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.filter-tab:hover {
    background: var(--color-bg-hover);
    border-color: var(--border-color-hover);
}

.filter-tab.active {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    color: white;
    border-color: transparent;
}

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

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--color-bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    min-width: 280px;
    max-width: 420px;
}

.toast.success {
    border-left: 4px solid var(--color-success);
}

.toast.error {
    border-left: 4px solid var(--color-danger);
}

.toast.info {
    border-left: 4px solid var(--color-info);
}

.toast.warning {
    border-left: 4px solid var(--color-warning);
}

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

.toast-message {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
}

.toast-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    border-radius: var(--border-radius-full);
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--color-bg-hover);
    color: var(--color-text-primary);
}

.toast.removing {
    animation: slideOutRight 0.3s ease forwards;
}

/* ── Empty State ── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
    color: var(--color-text-muted);
}

.empty-state svg {
    margin-bottom: var(--space-lg);
    opacity: 0.3;
}

.empty-state h3 {
    font-size: var(--font-size-xl);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-sm);
}

.empty-state p {
    max-width: 300px;
    margin-bottom: var(--space-lg);
}

/* ── Loading / Skeleton ── */
.loading-posts {
    display: grid;
    gap: var(--space-md);
}

.skeleton-card {
    background: var(--color-bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: var(--space-lg);
    height: 200px;
    position: relative;
    overflow: hidden;
}

.skeleton-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(123, 47, 246, 0.05) 50%, transparent 100%);
    animation: shimmer 1.5s infinite;
}

/* ── Auth Divider ── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin: var(--space-lg) 0;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* ── FAQ ── */
.faq-item {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    margin-bottom: var(--space-sm);
    overflow: hidden;
}

.faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: var(--space-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    text-align: left;
    color: var(--color-text-primary);
    transition: background var(--transition-fast);
}

.faq-question:hover {
    background: var(--color-bg-hover);
}

.faq-answer {
    padding: 0 var(--space-md) var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: var(--line-height-relaxed);
    display: none;
}

.faq-item.open .faq-answer {
    display: block;
}