From 0fa150507bddccde87ebebbf69ee5b504586871f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 1 Sep 2025 06:39:45 +0000 Subject: [PATCH 1/2] Initial plan From a2d93f126db6d70e309e631087ed8545217df7ed Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 1 Sep 2025 06:49:01 +0000 Subject: [PATCH 2/2] Implement modern calculator UI with professional design Co-authored-by: pkprogrammer1 <110236477+pkprogrammer1@users.noreply.github.com> --- index.html | 90 ++++++---------------------- script.js | 27 ++++++++- style.css | 170 +++++++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 184 insertions(+), 103 deletions(-) diff --git a/index.html b/index.html index 8a08438..dc730e5 100644 --- a/index.html +++ b/index.html @@ -11,78 +11,24 @@
- - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
diff --git a/script.js b/script.js index 8382250..beb5197 100644 --- a/script.js +++ b/script.js @@ -1,2 +1,27 @@ let currentDisplay = ''; -document.querySelector('#input-box').value = currentDisplay; \ No newline at end of file + +// Initialize when DOM is loaded +document.addEventListener('DOMContentLoaded', function() { + document.querySelector('#input-box').value = currentDisplay; +}); + +// Helper functions for calculator operations +function clearDisplay() { + currentDisplay = ''; + document.querySelector('#input-box').value = currentDisplay; +} + +function appendToDisplay(value) { + currentDisplay += value; + document.querySelector('#input-box').value = currentDisplay; +} + +function calculateResult() { + try { + currentDisplay = eval(currentDisplay).toString(); + document.querySelector('#input-box').value = currentDisplay; + } catch (error) { + currentDisplay = ''; + document.querySelector('#input-box').value = 'Error'; + } +} \ No newline at end of file diff --git a/style.css b/style.css index c38cfb4..e84964c 100644 --- a/style.css +++ b/style.css @@ -1,49 +1,159 @@ -*{ +/* Reset and base styles */ +* { padding: 0; margin: 0; box-sizing: border-box; - font-family: 'Roboto'; + font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif; } -#main{ + +body { + background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); + min-height: 100vh; display: flex; justify-content: center; align-items: center; - height: 100vh; } -#calculator{ - width: 300px; - height:430px; + +/* Main container */ +#main { + display: flex; + justify-content: center; + align-items: center; + min-height: 100vh; + padding: 20px; +} + +/* Calculator container */ +#calculator { + width: 320px; + background: rgba(255, 255, 255, 0.95); + backdrop-filter: blur(10px); + border-radius: 20px; + padding: 20px; + box-shadow: + 0 15px 35px rgba(0, 0, 0, 0.1), + 0 5px 15px rgba(0, 0, 0, 0.07); display: flex; flex-direction: column; - border: 2px solid black; + gap: 20px; } -button{ - width: 60px; - height: 60px; - margin: 3px; - font-size: 24px; - font-weight: 600; - flex-grow: 1; + +/* Display area */ +#input-box { + width: 100%; + height: 80px; + font-size: 2.5em; + font-weight: 300; + text-align: right; + padding: 0 20px; border: none; - background-color: rgb(232, 232, 232); + background: #f8f9fa; + border-radius: 15px; + color: #2c3e50; + outline: none; + box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1); +} + +/* Button container */ +#btn-container { + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: 12px; + padding: 0; } -#btn-container{ + +/* Base button styles */ +button { + height: 60px; + border: none; + border-radius: 15px; + font-size: 1.3em; + font-weight: 500; + cursor: pointer; + transition: all 0.2s ease; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); display: flex; - padding: 10px; - flex-wrap: wrap; - height: 100%; + align-items: center; + justify-content: center; } -#input-box{ - font-size: 38px; - padding: 16px 10px; - outline: none; + +/* Number buttons */ +button:not(.extra-btn):not(.extra-btn1) { + background: linear-gradient(145deg, #ffffff, #f0f0f0); + color: #2c3e50; +} + +button:not(.extra-btn):not(.extra-btn1):hover { + background: linear-gradient(145deg, #f8f9fa, #e9ecef); + transform: translateY(-2px); + box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15); } -.extra-btn{ - background-color: maroon; + +button:not(.extra-btn):not(.extra-btn1):active { + transform: translateY(0); + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); +} + +/* Operation buttons */ +.extra-btn1 { + background: linear-gradient(145deg, #4f46e5, #3730a3); color: white; - font-size: 30px; + font-size: 1.4em; +} + +.extra-btn1:hover { + background: linear-gradient(145deg, #5b52e8, #4338ca); + transform: translateY(-2px); + box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4); +} + +.extra-btn1:active { + transform: translateY(0); + box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3); +} + +/* Equals button */ +.extra-btn { + background: linear-gradient(145deg, #f59e0b, #d97706); + color: white; + font-size: 1.5em; + font-weight: 600; + grid-column: span 2; +} + +.extra-btn:hover { + background: linear-gradient(145deg, #fbbf24, #f59e0b); + transform: translateY(-2px); + box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4); +} + +.extra-btn:active { + transform: translateY(0); + box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3); } -.extra-btn1{ - font-size: 30px; - color: maroon; + +/* Responsive design */ +@media (max-width: 400px) { + #calculator { + width: 280px; + padding: 15px; + } + + #input-box { + height: 70px; + font-size: 2em; + } + + button { + height: 50px; + font-size: 1.1em; + } + + .extra-btn1 { + font-size: 1.2em; + } + + .extra-btn { + font-size: 1.3em; + } }