/* Sample Size Calculator - Modern Mobile-First Design */

/* Color Variables */
:root {
    --ss-primary: #6366f1;
    --ss-primary-dark: #4f46e5;
    --ss-primary-light: #818cf8;
    --ss-secondary: #f1f5f9;
    --ss-accent: #10b981;
    --ss-warning: #f59e0b;
    --ss-danger: #ef4444;
    --ss-text: #1e293b;
    --ss-text-muted: #64748b;
    --ss-border: #e2e8f0;
    --ss-bg: #ffffff;
    --ss-bg-alt: #f8fafc;
    --ss-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --ss-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --ss-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --ss-radius: 12px;
    --ss-radius-sm: 8px;
    --ss-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Main Calculator Container */
.sample-size-calculator {
    background: var(--ss-bg);
    border-radius: var(--ss-radius);
    box-shadow: var(--ss-shadow-lg);
    overflow: hidden;
    margin-bottom: 2rem;
}

/* Tab Navigation */
.calc-tabs {
    display: flex;
    background: var(--ss-bg-alt);
    border-bottom: 2px solid var(--ss-border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.calc-tabs::-webkit-scrollbar {
    display: none;
}

.calc-tab {
    flex: 1;
    min-width: 120px;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--ss-text-muted);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: var(--ss-transition);
    white-space: nowrap;
    position: relative;
}

.calc-tab:hover {
    color: var(--ss-primary);
    background: rgba(99, 102, 241, 0.05);
}

.calc-tab.active {
    color: var(--ss-primary);
    border-bottom-color: var(--ss-primary);
    background: var(--ss-bg);
}

.calc-tab-icon {
    margin-right: 0.5rem;
    font-size: 1.125rem;
}

/* Calculator Content */
.calc-content {
    padding: 2rem;
}

@media (max-width: 767px) {
    .calc-content {
        padding: 1.5rem;
    }
}

/* Study Type Selection */
.study-type-selector {
    background: var(--ss-bg-alt);
    border-radius: var(--ss-radius-sm);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--ss-border);
}

.study-type-label {
    display: block;
    font-weight: 600;
    color: var(--ss-text);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.study-type-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.study-type-option {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
    background: var(--ss-bg);
    border: 2px solid var(--ss-border);
    border-radius: var(--ss-radius-sm);
    cursor: pointer;
    transition: var(--ss-transition);
}

.study-type-option:hover {
    border-color: var(--ss-primary-light);
    background: rgba(99, 102, 241, 0.02);
}

.study-type-option input[type="radio"] {
    margin-right: 0.75rem;
    margin-top: 0.125rem;
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
    accent-color: var(--ss-primary);
}

.study-type-option input[type="radio"]:checked + .study-type-label-text {
    color: var(--ss-primary);
}

.study-type-label-text {
    flex: 1;
}

.study-type-name {
    font-weight: 600;
    color: var(--ss-text);
    margin-bottom: 0.25rem;
    display: block;
}

.study-type-desc {
    font-size: 0.875rem;
    color: var(--ss-text-muted);
    line-height: 1.5;
}

/* Input Section */
.input-section {
    display: none;
}

.input-section.active {
    display: block;
}

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

@media (max-width: 767px) {
    .input-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Form Input Styling */
.input-group {
    position: relative;
}

.input-label {
    display: block;
    font-weight: 600;
    color: var(--ss-text);
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
}

.input-field {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--ss-bg);
    border: 2px solid var(--ss-border);
    border-radius: var(--ss-radius-sm);
    font-size: 1rem;
    color: var(--ss-text);
    transition: var(--ss-transition);
}

.input-field:focus {
    outline: none;
    border-color: var(--ss-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-field:disabled {
    background: var(--ss-bg-alt);
    cursor: not-allowed;
    opacity: 0.6;
}

.input-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: var(--ss-text-muted);
    line-height: 1.4;
}

.input-field.is-invalid {
    border-color: var(--ss-danger);
}

.input-field.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.input-field.is-valid {
    border-color: var(--ss-accent);
}

.input-field.is-valid:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Select Dropdown */
.select-field {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--ss-bg);
    border: 2px solid var(--ss-border);
    border-radius: var(--ss-radius-sm);
    font-size: 1rem;
    color: var(--ss-text);
    cursor: pointer;
    transition: var(--ss-transition);
    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='%2364748b' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.select-field:focus {
    outline: none;
    border-color: var(--ss-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

@media (max-width: 767px) {
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
}

.btn {
    padding: 0.875rem 2rem;
    border-radius: var(--ss-radius-sm);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--ss-transition);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--ss-primary);
    color: white;
    flex: 1;
    min-width: 200px;
}

.btn-primary:hover {
    background: var(--ss-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--ss-shadow-md);
}

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

.btn-secondary {
    background: var(--ss-bg-alt);
    color: var(--ss-text);
    border: 2px solid var(--ss-border);
}

.btn-secondary:hover {
    background: var(--ss-border);
    border-color: var(--ss-text-muted);
}

/* Results Section */
.results-section {
    display: none;
    margin-bottom: 2rem;
    animation: fadeIn 0.3s ease-in;
}

.results-section.active {
    display: block;
}

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

.results-card {
    background: linear-gradient(135deg, var(--ss-bg) 0%, var(--ss-bg-alt) 100%);
    border: 2px solid var(--ss-primary-light);
    border-radius: var(--ss-radius);
    padding: 2rem;
    box-shadow: var(--ss-shadow-lg);
}

@media (max-width: 767px) {
    .results-card {
        padding: 1.5rem;
    }
}

.results-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ss-text);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

@media (max-width: 767px) {
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.result-item {
    background: var(--ss-bg);
    border: 1px solid var(--ss-border);
    border-radius: var(--ss-radius-sm);
    padding: 1.25rem;
    text-align: center;
    transition: var(--ss-transition);
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--ss-shadow-md);
    border-color: var(--ss-primary-light);
}

.result-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ss-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: block;
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--ss-primary);
    line-height: 1.2;
}

