/* ===================================
   Rounding Calculator Styles
   =================================== */

/* Action Buttons Grid */
.action-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* Action Buttons */
.btn-custom,
.btn-custom-outline {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
}

.btn-custom {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-custom-outline {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-custom-outline:hover {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8edff 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.btn-custom:active,
.btn-custom-outline:active {
    transform: translateY(0);
}

/* Sponsor Button */
.btn-sponsor {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: white;
}

.btn-sponsor:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-sponsor:active {
    transform: translateY(0);
}

/* Result Display */
.result-item {
    padding: 1rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.result-item-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-item-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #667eea;
    word-break: break-all;
}

.result-item-secondary {
    font-size: 1.1rem;
    color: #888;
    margin-top: 0.5rem;
}

/* Calculation Steps */
.calculation-step {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.5);
    border-left: 4px solid #667eea;
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.calculation-step:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateX(4px);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.step-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.step-description {
    font-size: 1rem;
    color: #333;
    font-weight: 500;
}

.step-formula {
    padding: 1rem;
    background: white;
    border-radius: 6px;
    margin: 1rem 0;
    overflow-x: auto;
    text-align: center;
}

.step-result {
    font-size: 0.95rem;
    color: #48bb78;
    font-weight: 600;
    padding: 0.5rem;
    background: rgba(72, 187, 120, 0.1);
    border-radius: 6px;
    display: inline-block;
}

.steps-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.toggle-steps {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Rounding Mode Comparison */
.mode-comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.mode-card {
    padding: 1rem;
    background: white;
    border-radius: 8px;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.mode-card:hover {
    border-color: #667eea;
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.mode-card.active {
    border-color: #48bb78;
    background: linear-gradient(135deg, rgba(72, 187, 120, 0.1) 0%, rgba(72, 187, 120, 0.05) 100%);
}

.mode-name {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.mode-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

/* Batch Processing */
.batch-input-area {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    resize: vertical;
    transition: all 0.3s ease;
}

.batch-input-area:focus {
    border-color: #48bb78;
    outline: none;
    box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.1);
}

.batch-controls {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.batch-table-container {
    overflow-x: auto;
    margin-top: 1.5rem;
}

.batch-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.batch-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.batch-table th,
.batch-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.batch-table th {
    font-weight: 600;
    font-size: 0.95rem;
}

.batch-table td {
    font-size: 0.9rem;
}

.batch-table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

.batch-table tbody tr:last-child td {
    border-bottom: none;
}

/* Significant Figures Indicator */
.sig-figs-display {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    letter-spacing: 0.1em;
}

.sig-fig-digit {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    margin: 0 2px;
    background: rgba(72, 187, 120, 0.2);
    border-radius: 4px;
    font-weight: 600;
}

.non-sig-digit {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    margin: 0 2px;
    color: #999;
    opacity: 0.6;
}

/* Error Propagation Visualization */
.error-bar-container {
    position: relative;
    height: 80px;
    margin: 2rem 0;
}

.error-bar {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    background: linear-gradient(90deg,
        rgba(245, 158, 11, 0.3) 0%,
        rgba(245, 158, 11, 0.8) 50%,
        rgba(245, 158, 11, 0.3) 100%);
    border-radius: 10px;
}

.error-bar-value {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    font-weight: 600;
    color: #f59e0b;
}

.error-bar-label {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.85rem;
    color: #666;
}

/* Input Field with Tooltip */
.input-with-tooltip {
    position: relative;
}

.tooltip-icon {
    position: absolute;
    right: -30px;
    top: 50%;
    transform: translateY(-50%);
    color: #667eea;
    cursor: help;
    font-size: 1rem;
}

.tooltip-content {
    display: none;
    position: absolute;
    background: #333;
    color: white;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.5;
    width: 250px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tooltip-icon:hover + .tooltip-content,
.tooltip-content:hover {
    display: block;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
    margin-top: 1.5rem;
}

.chart-container canvas {
    max-height: 100%;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    color: #666;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-button:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Scientific Notation Display */
.scientific-notation {
    font-family: 'Times New Roman', serif;
    font-size: 1.2rem;
}

.mantissa {
    font-weight: 600;
}

.exponent {
    vertical-align: super;
    font-size: 0.8em;
}

/* Responsive Design */
@media (max-width: 992px) {
    .result-item-value {
        font-size: 1.5rem;
    }

    .mode-comparison-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .result-item-value {
        font-size: 1.3rem;
    }

    .calculation-step {
        padding: 1rem;
    }

    .step-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .steps-header {
        flex-direction: column;
        gap: 1rem;
    }

    .toggle-steps {
        width: 100%;
    }

    .mode-comparison-grid {
        grid-template-columns: 1fr;
    }

    .batch-controls {
        flex-direction: column;
    }

    .batch-controls button {
        width: 100%;
    }

    .chart-container {
        height: 250px;
    }

    .tab-button {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .action-buttons-grid {
        grid-template-columns: 1fr;
    }

    .result-item-value {
        font-size: 1.2rem;
    }

    .step-formula {
        font-size: 0.9rem;
    }

    .tooltip-content {
        width: 200px;
        font-size: 0.8rem;
    }

    .sig-figs-display {
        font-size: 1rem;
    }

    .batch-table th,
    .batch-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
}

/* Print Styles */
@media print {
    .action-buttons-grid,
    .toggle-steps,
    .batch-controls {
        display: none;
    }

    .calculation-step {
        page-break-inside: avoid;
    }

    .glass-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Loading State */
.calculating-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.calculating-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Invalid Input Highlight */
.form-input.invalid {
    border-color: #f56565;
    box-shadow: 0 0 0 3px rgba(245, 101, 101, 0.1);
}

.error-message {
    color: #f56565;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
