/* Binomial Calculator Styles */
.binomial-calculator-wrapper {
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.binomial-calculator-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 30px;
    transition: box-shadow 0.3s ease;
}

.binomial-calculator-container:hover {
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
}

.calculator-title {
    color: #2c3e50;
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 25px 0;
    text-align: center;
    border-bottom: 3px solid #4A90E2;
    padding-bottom: 15px;
}

/* Form Styles */
.calculator-form {
    margin-bottom: 30px;
}

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

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

.form-group label {
    font-weight: 600;
    color: #34495e;
    margin-bottom: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #4A90E2;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    cursor: help;
    font-style: normal;
}

.form-group input,
.form-group select {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #fafafa;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4A90E2;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-group small {
    color: #7f8c8d;
    font-size: 12px;
    margin-top: 5px;
}

.form-group input:invalid {
    border-color: #e74c3c;
}

/* Button Styles */
.button-group {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
    padding: 14px 32px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 140px;
}

.btn-primary {
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(74, 144, 226, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #357ABD 0%, #2868A8 100%);
    box-shadow: 0 6px 12px rgba(74, 144, 226, 0.4);
    transform: translateY(-2px);
}

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

.btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
    border: 2px solid #bdc3c7;
}

.btn-secondary:hover {
    background: #d5dbdc;
    border-color: #95a5a6;
}

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

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4A90E2;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.loading p {
    color: #7f8c8d;
    font-size: 16px;
}

/* Error Message */
.error-message {
    background: #ffe6e6;
    border-left: 4px solid #e74c3c;
    color: #c0392b;
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
    font-weight: 500;
}

/* Results Container */
.results-container {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-container h3 {
    color: #2c3e50;
    font-size: 24px;
    margin: 0 0 20px 0;
    font-weight: 700;
}

/* Main Result Card */
.result-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 25px;
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
}

.result-card h4 {
    margin: 0 0 15px 0;
    font-size: 18px;
    opacity: 0.9;
    font-weight: 500;
}

.result-value {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.result-percentage {
    font-size: 24px;
    opacity: 0.95;
    font-weight: 600;
}

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

.stat-card {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: #4A90E2;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.15);
}

.stat-label {
    color: #7f8c8d;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    color: #2c3e50;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-card small {
    color: #95a5a6;
    font-size: 11px;
    display: block;
    margin-top: 8px;
}

/* Distribution Table */
.distribution-table {
    margin: 30px 0;
}

.distribution-table h4 {
    color: #2c3e50;
    font-size: 20px;
    margin-bottom: 15px;
    font-weight: 600;
}

.table-responsive {
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

table thead {
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    color: white;
}

table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.3px;
}

table td {
    padding: 12px 15px;
    border-bottom: 1px solid #ecf0f1;
    font-size: 14px;
}

table tbody tr:hover {
    background: #f8f9fa;
}

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

/* Visual probability bar */
.probability-bar {
    height: 20px;
    background: linear-gradient(90deg, #4A90E2 0%, #6ca9f5 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: 0 2px 4px rgba(74, 144, 226, 0.2);
}

/* Formula Card */
.formula-card {
    background: #fffef7;
    border: 2px solid #f39c12;
    border-radius: 10px;
    padding: 25px;
    margin-top: 30px;
}

.formula-card h4 {
    color: #2c3e50;
    font-size: 18px;
    margin: 0 0 15px 0;
    font-weight: 600;
}

.formula {
    font-size: 20px;
    font-weight: 600;
    color: #e67e22;
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    font-family: 'Courier New', monospace;
}

.formula-explanation {
    color: #7f8c8d;
    font-size: 14px;
    text-align: center;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .binomial-calculator-container {
        padding: 20px;
    }
    
    .calculator-title {
        font-size: 22px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
    
    .result-value {
        font-size: 36px;
    }
    
    .result-percentage {
        font-size: 20px;
    }
    
    .statistics-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    table {
        font-size: 12px;
    }
    
    table th,
    table td {
        padding: 10px 8px;
    }
}

@media (max-width: 480px) {
    .statistics-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-value {
        font-size: 24px;
    }
}

/* Print Styles */
@media print {
    .button-group,
    .calculator-form {
        display: none;
    }
    
    .binomial-calculator-container {
        box-shadow: none;
        padding: 0;
    }
    
    .results-container {
        page-break-inside: avoid;
    }
}

/* Accessibility */
*:focus {
    outline: 2px solid #4A90E2;
    outline-offset: 2px;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .binomial-calculator-container {
        background: #2c3e50;
        color: #ecf0f1;
    }
    
    .calculator-title {
        color: #ecf0f1;
    }
    
    .form-group label {
        color: #ecf0f1;
    }
    
    .form-group input,
    .form-group select {
        background: #34495e;
        color: #ecf0f1;
        border-color: #4a5f7f;
    }
    
    .stat-card {
        background: #34495e;
        border-color: #4a5f7f;
    }
    
    .stat-value,
    .stat-label {
        color: #ecf0f1;
    }
    
    table {
        background: #34495e;
    }
    
    table td {
        border-color: #4a5f7f;
    }
    
    table tbody tr:hover {
        background: #3d566e;
    }
}
