/* Apply box-sizing to all elements and remove default margin */
* {
    box-sizing: border-box;
    margin: 0;
}

/* Style for the body background and font */
body {
    background: linear-gradient(135deg, #0f2027 0%, #2c5364 100%);
    min-height: 100vh;
    font-family: 'Inter', 'Segoe UI', 'Roboto', Arial, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    color: #e0e6ed;
}

/* Calculator container styling */
.calculator {
    background: rgba(20, 30, 48, 0.85);
    backdrop-filter: blur(20px);
    padding: 32px 28px;
    max-width: 380px;
    width: 100%;
    border: 1px solid #222c3a;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25) 0 8px 24px rgba(0, 0, 0, 0.18);
    border-radius: 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Calculator hover effect */
.calculator:hover {
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32), 0 12px 32px rgba(0, 0, 0, 0.22);
    transform: translateY(-2px);
}

/* Result display styling */
#result {
    width: 100%;
    padding: 20px 18px;
    font-size: clamp(20px, 5vw, 32px);
    border: none;
    background: #16213e;
    color: #e0e6ed;
    font-weight: 600;
    border-radius: 16px;
    margin-bottom: 24px;
    text-align: right;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12) inset;
    transition: all 0.2s ease;
}

#result:focus {
    outline: none;
    box-shadow: 0 4px 12px rgba(44, 83, 100, 0.18) inset, 0 0 0 3px rgba(44, 83, 100, 0.18);
}

/* Button grid layout */
.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* General button styling */
button {
    padding: 20px;
    font-size: clamp(16px, 4vw, 20px);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    outline: none;
    position: relative;
    overflow: hidden;
    min-height: 60px;
    background: #1a2636;
    color: #e0e6ed;
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}

/* Button press effect */
button:active {
    transform: scale(0.95);
}

/* Button hover effect */
button:hover {
    transform: translateY(-2px);
    background: #22304a;
}

/* Clear button styling */
.clear {
    background: linear-gradient(135deg, #232526 0%, #414345 100%);
    color: #ff6b6b;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.18);
}

.clear:hover {
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.28);
    background: linear-gradient(135deg, #414345 0%, #232526 100%);
}

/* Number and decimal button styling */
.number, .decimal {
    background: linear-gradient(135deg, #1a2636 0%, #22304a 100%);
    color: #e0e6ed;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    border: 1px solid #22304a;
}

.number:hover, .decimal:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
    background: linear-gradient(135deg, #22304a 0%, #1a2636 100%);
}

/* Operator button styling */
.operator {
    background: linear-gradient(135deg, #232526 0%, #2c5364 100%);
    color: #4ecdc4;
    box-shadow: 0 4px 15px rgba(44, 83, 100, 0.28);
}

.operator:hover {
    box-shadow: 0 6px 20px rgba(44, 83, 100, 0.38);
    background: linear-gradient(135deg, #2c5364 0%, #232526 100%);
}

/* Equals button styling */
.equals {
    background: linear-gradient(135deg, #4ecdc4 0%, #22304a 100%);
    grid-row: span 3;
    color: #16213e;
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.28);
}

.equals:hover {
    box-shadow: 0 8px 25px rgba(78, 205, 196, 0.38);
    background: linear-gradient(135deg, #22304a 0%, #4ecdc4 100%);
}

/* Add ripple effect */
button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(44, 83, 100, 0.18);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

button:active::before {
    width: 100%;
    height: 100%;
}

/* Responsive breakpoints */
@media (max-width: 480px) {
    .calculator {
        padding: 24px 20px;
        max-width: 320px;
        border-radius: 20px;
    }
    .buttons {
        gap: 12px;
    }
    button {
        padding: 16px;
        border-radius: 12px;
        min-height: 50px;
    }
    #result {
        padding: 16px 14px;
        margin-bottom: 20px;
        border-radius: 12px;
    }
}

@media (max-width: 360px) {
    .calculator {
        padding: 20px 16px;
        max-width: 280px;
    }
    .buttons {
        gap: 10px;
    }
    button {
        padding: 14px;
        min-height: 45px;
    }
    #result {
        padding: 14px 12px;
        margin-bottom: 16px;
    }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    body {
        padding: 10px;
    }
    .calculator {
        padding: 20px 24px;
        max-width: 450px;
    }
    #result {
        padding: 16px 18px;
        margin-bottom: 16px;
    }
    button {
        padding: 16px;
        min-height: 45px;
    }
    .buttons {
        gap: 12px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
    .calculator {
        backdrop-filter: blur(25px);
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    button:hover {
        transform: none;
    }
    .calculator:hover {
        transform: none;
    }
}
/* Footer styling */
.footer {
    position: fixed;
    top: 50%;
    right: 24px;
    transform: translateY(-50%);
    background: rgba(20, 30, 48, 0.92);
    border-radius: 18px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.18);
    padding: 24px 20px;
    color: #e0e6ed;
    min-width: 220px;
    z-index: 100;
    text-align: center;
    font-size: 15px;
    border: 1px solid #22304a;
}

.footer p {
    margin-bottom: 12px;
    line-height: 1.6;
}

.footer a {
    color: #4ecdc4;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.footer a:hover {
    color: #ff6b6b;
    text-decoration: underline;
}

.footer button {
    background: linear-gradient(135deg, #4ecdc4 0%, #22304a 100%);
    color: #16213e;
    border: none;
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(78, 205, 196, 0.18);
    transition: background 0.2s, transform 0.2s;
}

.footer button:hover {
    background: linear-gradient(135deg, #22304a 0%, #4ecdc4 100%);
    transform: translateY(-2px);
}

@media (max-width: 900px) {
    .footer {
        position: static;
        margin-top: 32px;
        right: auto;
        top: auto;
        transform: none;
        min-width: unset;
        width: 100%;
        border-radius: 14px;
        box-shadow: 0 4px 16px rgba(0,0,0,0.14);
    }
