/* =============================================
   CALCULATOR GRID & LUXURY UI STYLES
   (Restored for Scientific & Basic Calculators)
   ============================================= */

/* Calculator Screen Display */
.calc-display {
    background: #0f1420;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.4);
    text-align: right;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
    position: relative;
    overflow: hidden;
}

.display-mode {
    display: flex;
    gap: 10px;
    font-size: 0.75rem;
    color: #ffd700;
    font-weight: 600;
    letter-spacing: 1px;
    position: absolute;
    top: 10px;
    left: 15px;
}

.display-history {
    font-size: 1rem;
    color: var(--text-muted);
    min-height: 1.5rem;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1.5rem; /* space for mode indicators */
}

.display-main {
    font-size: 2.5rem;
    color: var(--text-main);
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    word-wrap: break-word;
    word-break: break-all;
    line-height: 1.1;
}

/* Grids */
.calc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.calc-grid-upper {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.calc-grid-lower {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

/* Key Wrappers (For Scientific) */
.calc-key-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* Secondary Labels */
.key-label-shift, .key-label-alpha {
    font-size: 0.6rem;
    font-weight: 700;
    position: absolute;
    top: -15px;
    pointer-events: none;
}

.key-label-shift {
    color: #ffd700; /* Gold */
}

.key-label-alpha {
    color: #ff3366; /* Pink/Red */
}

.key-label-shift.left-aligned {
    left: 2px;
}

.key-label-alpha {
    right: 2px;
}

/* Calculator Buttons */
.calc-key {
    background: var(--surface-2);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1.25rem;
    font-weight: 500;
    padding: 15px 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: inherit;
    user-select: none;
}

.calc-key:hover {
    background: var(--surface-3);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.calc-key:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Button Variants */
.calc-key.small-text {
    font-size: 0.85rem;
    font-weight: 600;
}

.calc-key.special {
    background: #2a3556;
    color: #a8b8d8;
}

.calc-key.special:hover {
    background: #35426b;
}

.calc-key.op {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.calc-key.op:hover {
    background: rgba(99, 102, 241, 0.25);
}

.calc-key.equal {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    border: none;
}

.calc-key.equal:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

/* Media Queries for Mobile Adjustments */
@media (max-width: 480px) {
    .calc-key {
        padding: 12px 2px;
        font-size: 1.1rem;
    }
    
    .calc-grid-upper, .calc-grid-lower {
        gap: 6px;
    }
    
    .calc-display {
        min-height: 100px;
        padding: 1rem;
    }
    
    .display-main {
        font-size: 2rem;
    }
}
