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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8fafc;
}

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

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 0;
    text-align: center;
    border-radius: 10px;
    margin-bottom: 40px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Market Neutral Calculator Styles */
.nav-link {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    display: inline-block;
    margin-top: 15px;
    transition: background-color 0.3s ease;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.3);
    color: white;
}

.calculator-form {
    margin-bottom: 40px;
}

.form-card {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.form-card h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 1.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.alert {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-error {
    background-color: #fee;
    color: #c53030;
    border-left: 4px solid #e53e3e;
}

.alert-success {
    background-color: #f0fff4;
    color: #2f855a;
    border-left: 4px solid #38a169;
}

.results-section {
    margin-top: 40px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

/* Hero metrics get special grid treatment */
.summary-grid.hero-metrics {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.summary-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05);
}

/* Hero metric cards get enhanced styling */
.summary-card.hero {
    padding: 35px 30px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-left: 4px solid #667eea;
}

.summary-card.important {
    padding: 30px 25px;
    border-left: 3px solid #48bb78;
}

.summary-card h3 {
    color: #555;
    font-size: 1rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2d3748;
}

/* Hero metrics - main KPIs get largest emphasis */
.metric-value.hero {
    font-size: 3.2rem;
    font-weight: 800;
    color: #1a202c;
    line-height: 1.1;
}

/* Important metrics - secondary KPIs */
.metric-value.important {
    font-size: 2.5rem;
    font-weight: 750;
    color: #2d3748;
    line-height: 1.2;
}

/* Pool composition specific styling */
.pool-composition {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pool-asset {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background-color: #f7fafc;
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

.pool-asset.usdc {
    border-left-color: #48bb78;
}

.pool-asset.crypto {
    border-left-color: #ed8936;
}

.asset-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a5568;
}

.asset-amount {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d3748;
}

/* Risk Assessment Styles */
.risk-assessment-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.risk-assessment-section h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 1.4rem;
}

/* Risk Overview Section */
.risk-overview {
    margin-bottom: 30px;
}

.risk-score-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    border-left: 6px solid;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.risk-score-card.risk-green {
    border-left-color: #48bb78;
    background: linear-gradient(135deg, #f0fff4 0%, #ffffff 100%);
}

.risk-score-card.risk-yellow {
    border-left-color: #ed8936;
    background: linear-gradient(135deg, #fffaf0 0%, #ffffff 100%);
}

.risk-score-card.risk-red {
    border-left-color: #e53e3e;
    background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
}

.risk-score-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.risk-score-header h3 {
    color: #2d3748;
    font-size: 1.3rem;
    margin: 0;
}

.risk-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.risk-badge.risk-green {
    background-color: #48bb78;
    color: white;
}

.risk-badge.risk-yellow {
    background-color: #ed8936;
    color: white;
}

.risk-badge.risk-red {
    background-color: #e53e3e;
    color: white;
}

.risk-score-value {
    font-size: 3.5rem;
    font-weight: 800;
    color: #1a202c;
    margin-bottom: 15px;
    line-height: 1;
}

.risk-recommendation {
    font-size: 1.1rem;
    color: #4a5568;
    font-weight: 500;
    line-height: 1.4;
}

/* Risk Components Grid */
.risk-components-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.risk-component {
    background: #f7fafc;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.risk-component:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.risk-component h4 {
    color: #2d3748;
    font-size: 1rem;
    margin-bottom: 12px;
    font-weight: 600;
}

.component-score {
    font-size: 2rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 10px;
    line-height: 1;
}

.component-details {
    color: #718096;
    font-size: 0.85rem;
    line-height: 1.4;
}

.component-details small {
    display: inline-block;
    margin-bottom: 2px;
}

/* Risk Details Section */
.risk-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.risk-factors,
.risk-mitigation {
    background: #f7fafc;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e2e8f0;
}

.risk-factors h4,
.risk-mitigation h4 {
    color: #2d3748;
    font-size: 1.1rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.risk-factors ul,
.risk-mitigation ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.risk-factors li,
.risk-mitigation li {
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
    color: #4a5568;
    font-size: 0.95rem;
    line-height: 1.4;
}

.risk-factors li:last-child,
.risk-mitigation li:last-child {
    border-bottom: none;
}

.risk-factors li::before {
    content: "⚠️";
    margin-right: 8px;
}

.risk-mitigation li::before {
    content: "💡";
    margin-right: 8px;
}

.options-table-container {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.options-table-container h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.4rem;
}

.table-wrapper {
    overflow-x: auto;
}

.options-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.options-table th {
    background-color: #f8f9fa;
    color: #495057;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

.header-main {
    background-color: #f8f9fa;
}

.header-no-hedge {
    background-color: #fff5f5;
    color: #c53030;
    border-left: 3px solid #e53e3e;
    border-right: 3px solid #e53e3e;
    border-top: 3px solid #e53e3e;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
}

.header-no-hedge-sub {
    background-color: #fff5f5;
    color: #c53030;
    border-left: 3px solid #e53e3e;
    border-right: 3px solid #e53e3e;
    border-bottom: 3px solid #e53e3e;
    font-weight: 600;
    font-size: 0.9rem;
}

.header-with-hedge {
    background-color: #ebf8ff;
    color: #2b6cb0;
    border-left: 3px solid #3182ce;
    border-right: 3px solid #3182ce;
    border-top: 3px solid #3182ce;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
}

.header-with-hedge-sub {
    background-color: #ebf8ff;
    color: #2b6cb0;
    border-left: 3px solid #3182ce;
    border-right: 3px solid #3182ce;
    border-bottom: 3px solid #3182ce;
    font-weight: 600;
    font-size: 0.9rem;
}

.options-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #e2e8f0;
    color: #2d3748;
}

.no-hedge-data {
    background-color: #fffaf9;
    border-left: 3px solid #e53e3e;
    border-right: 3px solid #e53e3e;
    font-weight: 600;
    position: relative;
}

.options-table tbody tr:first-child .no-hedge-data {
    border-top: 3px solid #e53e3e;
}

.options-table tbody tr:last-child .no-hedge-data {
    border-bottom: 3px solid #e53e3e;
}

.with-hedge-data {
    background-color: #f7faff;
    border-left: 3px solid #3182ce;
    border-right: 3px solid #3182ce;
    font-weight: 600;
    position: relative;
}

.options-table tbody tr:first-child .with-hedge-data {
    border-top: 3px solid #3182ce;
}

.options-table tbody tr:last-child .with-hedge-data {
    border-bottom: 3px solid #3182ce;
}

.options-table tr:hover {
    background-color: #f8f9fa;
}

.options-table tr:hover .no-hedge-data {
    background-color: #fee2e2;
}

.options-table tr:hover .with-hedge-data {
    background-color: #e6f3ff;
}

.no-options {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.no-options p {
    margin: 10px 0;
}

/* Deribit link styling */
.deribit-link {
    display: inline-block;
    font-size: 1.1rem;
    color: #667eea;
    text-decoration: none;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.deribit-link:hover {
    background-color: #f0f4ff;
    color: #5a67d8;
    transform: scale(1.1);
}

.deribit-link:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Scenario Analysis Styling */
.scenario-analysis {
    margin-top: 40px;
}

.scenario-analysis h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 1.5rem;
    text-align: center;
}

.scenario-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #e2e8f0;
}

.scenario-no-hedge {
    border-left-color: #e53e3e;
    background: linear-gradient(135deg, #fff 0%, #fff5f5 100%);
}

.scenario-card h3 {
    color: #2d3748;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.scenario-metrics {
    display: grid;
    gap: 12px;
}

.scenario-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

.scenario-metric:last-child {
    border-bottom: none;
}

.metric-label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9rem;
}

.metric-value {
    font-weight: 700;
    font-size: 1rem;
}

.metric-value.profit {
    color: #38a169;
}

.metric-value.loss {
    color: #e53e3e;
}

/* First positive PnL highlighting */
.first-positive {
    font-weight: bold !important;
    font-size: 1.1em;
    color: #1a5f1a !important;
}

footer {
    margin-top: 40px;
    padding: 20px;
    background-color: #edf2f7;
    border-radius: 10px;
    text-align: center;
    color: #666;
}

footer p {
    margin: 5px 0;
    font-size: 0.9rem;
}

footer a {
    color: #667eea;
    text-decoration: none;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .metric-value.hero {
        font-size: 2.5rem;
    }
    
    .metric-value.important {
        font-size: 2rem;
    }
    
    .summary-grid.hero-metrics {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .summary-card.hero {
        padding: 25px 20px;
    }
    
    .summary-card.important {
        padding: 20px 18px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .options-table {
        font-size: 0.8rem;
    }
    
    .options-table th,
    .options-table td {
        padding: 8px 4px;
    }
    
    .risk-assessment-section {
        padding: 20px;
    }
    
    .risk-score-value {
        font-size: 2.5rem;
    }
    
    .risk-score-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .risk-components-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .component-score {
        font-size: 1.5rem;
    }
    
    .risk-details {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .scenario-card {
        padding: 20px;
    }
    
    .scenario-metric {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

@media (max-width: 480px) {
    .metric-value.hero {
        font-size: 2.2rem;
    }
    
    .metric-value.important {
        font-size: 1.8rem;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .summary-card {
        padding: 20px 15px;
    }
    
    .pool-asset {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .asset-amount {
        font-size: 1rem;
    }
    
    .risk-score-card {
        padding: 20px;
    }
    
    .risk-score-value {
        font-size: 2rem;
    }
    
    .risk-component {
        padding: 15px;
    }
    
    .component-score {
        font-size: 1.3rem;
    }
}