/* =====================================================
   SCIENTIFIC CALCULATOR STYLES
   Basic Calculator Online - Scientific Calculator
   ===================================================== */

/* ======================= SECTION ======================= */
.sci-calculator-section {
    padding: 2rem 0 4rem;
    min-height: 60vh;
}

/* ======================= CALCULATOR CARD ======================= */
.sci-calculator-card {
    background: white;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.sci-calculator-card:hover {
    box-shadow: var(--shadow-2xl);
    transform: translateY(-4px);
}

/* ======================= HEADER ======================= */
.sci-calculator-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sci-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sci-calculator-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.sci-calculator-title {
    color: white;
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
}

.sci-calculator-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8125rem;
    margin: 0.125rem 0 0;
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 0.25rem;
}

.mode-btn {
    padding: 0.5rem 0.875rem;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.mode-btn:hover {
    color: white;
}

.mode-btn.active {
    background: white;
    color: #059669;
}

/* ======================= DISPLAY ======================= */
.sci-calculator-display {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 1.5rem;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.display-expression {
    font-size: 0.9375rem;
    color: var(--text-muted);
    min-height: 1.5rem;
    text-align: right;
    word-wrap: break-word;
    overflow-wrap: break-word;
    margin-bottom: 0.5rem;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

.display-result {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.display-result.error {
    color: var(--danger);
    font-size: 1.25rem;
}

.display-info {
    position: absolute;
    top: 0.75rem;
    left: 1rem;
    right: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.memory-indicator {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.angle-mode {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-body);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

/* ======================= CALCULATOR BODY ======================= */
.sci-calculator-body {
    padding: 1rem;
    background: #f8fafc;
}

.sci-btn-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.sci-btn-row:nth-last-child(-n+5) {
    grid-template-columns: repeat(4, 1fr);
}

.sci-btn-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    margin: 0.75rem 0;
}

/* ======================= BUTTONS ======================= */
.sci-btn {
    position: relative;
    padding: 0.875rem 0.5rem;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    overflow: hidden;
}

.sci-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.sci-btn:hover::before {
    opacity: 1;
}

.sci-btn:active {
    transform: scale(0.95);
}

.btn-primary-text {
    display: block;
    line-height: 1.2;
}

.btn-secondary-text {
    display: none;
    font-size: 0.6875rem;
    opacity: 0.7;
    margin-top: 0.125rem;
}

/* Number Buttons */
.sci-btn.number {
    background: white;
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.sci-btn.number:hover {
    background: #f1f5f9;
}

/* Operator Buttons */
.sci-btn.operator {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    font-size: 1.25rem;
}

.sci-btn.operator:hover {
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

/* Function Buttons */
.sci-btn.function {
    background: #e0e7ff;
    color: #4338ca;
}

.sci-btn.function:hover {
    background: #c7d2fe;
}

/* Memory Buttons */
.sci-btn.memory {
    background: #fef3c7;
    color: #92400e;
    font-size: 0.8125rem;
}

.sci-btn.memory:hover {
    background: #fde68a;
}

/* Parenthesis Buttons */
.sci-btn.parenthesis {
    background: #f3e8ff;
    color: #7c3aed;
}

.sci-btn.parenthesis:hover {
    background: #e9d5ff;
}

/* Clear Button */
.sci-btn.clear {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.sci-btn.clear:hover {
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

/* Backspace Button */
.sci-btn.backspace {
    background: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%);
    color: #78350f;
}

.sci-btn.backspace:hover {
    background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 100%);
}

/* Decimal Button */
.sci-btn.decimal {
    background: #e2e8f0;
    color: var(--text-primary);
}

.sci-btn.decimal:hover {
    background: #cbd5e1;
}

/* Equals Button */
.sci-btn.equals {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    font-size: 1.5rem;
}

.sci-btn.equals:hover {
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

/* Second Function Mode */
.sci-calculator-card.second-mode .sci-btn.function .btn-primary-text {
    display: none;
}

.sci-calculator-card.second-mode .sci-btn.function .btn-secondary-text {
    display: block;
    font-size: 0.875rem;
}

.sci-calculator-card.second-mode #secondBtn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

/* ======================= FOOTER ======================= */
.sci-calculator-footer {
    background: white;
    padding: 0.875rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.footer-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ======================= SIDEBAR ======================= */
.sci-sidebar-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.sci-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--bg-body);
    border-bottom: 1px solid var(--border-color);
}

.sci-sidebar-header h5 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.clear-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.clear-btn:hover {
    background: #fef2f2;
    color: var(--danger);
}

.sci-sidebar-body {
    padding: 1rem 1.25rem;
    max-height: 300px;
    overflow-y: auto;
}

/* History Items */
.history-item {
    padding: 0.75rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 0.5rem;
}

.history-item:hover {
    background: var(--bg-body);
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-expression {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    word-break: break-all;
}

.history-result {
    font-size: 1.125rem;
    font-weight: 600;
    color: #059669;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.empty-state p {
    margin: 0;
    font-size: 0.875rem;
}

/* Reference Section */
.reference-body {
    max-height: none;
}

.reference-section {
    margin-bottom: 1.25rem;
}

.reference-section:last-child {
    margin-bottom: 0;
}

.reference-section h6 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.reference-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.375rem 0;
}

.ref-symbol {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    min-width: 24px;
}

.ref-value {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-family: 'SF Mono', monospace;
}

.reference-item kbd {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 32px;
    text-align: center;
}

.ref-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ======================= FEATURES SECTION ======================= */
.sci-features-section {
    padding: 4rem 0 5rem;
    background: var(--bg-body);
}

.section-header {
    margin-bottom: 3rem;
}

.section-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.section-desc {
    font-size: 1.0625rem;
    color: var(--text-muted);
    margin: 0;
}

.sci-feature-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    height: 100%;
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: all var(--transition-normal);
}

.sci-feature-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.sci-feature-card .feature-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 1rem;
}

.sci-feature-card h5 {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.sci-feature-card p {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

/* ======================= RESPONSIVE ======================= */
@media (max-width: 991.98px) {
    .sci-calculator-section {
        padding: 1.5rem 0 3rem;
    }

    .sci-btn-row {
        gap: 0.375rem;
    }

    .sci-btn {
        padding: 0.75rem 0.375rem;
        min-height: 48px;
        font-size: 0.9375rem;
    }

    .display-result {
        font-size: 2rem;
    }
}

@media (max-width: 767.98px) {
    .sci-calculator-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .sci-header-left {
        flex-direction: column;
    }

    .sci-btn-row {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 0.25rem;
    }

    .sci-btn {
        padding: 0.625rem 0.25rem;
        min-height: 44px;
        font-size: 0.875rem;
        border-radius: var(--radius-md);
    }

    .sci-btn.operator,
    .sci-btn.equals {
        font-size: 1.125rem;
    }

    .display-result {
        font-size: 1.75rem;
    }

    .display-expression {
        font-size: 0.8125rem;
    }

    .sci-calculator-body {
        padding: 0.75rem;
    }

    .sci-features-section {
        padding: 3rem 0 4rem;
    }

    .section-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 575.98px) {
    .sci-btn {
        padding: 0.5rem 0.125rem;
        min-height: 40px;
        font-size: 0.8125rem;
    }

    .sci-btn.memory {
        font-size: 0.6875rem;
    }

    .sci-btn.operator,
    .sci-btn.equals {
        font-size: 1rem;
    }

    .display-result {
        font-size: 1.5rem;
    }

    .mode-btn {
        padding: 0.375rem 0.625rem;
        font-size: 0.6875rem;
    }

    .sci-calculator-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .footer-hint {
        display: none;
    }
}

/* ======================= SCROLLBAR ======================= */
.sci-sidebar-body::-webkit-scrollbar {
    width: 6px;
}

.sci-sidebar-body::-webkit-scrollbar-track {
    background: var(--bg-body);
    border-radius: 3px;
}

.sci-sidebar-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sci-sidebar-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}