/* CSS Variables for easy theming */
:root {
    --primary-color: #4a90d9;
    --primary-dark: #3a7bc8;
    --background: #f5f7fa;
    --card-bg: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e1e5eb;
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
}

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

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

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

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
}

header h1 {
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Input Section */
.input-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-align: center;
    margin-bottom: 30px;
}

.input-section label {
    display: block;
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 15px;
}

.input-group {
    display: flex;
    justify-content: center;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

.input-group input {
    flex: 1;
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

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

.input-group button {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.input-group button:hover {
    background: var(--primary-dark);
}

.input-group button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.hint {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
}

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

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

.loading-detail {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Error */
.error {
    background: #fdf2f2;
    border: 1px solid var(--error-color);
    color: var(--error-color);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
}

/* Results */
.results {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.summary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 25px;
}

.summary h2 {
    margin-bottom: 10px;
}

.margin-info {
    opacity: 0.9;
    margin-bottom: 5px;
}

#summary-text {
    font-size: 1.1rem;
}

/* Stats Row */
.stats-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.stat-box {
    text-align: center;
    padding: 15px 30px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    min-width: 150px;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f8fafc;
    position: sticky;
    top: 0;
}

th {
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

th.right, td.right {
    text-align: right;
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

tbody tr:hover {
    background: #f8fafc;
}

.market-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.market-link:hover {
    text-decoration: underline;
}

.answer-text {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.position-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.position-yes {
    background: #d4edda;
    color: #155724;
}

.position-no {
    background: #f8d7da;
    color: #721c24;
}

.return-low {
    color: var(--error-color);
    font-weight: 600;
}

.return-very-low {
    color: var(--error-color);
    font-weight: 700;
    background: #fdf2f2;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Hide button */
.hide-cell {
    width: 30px;
    padding: 8px 4px !important;
}

.hide-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: #f0f0f0;
    color: #999;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s;
}

.hide-btn:hover {
    background: var(--error-color);
    color: white;
}

.hidden-row {
    display: none;
}

.show-all-btn {
    margin-top: 15px;
    padding: 8px 16px;
    background: white;
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    background: rgba(255,255,255,0.2);
}

.show-all-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Footer */
footer {
    margin-top: 30px;
    padding: 25px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

footer p {
    margin-bottom: 10px;
}

footer a {
    color: var(--primary-color);
}

.disclaimer {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.6rem;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .stats-row {
        flex-direction: column;
        align-items: center;
    }
    
    .stat-box {
        width: 100%;
        max-width: 200px;
    }
    
    table {
        font-size: 0.85rem;
    }
    
    th, td {
        padding: 8px 6px;
    }
    
    /* Hide some columns on mobile */
    th:nth-child(5), td:nth-child(5) {
        display: none;
    }
}
