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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #475569;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg) 0%, #1e1b4b 100%);
}

.auth-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 8px;
    font-size: 28px;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 16px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}

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

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

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

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

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.auth-switch {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

/* Dashboard */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
}

.header h1 {
    font-size: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
}

.stat-card .label {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
}

.stat-card .change {
    font-size: 13px;
    margin-top: 8px;
}

.stat-card .change.positive {
    color: var(--success);
}

.stat-card .change.negative {
    color: var(--danger);
}

/* Add Link Section */
.add-link-section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
}

.add-link-section h2 {
    margin-bottom: 16px;
    font-size: 18px;
}

.add-link-form {
    display: flex;
    gap: 12px;
}

.add-link-form input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 15px;
}

.add-link-form input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Links Table */
.links-section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
}

.links-section h2 {
    margin-bottom: 20px;
    font-size: 18px;
}

.links-table {
    width: 100%;
    border-collapse: collapse;
}

.links-table th,
.links-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.links-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13px;
    text-transform: uppercase;
}

.links-table tr:last-child td {
    border-bottom: none;
}

.platform-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.platform-facebook { background: #1877f2; }
.platform-instagram { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.platform-twitter { background: #1da1f2; }
.platform-youtube { background: #ff0000; }
.platform-tiktok { background: #000; border: 1px solid var(--border); }
.platform-linkedin { background: #0a66c2; }
.platform-unknown { background: var(--bg-input); }

.link-url {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
    font-size: 13px;
}

.metric {
    font-weight: 600;
}

.actions-cell {
    display: flex;
    gap: 8px;
}

/* Sentiment Pills */
.sentiment-pills {
    display: flex;
    gap: 8px;
}

.sentiment-pill {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.sentiment-positive { background: rgba(34, 197, 94, 0.2); color: var(--success); }
.sentiment-negative { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.sentiment-neutral { background: rgba(148, 163, 184, 0.2); color: var(--text-muted); }

/* Reports Page */
.reports-grid {
    display: grid;
    gap: 20px;
}

.report-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
}

.report-card .date {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
}

.report-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
}

.report-metric {
    text-align: center;
}

.report-metric .label {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 4px;
}

.report-metric .value {
    font-size: 24px;
    font-weight: 700;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.tab {
    padding: 10px 20px;
    background: var(--bg-input);
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

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

.tab.active {
    background: var(--primary);
    color: white;
}

/* Recent Comments */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-item {
    background: var(--bg-input);
    border-radius: 8px;
    padding: 16px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.comment-author {
    font-weight: 500;
}

.comment-text {
    color: var(--text-muted);
    line-height: 1.5;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 12px;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state h3 {
    margin-bottom: 8px;
    color: var(--text);
}

/* Nav */
.nav {
    display: flex;
    gap: 20px;
}

.nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav a:hover,
.nav a.active {
    color: var(--text);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    display: none;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h2 {
    margin-bottom: 24px;
}

.modal-close {
    float: right;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .add-link-form {
        flex-direction: column;
    }

    .header {
        flex-direction: column;
        gap: 16px;
    }

    .links-table {
        display: block;
        overflow-x: auto;
    }
}
