/* Chi-Square Calculator Styles */
.chisquare-calculator {
    margin-bottom: 2rem;
}

.calc-wrapper {
    margin: 0 auto;
}

.calc-main {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    margin-bottom: 2rem;
}

.calc-header-section {
    margin-bottom: 2rem;
}

.calc-header {
    margin-bottom: 1.5rem;
}

.calc-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 0.5rem 0;
}

.calc-subtitle {
    font-size: 0.95rem;
    color: #6b7280;
    margin: 0;
}

.matrix-size-selector {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.size-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.size-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.size-btn {
    padding: 0.625rem 1.25rem;
    border: 2px solid #e5e7eb;
    background: #ffffff;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 60px;
}

.size-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
}

.size-btn.active {
    border-color: #3b82f6;
    background: #3b82f6;
    color: #ffffff;
}

.matrix-section {
    margin: 2rem 0;
}

.matrix-wrapper {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
}

.matrix-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.matrix-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.matrix-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.matrix-table th {
    background: #f3f4f6;
    padding: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e5e7eb;
}

.matrix-table td {
    padding: 0;
    border: 1px solid #e5e7eb;
    background: #ffffff;
}

.matrix-table td:first-child {
    background: #f3f4f6;
    font-weight: 600;
    color: #374151;
    font-size: 0.75rem;
    padding: 0.75rem;
    text-align: center;
}

.matrix-input {
    width: 100%;
    min-width: 80px;
    padding: 0.75rem;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #1a1a1a;
    transition: background 0.2s ease;
}

.matrix-input:focus {
    outline: none;
    background: #eff6ff;
}

.matrix-input:hover {
    background: #f9fafb;
}

.matrix-cell-readonly {
    padding: 0.75rem;
    text-align: center;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #6b7280;
    background: #f9fafb;
}

.matrix-container.readonly .matrix-table td {
    background: #f9fafb;
}

.settings-section {
    margin: 2rem 0;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 300px;
}

.setting-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.label-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #eff6ff;
    color: #3b82f6;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 700;
}

.setting-select {
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9375rem;
    color: #1a1a1a;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23374151' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.setting-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.action-section {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 160px;
    justify-content: center;
}

.primary-btn {
    background: #3b82f6;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.primary-btn:hover {
    background: #2563eb;
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

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

.secondary-btn {
    background: #ffffff;
    color: #4b5563;
    border: 2px solid #e5e7eb;
}

.secondary-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.btn-icon {
    font-size: 1.125rem;
    font-weight: 700;
}

/* Results Section */
.results-section {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    margin-top: 2rem;
    animation: slideIn 0.3s ease;
}

.results-section.hidden {
    display: none;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.results-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.results-badge.significant {
    background: #dcfce7;
    color: #166534;
}

.results-badge.not-significant {
    background: #fef3c7;
    color: #92400e;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.result-card {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

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

.result-card.primary {
    border-color: #3b82f6;
    background: #eff6ff;
}

.result-card.info {
    border-color: #06b6d4;
    background: #ecfeff;
}

.result-card.warning {
    border-color: #f59e0b;
    background: #fffbeb;
}

.result-card.success {
    border-color: #10b981;
    background: #f0fdf4;
}

.result-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0;
}

.result-card.primary .result-icon {
    background: #3b82f6;
    color: #ffffff;
}

.result-card.info .result-icon {
    background: #06b6d4;
    color: #ffffff;
}

.result-card.warning .result-icon {
    background: #f59e0b;
    color: #ffffff;
}

.result-card.success .result-icon {
    background: #10b981;
    color: #ffffff;
}

.result-content {
    flex: 1;
}

.result-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
}

.formula-section {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
    border: 1px solid #e5e7eb;
}

.formula-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.formula-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #3b82f6;
    color: #ffffff;
    border-radius: 8px;
    font-size: 1.25rem;
    font-weight: 700;
}

.formula-title {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
}

.formula-content {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
}

.formula-note {
    font-size: 0.875rem;
    color: #6b7280;
}

.expected-matrix-section,
.calculations-section {
    margin: 2rem 0;
}

.section-header {
    margin-bottom: 1rem;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 0.25rem 0;
}

.section-description {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.calculations-list {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
}

.calculation-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #ffffff;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #374151;
    border-left: 3px solid #3b82f6;
}

.calculation-item:last-child {
    margin-bottom: 0;
    font-weight: 700;
    background: #eff6ff;
    border-left-color: #2563eb;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .calc-main {
        padding: 1.5rem;
    }

    .calc-title {
        font-size: 1.5rem;
    }

    .size-options {
        gap: 0.375rem;
    }

    .size-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
        min-width: 50px;
    }

    .matrix-wrapper {
        padding: 1rem;
    }

    .matrix-table {
        font-size: 0.875rem;
    }

    .matrix-input {
        padding: 0.625rem;
        font-size: 0.875rem;
        min-width: 60px;
    }

    .action-section {
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
    }

    .results-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .result-card {
        padding: 1.25rem;
    }

    .result-value {
        font-size: 1.25rem;
    }

    .formula-content {
        font-size: 1.25rem;
    }

    .calculations-list {
        max-height: 300px;
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .calc-main {
        padding: 1rem;
    }

    .matrix-wrapper {
        padding: 0.75rem;
    }

    .matrix-table th,
    .matrix-table td:first-child {
        font-size: 0.6875rem;
        padding: 0.5rem;
    }

    .matrix-input {
        padding: 0.5rem;
        font-size: 0.8125rem;
        min-width: 50px;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .result-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
}
