/* 
 * Basic Statistics Calculator Styles
 * Statistical & Probability Calculator
 */

/* ===== Base Styles ===== */
:root {
    --primary-color: #4a6fa5;
    --primary-light: #6a8cc9;
    --primary-dark: #345284;
    --accent-color: #ff9800;
    --accent-light: #ffb74d;
    --accent-dark: #f57c00;
    --text-dark: #333;
    --text-light: #f8f9fa;
    --bg-light: #f8f9fa;
    --bg-dark: #212529;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --border-radius: 8px;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    background-color: var(--bg-light);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ===== Page Header ===== */
.page-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 3rem 0;
    margin-bottom: 2rem;
}

.page-header h1 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.page-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
}

/* ===== Calculator Section ===== */
.calculator-and-glossary-wrapper {
    display: flex;
    flex-direction: column;
}

.calculator-section .container {
    align-items: flex-start;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 992px) {
    .calculator-section .container {
        grid-template-columns: 1fr 1fr;
    }
}

.calculator-container, .results-container {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .form-row {
        flex-direction: row;
    }
    
    .form-row .form-group {
        flex: 1;
        margin-bottom: 0;
    }
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

textarea, select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

textarea:focus, select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.2);
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 4px;
    transition: var(--transition);
    cursor: pointer;
}

.btn.primary {
    color: white;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn.primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn.secondary {
    color: var(--text-dark);
    background-color: white;
    border-color: var(--gray-300);
}

.btn.secondary:hover {
    background-color: var(--gray-100);
    border-color: var(--gray-400);
}

#calculateBtn {
    width: 100%;
}

/* ===== Mini Glossary Styles ===== */
.mini-glossary {
    background-color: #f9f9fb;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    margin: 2rem 0;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.glossary-header {
    border-bottom: 1px solid #e0e0e8;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
}

.glossary-header h3 {
    color: #3a4f6a;
    font-size: 1.4rem;
    margin: 0 0 0.5rem 0;
}

.glossary-header p {
    color: #6c757d;
    font-size: 0.95rem;
    margin: 0;
}

.glossary-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.glossary-item {
    background-color: white;
    border-left: 4px solid #4a7aff;
    border-radius: 5px;
    padding: 1rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.glossary-item h4 {
    color: #2c3e50;
    font-size: 1.1rem;
    margin: 0 0 0.5rem 0;
}

.glossary-item p {
    color: #5a6673;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0.5rem 0;
}

.glossary-item .formula {
    background-color: #f1f5fd;
    border-radius: 4px;
    color: #3a4f6a;
    font-family: 'Courier New', monospace;
    padding: 0.4rem 0.7rem;
    font-size: 0.95rem;
}

.glossary-item ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.glossary-item ul li {
    margin-bottom: 0.3rem;
    color: #5a6673;
}

.glossary-footer {
    border-top: 1px solid #e0e0e8;
    margin-top: 1.5rem;
    padding-top: 1rem;
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .glossary-content {
        grid-template-columns: 1fr;
    }
}

/* ===== Results Section ===== */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.result-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .result-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

.result-card {
    background-color: var(--gray-100);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.result-card h3 {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-300);
}

.result-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-200);
}

.result-row:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.result-label {
    font-weight: 500;
    display: flex;
    align-items: center;
}

.result-value {
    font-weight: 600;
    color: var(--gray-800);
}

/* ===== Tooltips ===== */
.tooltip-container {
    position: relative;
    display: inline-block;
    margin-left: 0.5rem;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background-color: var(--gray-500);
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    font-style: italic;
    font-weight: bold;
    cursor: help;
}

.tooltip-content {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    width: 280px;
    z-index: 100;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.3s ease;
}

.tooltip-container:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}

.tooltip-content h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.formula {
    font-family: 'Courier New', Courier, monospace;
    background-color: var(--gray-100);
    padding: 0.5rem;
    border-radius: 4px;
    margin: 0.5rem 0;
    overflow-x: auto;
}

/* ===== Chart Container ===== */
.chart-container {
    height: 300px;
    position: relative;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

/* ===== Calculation Steps ===== */
.steps-container {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-300);
}

.step-section {
    background-color: var(--gray-100);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.step-section:last-child {
    margin-bottom: 0;
}

.step-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.step-content {
    font-size: 0.95rem;
}

.step-content ul, .step-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.step-content li {
    margin-bottom: 0.5rem;
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 767px) {
    .page-header {
        padding: 2rem 0;
    }
    
    .page-header h1 {
        font-size: 2rem;
    }
    
    .calculator-container, .results-container {
        padding: 1.5rem;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    #showStepsBtn {
        width: 100%;
    }
}

/* Add utility buttons for saving/exporting data */
.utility-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-300);
}

.utility-buttons .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.utility-buttons .btn svg {
    width: 16px;
    height: 16px;
}

/* Add styles for export/save/load features */
.action-row {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.action-row select, .action-row button {
    height: 40px;
}

/* Animation for loading results */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-card {
    animation: fadeIn 0.3s ease-out forwards;
}

.result-card:nth-child(1) { animation-delay: 0.1s; }
.result-card:nth-child(2) { animation-delay: 0.2s; }
.result-card:nth-child(3) { animation-delay: 0.3s; }
.result-card:nth-child(4) { animation-delay: 0.4s; }

/* Special styling for no data message */
.no-data-message {
    text-align: center;
    padding: 2rem;
    color: var(--gray-600);
}

/* Print styles */
@media print {
    header, footer, .calculator-container, #showStepsBtn, .utility-buttons {
        display: none !important;
    }
    
    .results-container {
        display: block !important;
        box-shadow: none;
        padding: 0;
    }
    
    .page-header {
        background: none;
        padding: 1rem 0;
    }
    
    .page-header h1, .page-header p {
        color: black;
    }
}