/* Newsletter Revenue Calculator Styles */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --bg-color: #f9fafb;
    --panel-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Container Layout */
.calculator-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.calculator-header {
    text-align: center;
    margin-bottom: 40px;
}

.calculator-header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.subtitle {
    font-size: 18px;
    color: var(--text-secondary);
}

/* Main Layout Grid */
.calculator-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1024px) {
    .calculator-layout {
        grid-template-columns: 1fr;
    }
}

/* Input Panel Styles */
.input-panel {
    background: var(--panel-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

@media (max-width: 1024px) {
    .input-panel {
        position: static;
        max-height: none;
    }
}

.input-section {
    margin-bottom: 32px;
}

.input-section:last-child {
    margin-bottom: 0;
}

.input-section h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.input-section h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--text-primary);
}

/* Form Inputs */
.input-group {
    margin-bottom: 16px;
}

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

.input-group input[type="number"],
.input-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 16px;
    transition: all 0.2s;
    background-color: var(--panel-bg);
}

.input-group input[type="number"]:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Checkboxes */
.monetization-strategies {
    margin-top: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
}

.checkbox-label span {
    flex: 1;
}

/* Calculate Button */
.calculate-btn {
    width: 100%;
    padding: 12px 24px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 24px;
}

.calculate-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

/* Results Panel */
.results-panel {
    background: var(--panel-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    min-height: 600px;
}

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

.results-header h2 {
    font-size: 24px;
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    background: var(--panel-bg);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Key Metrics */
.key-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.metric-card {
    background: var(--bg-color);
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid var(--border-color);
}

.metric-card.primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.metric-label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.metric-card.primary .metric-label {
    color: rgba(255, 255, 255, 0.9);
}

.metric-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
}

/* Chart Container */
.chart-container {
    height: 400px;
    margin-bottom: 32px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: var(--radius);
}

/* Revenue Breakdown */
.revenue-breakdown {
    margin-bottom: 32px;
}

.revenue-breakdown h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

#revenueBreakdown {
    display: grid;
    gap: 12px;
}

.revenue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-color);
    border-radius: var(--radius);
}

.revenue-item-label {
    display: flex;
    align-items: center;
    gap: 12px;
}

.revenue-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.revenue-percentage {
    font-size: 14px;
    color: var(--text-secondary);
}

.revenue-amount {
    font-weight: 600;
}

/* Insights Section */
.insights-section {
    margin-bottom: 32px;
}

.insights-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.insight-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg-color);
    border-radius: var(--radius);
}

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

.insight-text {
    font-size: 14px;
    line-height: 1.5;
}

/* Comparison Table */
.comparison-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.comparison-table th,
.comparison-table td {
    padding: 12px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.comparison-table th:first-child,
.comparison-table td:first-child {
    text-align: left;
}

.comparison-table th {
    background: var(--panel-bg);
    font-weight: 600;
    font-size: 14px;
}

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

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--panel-bg);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    position: relative;
}

.close {
    position: absolute;
    right: 16px;
    top: 16px;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
}

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

.modal h3 {
    margin-bottom: 16px;
}

.share-link-container {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.share-link-container input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: monospace;
}

.share-link-container button {
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
}

.share-link-container button:hover {
    background-color: var(--primary-hover);
}

/* Footer */
.calculator-footer {
    text-align: center;
    padding: 40px 20px 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.calculator-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.calculator-footer a:hover {
    text-decoration: underline;
}

/* Tooltips */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: var(--text-primary);
    color: white;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    margin-bottom: 8px;
}

[data-tooltip]:hover::after {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .calculator-header h1 {
        font-size: 24px;
    }
    
    .subtitle {
        font-size: 16px;
    }
    
    .key-metrics {
        grid-template-columns: 1fr 1fr;
    }
    
    .chart-container {
        height: 300px;
    }
    
    .comparison-table {
        font-size: 14px;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 8px;
    }
}