/* ===== Reusable Components (Light Theme) ===== */

/* --- Cards --- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-xs);
}

.card:hover {
    border-color: var(--border-default);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
}

.card-title {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.card-value {
    font-size: var(--text-3xl);
    font-weight: 700;
    font-family: var(--font-mono);
    line-height: 1.1;
    color: var(--text-primary);
}

.card-change {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-xs);
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.card-change.positive {
    color: var(--success);
    background: var(--success-bg);
}

.card-change.negative {
    color: var(--error);
    background: var(--error-bg);
}

.card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xl);
}

.card-icon.brand {
    background: var(--info-bg);
    color: var(--brand-primary);
}

.card-icon.success {
    background: var(--success-bg);
    color: var(--success);
}

.card-icon.warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.card-icon.error {
    background: var(--error-bg);
    color: var(--error);
}

.card-icon.linkedin {
    background: rgba(10, 102, 194, 0.08);
    color: var(--linkedin);
}

.card-icon.twitter {
    background: rgba(29, 155, 240, 0.08);
    color: var(--twitter);
}

.card-icon.reddit {
    background: rgba(255, 69, 0, 0.08);
    color: var(--reddit);
}

.card-icon.wordpress {
    background: rgba(33, 117, 155, 0.08);
    color: var(--wordpress);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-5);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    user-select: none;
    line-height: 1.5;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--brand-gradient);
    color: white;
    box-shadow: var(--brand-glow);
}

.btn-primary:hover {
    background: var(--brand-gradient-hover);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-default);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #047857;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #B91C1C;
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: var(--space-3) var(--space-8);
    font-size: var(--text-base);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-error {
    background: var(--error-bg);
    color: var(--error);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

.badge-neutral {
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.badge-platform {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.badge-linkedin {
    background: rgba(10, 102, 194, 0.1);
    color: var(--linkedin);
}

.badge-twitter {
    background: rgba(29, 155, 240, 0.1);
    color: var(--twitter);
}

.badge-reddit {
    background: rgba(255, 69, 0, 0.1);
    color: var(--reddit);
}

.badge-wordpress {
    background: rgba(33, 117, 155, 0.1);
    color: var(--wordpress);
}

/* --- Form Inputs --- */
.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.input-group label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.input,
.textarea,
.select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    outline: none;
    transition: all var(--transition-fast);
}

.input:focus,
.textarea:focus,
.select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input::placeholder,
.textarea::placeholder {
    color: var(--text-tertiary);
}

.textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.6;
}

.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239198AC' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* --- Toggle Switch --- */
.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    top: 2px;
    background: var(--text-tertiary);
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.toggle input:checked+.toggle-slider {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}

.toggle input:checked+.toggle-slider::before {
    transform: translateX(20px);
    background: white;
}

/* --- Status Indicator --- */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
}

.status-dot-sm {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.status-dot-sm.online {
    background: var(--success);
    box-shadow: 0 0 6px rgba(5, 150, 105, 0.4);
}

.status-dot-sm.warning {
    background: var(--warning);
    box-shadow: 0 0 6px rgba(217, 119, 6, 0.4);
}

.status-dot-sm.offline {
    background: var(--error);
    box-shadow: 0 0 6px rgba(220, 38, 38, 0.4);
}

.status-dot-sm.idle {
    background: var(--text-tertiary);
}

/* --- Table --- */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
}

.table td {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--bg-elevated);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* --- Tabs --- */
.tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--space-6);
}

.tab {
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-tertiary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    user-select: none;
}

.tab:hover {
    color: var(--text-secondary);
}

.tab.active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    max-width: 560px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.modal-header h3 {
    font-size: var(--text-xl);
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    font-size: var(--text-lg);
}

.modal-close:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* --- Toast --- */
.toast-container {
    position: fixed;
    top: var(--space-6);
    right: var(--space-6);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: var(--text-sm);
    animation: slideInRight 0.3s ease-out;
    min-width: 300px;
}

.toast-success {
    border-left: 3px solid var(--success);
}

.toast-error {
    border-left: 3px solid var(--error);
}

.toast-warning {
    border-left: 3px solid var(--warning);
}

.toast-info {
    border-left: 3px solid var(--info);
}

/* --- Empty State --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-16) var(--space-8);
    text-align: center;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    opacity: 0.25;
}

.empty-state h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.empty-state p {
    color: var(--text-tertiary);
    font-size: var(--text-sm);
    max-width: 400px;
}

/* --- Progress Bar --- */
.progress-bar {
    height: 6px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--brand-gradient);
    transition: width var(--transition-slow);
}

/* --- Avatar --- */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--brand-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.avatar-sm {
    width: 28px;
    height: 28px;
    font-size: var(--text-xs);
}

.avatar-lg {
    width: 48px;
    height: 48px;
    font-size: var(--text-lg);
}

/* --- Skeleton Loader --- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-elevated) 25%, #E2E5EC 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* --- Divider --- */
.divider {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: var(--space-6) 0;
}

/* --- Platform Icon --- */
.platform-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 700;
    flex-shrink: 0;
}

.platform-icon.linkedin {
    background: rgba(10, 102, 194, 0.1);
    color: var(--linkedin);
}

.platform-icon.twitter {
    background: rgba(29, 155, 240, 0.1);
    color: var(--twitter);
}

.platform-icon.reddit {
    background: rgba(255, 69, 0, 0.1);
    color: var(--reddit);
}

.platform-icon.wordpress {
    background: rgba(33, 117, 155, 0.1);
    color: var(--wordpress);
}

/* --- Countdown --- */
.countdown {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--brand-primary);
    background: var(--info-bg);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

/* --- Sentiment --- */
.sentiment-positive {
    color: var(--success);
}

.sentiment-neutral {
    color: var(--text-tertiary);
}

.sentiment-negative {
    color: var(--error);
}