/* ==========================================
   GLOBAL STYLES & RESET
   ========================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* ==========================================
   CONTAINER
   ========================================== */

.container {
    width: 100%;
    max-width: 400px;
}

/* ==========================================
   CALCULATOR CARD
   ========================================== */

.calculator {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 25px;
    transition: transform 0.3s ease;
}

.calculator:hover {
    transform: translateY(-5px);
}

/* ==========================================
   DISPLAY SCREEN
   ========================================== */

.display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    word-wrap: break-word;
    word-break: break-all;
}

/* Previous calculation display (smaller, translucent) */
.previous-operand {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.2rem;
    min-height: 1.5rem;
    margin-bottom: 5px;
}

/* Current input display (larger, prominent) */
.current-operand {
    color: #ffffff;
    font-size: 2.5rem;
    font-weight: 300;
    min-height: 2.5rem;
}

/* ==========================================
   BUTTON GRID
   ========================================== */

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

/* ==========================================
   BUTTON STYLES
   ========================================== */

.btn {
    border: none;
    border-radius: 12px;
    font-size: 1.4rem;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Hover effect for all buttons */
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Active/pressed effect */
.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Number buttons (light gray) */
.btn-number {
    background: #f0f0f0;
    color: #333333;
}

.btn-number:hover {
    background: #e0e0e0;
}

/* Operator buttons (purple gradient) */
.btn-operator {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

.btn-operator:hover {
    background: linear-gradient(135deg, #7c8ef5 0%, #8b5bb3 100%);
}

/* Clear button (red gradient) */
.btn-clear {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #ffffff;
}

.btn-clear:hover {
    background: linear-gradient(135deg, #f5a3ff 0%, #ff677d 100%);
}

/* Equals button (green gradient) */
.btn-equals {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #ffffff;
    font-weight: 600;
}

.btn-equals:hover {
    background: linear-gradient(135deg, #5fbcff 0%, #10ffff 100%);
}

/* Span 2 columns (for wider buttons) */
.span-2 {
    grid-column: span 2;
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

/* Tablets and smaller screens */
@media (max-width: 768px) {
    .container {
        max-width: 350px;
    }

    .current-operand {
        font-size: 2rem;
    }

    .previous-operand {
        font-size: 1rem;
    }

    .btn {
        font-size: 1.2rem;
        padding: 18px;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .container {
        max-width: 100%;
    }

    .calculator {
        padding: 20px;
    }

    .current-operand {
        font-size: 1.8rem;
    }

    .previous-operand {
        font-size: 0.9rem;
    }

    .btn {
        font-size: 1.1rem;
        padding: 15px;
    }

    .buttons {
        gap: 10px;
    }
}