.result-value.success {
    color: var(--ss-accent);
}

.result-value.warning {
    color: var(--ss-warning);
}

/* Formula Display */
.formula-display {
    background: var(--ss-bg-alt);
    border-left: 4px solid var(--ss-primary);
    border-radius: var(--ss-radius-sm);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.formula-title {
    font-weight: 600;
    color: var(--ss-text);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.formula-content {
    color: var(--ss-text);
    line-height: 1.8;
    font-size: 0.9375rem;
}

/* Recommendations */
.recommendations {
    background: var(--ss-bg);
    border: 1px solid var(--ss-border);
    border-radius: var(--ss-radius-sm);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.recommendations-title {
    font-weight: 600;
    color: var(--ss-text);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.recommendations-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.recommendations-list li {
    padding: 0.5rem 0;
    color: var(--ss-text);
    font-size: 0.9375rem;
    line-height: 1.6;
    border-bottom: 1px solid var(--ss-border);
}

.recommendations-list li:last-child {
    border-bottom: none;
}

.recommendations-list strong {
    color: var(--ss-primary);
}

/* Quick Examples */
.quick-examples {
    background: var(--ss-bg-alt);
    border-radius: var(--ss-radius-sm);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--ss-border);
}

.quick-examples-title {
    font-weight: 600;
    color: var(--ss-text);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

@media (max-width: 767px) {
    .examples-grid {
        grid-template-columns: 1fr;
    }
}

.example-card {
    background: var(--ss-bg);
    border: 2px solid var(--ss-border);
    border-radius: var(--ss-radius-sm);
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--ss-transition);
}

.example-card:hover {
    border-color: var(--ss-primary);
    transform: translateY(-2px);
    box-shadow: var(--ss-shadow-md);
}

.example-name {
    font-weight: 600;
    color: var(--ss-text);
    margin-bottom: 0.25rem;
    font-size: 0.9375rem;
}

.example-desc {
    font-size: 0.8125rem;
    color: var(--ss-text-muted);
}

/* Info Alert */
.info-alert {
    background: rgba(99, 102, 241, 0.1);
    border-left: 4px solid var(--ss-primary);
    border-radius: var(--ss-radius-sm);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    color: var(--ss-text);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.info-alert strong {
    color: var(--ss-primary);
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--ss-bg);
    border: 1px solid var(--ss-border);
    border-radius: var(--ss-radius-sm);
    padding: 1rem 1.5rem;
    box-shadow: var(--ss-shadow-lg);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    max-width: 500px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid var(--ss-accent);
}

.toast.error {
    border-left: 4px solid var(--ss-danger);
}

.toast.info {
    border-left: 4px solid var(--ss-primary);
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--ss-text-muted);
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    line-height: 1;
}

.toast-close:hover {
    color: var(--ss-text);
}

@media (max-width: 767px) {
    .toast {
        right: 1rem;
        left: 1rem;
        min-width: auto;
        max-width: none;
    }
}

/* Loading State */
.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    top: 50%;
    left: 50%;
    margin-left: -0.5rem;
    margin-top: -0.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--ss-text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1rem;
}
