/* 🧮 Floating Mini-Calculator Styles - Responsive Edition */
.floating-calc {
    position: fixed;
    top: 50%;
    transform: translateY(-50%) scale(var(--calc-scale, 1));
    width: 260px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    z-index: 9999;
    padding: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    font-family: 'Inter', sans-serif;
}

[data-theme="dark"] .floating-calc {
    background: rgba(30, 30, 50, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
}

.floating-calc.side-left {
    left: 20px;
    right: auto;
}

.floating-calc.side-right {
    right: 20px;
    left: auto;
}

/* Display styles */
.calc-display {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: right;
    min-height: 50px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .calc-display {
    background: rgba(255, 255, 255, 0.05);
}

.calc-prev {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    height: 1.2rem;
    overflow: hidden;
}

.calc-current {
    font-size: 2.0rem;
    font-weight: 700;
    word-break: break-all;
}

/* Grid & Buttons */
.calc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    transition: opacity 0.2s;
}

.calc-btn {
    height: 48px;
    border-radius: 12px;
    border: none;
    background: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

[data-theme="dark"] .calc-btn {
    background: rgba(255, 255, 255, 0.05);
    color: #eee;
}

.calc-btn:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.calc-btn.op {
    background: rgba(0, 123, 255, 0.1);
    color: #007bff;
}

.calc-btn.eq {
    background: #007bff;
    color: #fff;
    grid-column: span 2;
}

.calc-btn.clear {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

/* Header & Controls */
.calc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.calc-tools {
    display: flex;
    gap: 6px;
}

.tool-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: 0.2s;
}

[data-theme="dark"] .tool-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.tool-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.tool-btn.close-btn:hover {
    background: #dc3545;
    color: #fff;
}

/* 🟡 Bubble Mode (Compact) */
.floating-calc.compact {
    width: 60px;
    height: 60px;
    padding: 0;
    border-radius: 30px;
    overflow: hidden;
    cursor: pointer;
}

.floating-calc.compact .calc-header,
.floating-calc.compact .calc-display,
.floating-calc.compact .calc-grid {
    display: none;
}

.floating-calc.compact::after {
    content: '🧮';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 1.8rem;
}

/* Responsive Scaling Support */
@media (max-width: 768px) {
    .floating-calc {
        width: 240px;
        --calc-scale: 0.85;
    }

    .floating-calc.side-left {
        left: 10px;
    }

    .floating-calc.side-right {
        right: 10px;
    }
}

/* Hide on print */
@media print {
    .floating-calc {
        display: none !important;
    }
}