/**
 * ================================================================================
 * CO-READIT - Monetization Page Styles
 * ================================================================================
 */

/* ========== PAGE LAYOUT ========== */
.monetization-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 0;
}

.monetization-container {
    background: var(--card-bg, #ffffff);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.monetization-header {
    padding: 1px 10px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.monetization-header h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: var(--text-primary, #1f2937);
}

.monetization-header .page-icon {
    width: 28px;
    height: 28px;
    opacity: 0.8;
}

.monetization-subtitle {
    color: var(--text-secondary, #6b7280);
    margin: 0;
    font-size: 14px;
}

/* ========== DISABLED NOTICE ========== */
.monetization-disabled-notice {
    padding: 48px 24px;
    text-align: center;
}

.monetization-disabled-notice h3 {
    margin: 16px 0 8px;
    color: var(--text-primary, #1f2937);
}

.monetization-disabled-notice p {
    color: var(--text-secondary, #6b7280);
    margin: 0;
}

/* ========== ELIGIBILITY SECTION ========== */
.monetization-eligibility {
    padding: 32px 24px;
}

.eligibility-header {
    text-align: center;
    margin-bottom: 32px;
}

.eligibility-header h2 {
    margin: 16px 0 8px;
    color: var(--text-primary, #1f2937);
    font-size: 20px;
}

.eligibility-header p {
    color: var(--text-secondary, #6b7280);
    margin: 0;
    font-size: 14px;
}

.eligibility-requirements {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 500px;
    margin: 0 auto;
}

.requirement {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    background: var(--bg-secondary, #f9fafb);
}

.requirement.met {
    background: rgba(16, 185, 129, 0.1);
}

.requirement.not-met {
    background: rgba(239, 68, 68, 0.05);
}

.requirement-icon {
    font-size: 20px;
    font-weight: bold;
    width: 24px;
    text-align: center;
}

.requirement.met .requirement-icon {
    color: #10b981;
}

.requirement.not-met .requirement-icon {
    color: #ef4444;
}

.requirement-info {
    flex: 1;
}

.requirement-info strong {
    display: block;
    color: var(--text-primary, #1f2937);
    margin-bottom: 4px;
}

.requirement-info span {
    font-size: 13px;
    color: var(--text-secondary, #6b7280);
}

.requirement .progress-bar {
    margin-top: 8px;
    height: 6px;
    background: var(--border-color, #e5e7eb);
    border-radius: 3px;
    overflow: hidden;
}

.requirement .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #10b981);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.eligibility-tip {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 12px 16px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
    font-size: 13px;
    color: #3b82f6;
}

/* ========== DASHBOARD ========== */
.monetization-dashboard {
    padding: 5px;
}

.monetization-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 5px;
    margin-bottom: 5px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-secondary, #f9fafb);
    border-radius: 12px;
}

.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.stat-card .stat-icon img {
    width: 24px;
    height: 24px;
    opacity: 0.8;
}

.stat-balance .stat-icon {
    background: rgba(16, 185, 129, 0.15);
}

.stat-paid .stat-icon {
    background: rgba(59, 130, 246, 0.15);
}

.stat-impressions .stat-icon {
    background: rgba(139, 92, 246, 0.15);
}

.stat-rate .stat-icon {
    background: rgba(245, 158, 11, 0.15);
}

.stat-info {
    flex: 1;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary, #1f2937);
}

/* ========== PAYOUT INFO ========== */
.payout-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 13px;
    color: #059669;
}

/* ========== CHART SECTION ========== */
.monetization-chart-section {
    margin-bottom: 32px;
}

.monetization-chart-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px;
    color: var(--text-primary, #1f2937);
}

.chart-period-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.period-tab {
    padding: 8px 16px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    background: var(--card-bg, #fff);
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.period-tab:hover {
    background: var(--bg-secondary, #f9fafb);
}

.period-tab.active {
    background: var(--primary-color, #ff4500);
    color: white;
    border-color: var(--primary-color, #ff4500);
}

.chart-container {
    min-height: 200px;
    background: var(--bg-secondary, #f9fafb);
    border-radius: 12px;
    padding: 24px;
}

.chart-loading,
.chart-empty,
.chart-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    color: var(--text-secondary, #6b7280);
    font-size: 14px;
}

/* Simple Bar Chart */
.simple-bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 4px;
    height: 180px;
    padding-top: 20px;
    overflow-x: auto;
    min-width: 0;
}

.chart-bar-group {
    flex: 1 0 auto;
    min-width: 30px;
    max-width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.chart-bar {
    width: 100%;
    max-width: 40px;
    min-width: 20px;
    background: linear-gradient(180deg, #10b981, #059669);
    border-radius: 4px 4px 0 0;
    position: relative;
    transition: height 0.3s ease;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.chart-bar-value {
    position: absolute;
    top: -20px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    white-space: nowrap;
}

.chart-bar-label {
    margin-top: 8px;
    font-size: 10px;
    color: var(--text-secondary, #6b7280);
    text-align: center;
}

/* ========== TOP POSTS ========== */
.monetization-top-posts h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px;
    color: var(--text-primary, #1f2937);
}

.top-posts-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.top-posts-tab {
    padding: 8px 16px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    background: var(--card-bg, #fff);
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.top-posts-tab:hover {
    background: var(--bg-secondary, #f9fafb);
}

.top-posts-tab.active {
    background: var(--primary-color, #ff4500);
    color: white;
    border-color: var(--primary-color, #ff4500);
}

.top-posts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.posts-loading,
.posts-empty,
.posts-error {
    padding: 32px;
    text-align: center;
    color: var(--text-secondary, #6b7280);
    font-size: 14px;
}

.top-post-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary, #f9fafb);
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s;
}

.top-post-item:hover {
    background: var(--border-color, #e5e7eb);
}

.post-rank {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-color, #ff4500);
    min-width: 30px;
}

.post-info {
    flex: 1;
    min-width: 0;
}

.post-title {
    color: var(--text-primary, #1f2937);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
}

.post-impressions {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary, #6b7280);
}

.post-earnings {
    color: #10b981;
    font-weight: 600;
}

/* ========== ERROR STATE ========== */
.monetization-error,
.error-state {
    padding: 48px 24px;
    text-align: center;
}

.monetization-error p,
.error-state p {
    color: var(--text-secondary, #6b7280);
    margin-bottom: 16px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 640px) {
    .monetization-page {
        padding: 1px;
    }

    .monetization-stats {
        grid-template-columns: repeat(1, 1fr);
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
        padding: 12px;
    }

    .chart-period-tabs,
    .top-posts-tabs {
        flex-wrap: wrap;
    }

    .period-tab,
    .top-posts-tab {
        flex: 1;
        text-align: center;
    }

    .simple-bar-chart {
        height: 150px;
    }

    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* ========== DARK MODE ========== */
[data-theme="dark"] .monetization-container {
    background: var(--card-bg, #1f2937);
}

[data-theme="dark"] .stat-card {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .requirement {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .requirement.met {
    background: rgba(16, 185, 129, 0.15);
}

[data-theme="dark"] .requirement.not-met {
    background: rgba(239, 68, 68, 0.1);
}

[data-theme="dark"] .chart-container {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .top-post-item {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .top-post-item:hover {
    background: rgba(255, 255, 255, 0.1);
}
