/* Educational Calculators Styles by Durpal Dhurve */
/* Theme Conflict Prevention & Modern Design */

/* Reset and prevent theme interference */
.edu-calc-container,
.edu-calc-container *,
.edu-calc-container *::before,
.edu-calc-container *::after {
    box-sizing: border-box !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
}

.edu-calc-container {
    max-width: 1200px !important;
    margin: 20px auto !important;
    padding: 24px !important;
    background: #ffffff !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12) !important;
    position: relative !important;
    z-index: 1 !important;
    clear: both !important;
    overflow: hidden !important;
}

/* Reset any theme interference */
.edu-calc-container input,
.edu-calc-container select,
.edu-calc-container button,
.edu-calc-container textarea {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    margin: 0 !important;
    outline: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-weight: 500 !important;
    text-shadow: none !important;
}

/* Tab Navigation */
.edu-calc-tabs {
    display: flex;
    flex-wrap: wrap;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    border: 1px solid #dee2e6;
    border-bottom: none;
    margin-bottom: 0;
    overflow-x: auto;
}

.edu-calc-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 120px;
    text-align: center;
}

.edu-calc-tab:hover {
    background: #e9ecef;
    color: #495057;
}

.edu-calc-tab.active {
    background: #007cba;
    color: white;
    border-radius: 8px 8px 0 0;
}

/* Calculator Content */
.edu-calc-content {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0 0 8px 8px;
    padding: 30px;
    min-height: 400px;
}

.calculator-panel {
    display: none;
}

.calculator-panel.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

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

/* Form Styles */
.calc-form {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

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

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #495057;
    font-size: 14px;
}

.form-input {
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    color: #2d3748;
    line-height: 1.5;
    width: 100%;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.form-input:hover {
    border-color: #94a3b8;
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.form-select {
    padding: 14px 40px 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    color: #2d3748;
    width: 100%;
    box-sizing: border-box;
}

.form-select:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.form-select:hover {
    border-color: #94a3b8;
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.form-select option {
    padding: 12px 16px;
    background-color: #ffffff;
    color: #2d3748;
    font-weight: 500;
}

/* Dynamic Form Sections */
.dynamic-section {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    background: #f8f9fa;
}

.dynamic-section h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 16px;
}

.subject-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 15px;
    align-items: end;
    margin-bottom: 15px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.add-subject-btn, .remove-subject-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-subject-btn {
    background: #28a745;
    color: white;
    margin-top: 10px;
}

.add-subject-btn:hover {
    background: #218838;
}

.remove-subject-btn {
    background: #dc3545;
    color: white;
    padding: 8px 12px;
}

.remove-subject-btn:hover {
    background: #c82333;
}

/* Calculate Button */
.calc-btn {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 20px;
}

.calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 124, 186, 0.3);
}

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

/* Results Display */
.calc-results {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 25px;
    margin-top: 30px;
    display: none;
}

.calc-results.show {
    display: block;
    animation: slideIn 0.4s ease-out;
}

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

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #dee2e6;
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    font-weight: 600;
    color: #495057;
}

.result-value {
    font-size: 18px;
    font-weight: 700;
    color: #007cba;
}

.result-highlight {
    background: #007cba;
    color: white;
    padding: 15px;
    border-radius: 6px;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    margin: 20px 0;
}

/* Action Buttons */
.calc-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 10px 20px;
    border: 1px solid #007cba;
    background: white;
    color: #007cba;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: #007cba;
    color: white;
}

/* Error Messages */
.calc-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    margin: 10px 0;
}

/* Loading State */
.calc-loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.calc-loading.show {
    display: block;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

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

/* Success/Warning/Danger Classes */
.result-value.success,
.result-highlight.success {
    color: #28a745;
}

.result-value.warning,
.result-highlight.warning {
    color: #ffc107;
    background: #fff3cd;
}

.result-value.danger,
.result-highlight.danger {
    color: #dc3545;
    background: #f8d7da;
}

/* Enhanced Tab Styling for Mobile */
.edu-calc-tabs {
    scrollbar-width: thin;
    scrollbar-color: #007cba #f8f9fa;
}

.edu-calc-tabs::-webkit-scrollbar {
    height: 6px;
}

.edu-calc-tabs::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.edu-calc-tabs::-webkit-scrollbar-thumb {
    background: #007cba;
    border-radius: 3px;
}

.edu-calc-tabs::-webkit-scrollbar-thumb:hover {
    background: #005a87;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .edu-calc-container {
        padding: 15px;
    }
    
    .edu-calc-tabs {
        border-radius: 0;
        overflow-x: scroll;
        scrollbar-width: thin;
    }
    
    .edu-calc-tab {
        padding: 10px 12px;
        font-size: 12px;
        min-width: 90px;
        flex-shrink: 0;
    }
    
    .edu-calc-content {
        padding: 20px;
        border-radius: 0;
    }
    
    .subject-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .calc-actions {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .edu-calc-container {
        padding: 10px;
    }
    
    .edu-calc-content {
        padding: 15px;
    }
    
    .calc-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .edu-calc-tabs {
        overflow-x: scroll;
        scrollbar-width: thin;
    }
    
    .edu-calc-tabs::-webkit-scrollbar {
        height: 4px;
    }
    
    .edu-calc-tabs::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
    
    .edu-calc-tabs::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 2px;
    }
}

/* Print Styles */
@media print {
    .edu-calc-tabs,
    .calc-btn,
    .calc-actions {
        display: none !important;
    }
    
    .edu-calc-content {
        border: none;
        box-shadow: none;
    }
    
    .calc-results {
        border: 1px solid #000;
        background: white !important;
    }
}

/* Accessibility */
.calc-btn:focus,
.form-input:focus,
.form-select:focus,
.edu-calc-tab:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .edu-calc-tab.active {
        border: 2px solid #000;
    }
    
    .form-input:focus {
        border-color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .calculator-panel,
    .calc-results,
    .calc-btn,
    .form-input {
        animation: none;
        transition: none;
    }
}
