
/* =====================================================
   SMARTCALCULATOR
   File: style.css
   Version: 2.3.0
   Developer: Sajan Khadka
   ===================================================== */


/* =====================================================
   1. ROOT VARIABLES
   ===================================================== */

:root {
    color-scheme: light;

    --primary: #159b50;
    --primary-dark: #087a3c;
    --primary-light: #d9f8e5;

    --background: #c2f8c2;
    --surface: #f7f8fb;
    --surface-secondary: #ffffff;

    --text: #292b30;
    --text-secondary: #777b80;
    --text-muted: #9ca3af;

    --border: rgba(0, 0, 0, 0.07);

    --shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    --shadow-small: 0 3px 12px rgba(0, 0, 0, 0.06);

    --radius: 14px;
    --radius-large: 24px;

    --transition: all .25s ease;
}


/* =====================================================
   2. DARK THEME
   ===================================================== */

body.dark-theme {
    color-scheme: dark;

    --background: #101512;
    --surface: #17191a;
    --surface-secondary: #292c30;

    --text: #ffffff;
    --text-secondary: #a4a8ac;
    --text-muted: #777f83;

    --border: rgba(255, 255, 255, 0.08);

    --shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    --shadow-small: 0 3px 12px rgba(0, 0, 0, 0.2);

    --primary-light: rgba(21, 155, 80, .18);
}


/* =====================================================
   3. RESET
   ===================================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    min-height: 100dvh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    background: var(--background);
    color: var(--text);

    font-family: Inter, "Segoe UI", Arial, sans-serif;

    transition: background .25s, color .25s;

    -webkit-font-smoothing: antialiased;
}

button,
input,
select {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

.hidden {
    display: none !important;
}


/* =====================================================
   4. MAIN LAYOUT
   ===================================================== */

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

.calculator {
    width: 100%;
    min-height: 720px;

    padding: 18px 25px 20px;

    display: flex;
    flex-direction: column;

    background: var(--surface);

    border-radius: 32px;

    box-shadow: var(--shadow);

    position: relative;

    transition: background .25s;
}


/* =====================================================
   5. HEADER
   ===================================================== */

.calculator-header {
    position: relative;
    z-index: 20;
}

.status-bar {
    display: flex;
    justify-content: flex-start;
    align-items: center;

    height: 24px;

    font-size: 14px;
    font-weight: 600;
}

.toolbar {
    height: 48px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.icon-btn {
    width: 38px;
    height: 38px;

    border: none;
    border-radius: 10px;

    background: transparent;
    color: var(--text);

    font-size: 25px;

    cursor: pointer;

    transition: var(--transition);
}

.icon-btn:hover {
    background: var(--border);
}

.toolbar-center {
    display: flex;
    gap: 28px;
}

.toolbar-tab {
    width: 34px;
    height: 34px;

    border: none;
    border-radius: 8px;

    background: transparent;
    color: var(--text-secondary);

    font-size: 20px;

    cursor: pointer;

    transition: var(--transition);
}

.toolbar-tab.active {
    background: var(--primary);
    color: #fff;
}

.toolbar-tab:hover {
    color: var(--primary);
}

.toolbar-tab.active:hover {
    color: #fff;
}


/* =====================================================
   6. THREE DOT MENU
   ===================================================== */

.menu-container {
    position: relative;
}

.menu-trigger {
    font-weight: 700;
    font-size: 27px;
}

.dropdown-menu {
    position: absolute;

    top: 45px;
    right: 0;

    width: 225px;

    padding: 8px;

    background: var(--surface-secondary);

    border: 1px solid var(--border);
    border-radius: 15px;

    box-shadow: 0 12px 35px rgba(0, 0, 0, .16);

    z-index: 100;

    animation: menuOpen .2s ease;
}

@keyframes menuOpen {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-item {
    width: 100%;

    display: flex;
    align-items: center;
    gap: 12px;

    padding: 12px;

    border: none;
    border-radius: 9px;

    background: transparent;
    color: var(--text);

    text-align: left;
    font-size: 14px;

    cursor: pointer;

    transition: var(--transition);
}

.menu-item span {
    width: 22px;

    color: var(--primary);

    font-size: 18px;
    text-align: center;
}

.menu-item:hover {
    background: var(--border);
    color: var(--primary);
}

.menu-divider {
    height: 1px;

    background: var(--border);

    margin: 6px 4px;
}

.menu-version {
    padding: 8px 12px;

    color: var(--text-secondary);
    font-size: 11px;
}


/* =====================================================
   7. VIEW SYSTEM
   ===================================================== */

.app-view {
    flex: 1;
    min-width: 0;

    animation: viewFade .2s ease;
}

@keyframes viewFade {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin: 28px 0 22px;
}

.page-heading h2 {
    font-size: 25px;
}

.page-heading p {
    margin-top: 5px;

    color: var(--text-secondary);
    font-size: 13px;
}


/* =====================================================
   8. STANDARD CALCULATOR DISPLAY
   ===================================================== */

.display {
    min-height: 225px;

    padding: 45px 4px 20px;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;

    overflow: hidden;
}

.expression {
    width: 100%;
    min-height: 40px;

    text-align: right;

    color: var(--text-secondary);
    font-size: 21px;

    white-space: nowrap;
    overflow-x: auto;
}

.result {
    width: 100%;

    margin-top: 10px;

    text-align: right;

    font-size: 37px;
    font-weight: 700;

    white-space: nowrap;
    overflow-x: auto;
}


/* =====================================================
   9. STANDARD KEYPAD
   ===================================================== */

.keypad {
    display: grid;

    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(5, 57px);

    gap: 14px 13px;

    padding-top: 12px;
}

.key {
    border: 1px solid var(--border);
    border-radius: var(--radius);

    font-size: 25px;
    font-weight: 500;

    cursor: pointer;

    transition: transform .12s, background .2s;
}

.key:hover {
    filter: brightness(.97);
}

.key:active {
    transform: scale(.93);
}

.number,
.utility {
    background: var(--surface-secondary);
    color: var(--text);

    box-shadow: 0 2px 7px rgba(0, 0, 0, .05);
}

.utility {
    color: var(--text-secondary);
    font-weight: 600;
}

.operator {
    background: var(--primary);
    color: #fff;

    border: none;

    font-weight: 700;
}

.operator:hover,
.equals:hover {
    background: var(--primary-dark);
}

.equals {
    grid-column: 4;
    grid-row: 4 / span 2;

    background: #079b49;
    color: #fff;

    border: none;

    font-size: 29px;

    box-shadow: 0 7px 20px rgba(0, 160, 70, .3);
}

.special {
    background: transparent;
    border: none;

    color: var(--primary);

    font-weight: 700;
}


/* =====================================================
   10. SCIENTIFIC CALCULATOR VIEW
   ===================================================== */

.scientific-view {
    padding-top: 20px;
    padding-bottom: 15px;
}

.scientific-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 12px;

    margin: 18px 0 15px;
}

.scientific-heading h2 {
    font-size: 21px;
    font-weight: 750;

    color: var(--text);
}

.scientific-heading p {
    margin-top: 5px;

    color: var(--text-secondary);

    font-size: 11px;
}

.scientific-back-btn {
    width: 39px;
    height: 39px;

    flex-shrink: 0;

    border: 1px solid var(--border);
    border-radius: 11px;

    background: var(--primary-light);
    color: var(--primary-dark);

    font-size: 23px;

    transition: var(--transition);
}

body.dark-theme .scientific-back-btn {
    color: #35db80;
}

.scientific-back-btn:hover {
    background: var(--primary);
    color: white;

    transform: translateX(-3px);
}


/* =====================================================
   11. SCIENTIFIC DISPLAY
   ===================================================== */

.scientific-display {
    min-height: 135px;

    padding: 20px 15px;

    margin-bottom: 14px;

    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;

    background: var(--surface-secondary);

    border: 1px solid var(--border);
    border-radius: 16px;

    overflow: hidden;
}

.scientific-expression {
    width: 100%;
    min-height: 30px;

    color: var(--text-secondary);

    font-size: 16px;
    text-align: right;

    overflow-wrap: anywhere;
}

.scientific-result {
    width: 100%;

    margin-top: 8px;

    color: var(--primary);

    font-size: 31px;
    font-weight: 750;

    text-align: right;

    overflow-wrap: anywhere;
}


/* =====================================================
   12. SCIENTIFIC ANGLE TOOLBAR
   ===================================================== */

.scientific-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 10px;

    margin-bottom: 13px;
}

.angle-switch {
    display: flex;
    align-items: center;

    gap: 4px;

    padding: 4px;

    background: var(--surface-secondary);

    border: 1px solid var(--border);
    border-radius: 9px;
}

.angle-btn {
    min-width: 47px;

    padding: 7px 10px;

    border: none;
    border-radius: 7px;

    background: transparent;
    color: var(--text-secondary);

    font-size: 10px;
    font-weight: 800;

    transition: var(--transition);
}

.angle-btn.active {
    background: var(--primary);
    color: white;
}

.scientific-mode-label {
    color: var(--text-muted);

    font-size: 9px;
    font-weight: 800;

    letter-spacing: 1px;
}


/* =====================================================
   13. SCIENTIFIC KEYPAD
   ===================================================== */

.scientific-keypad {
    display: grid;

    grid-template-columns: repeat(5, minmax(0, 1fr));

    gap: 8px;
}

.sci-key {
    min-width: 0;
    min-height: 49px;

    padding: 5px 2px;

    display: flex;
    justify-content: center;
    align-items: center;

    border: 1px solid var(--border);
    border-radius: 10px;

    font-size: 13px;
    font-weight: 650;

    cursor: pointer;

    user-select: none;

    transition: var(--transition);
}

.sci-key:hover {
    transform: translateY(-2px);
}

.sci-key:active {
    transform: scale(.94);
}


/* SCIENTIFIC FUNCTION BUTTONS */

.sci-function {
    background: var(--surface-secondary);

    color: var(--primary-dark);
}

body.dark-theme .sci-function {
    color: #42d985;
}

.sci-function:hover {
    background: var(--primary-light);
}


/* SCIENTIFIC NUMBER BUTTONS */

.sci-number {
    background: var(--surface);

    color: var(--text);

    font-size: 17px;
    font-weight: 700;
}

.sci-number:hover {
    background: var(--primary-light);
}


/* SCIENTIFIC OPERATORS */

.sci-operator {
    background: var(--primary-light);

    color: var(--primary-dark);

    font-size: 18px;
    font-weight: 750;
}

body.dark-theme .sci-operator {
    color: #42d985;
}

.sci-operator:hover {
    background: var(--primary);
    color: white;
}


/* SCIENTIFIC EQUALS */

.sci-equals {
    background: var(--primary);

    color: white;

    font-size: 21px;
    font-weight: 800;

    border-color: var(--primary);
}

.sci-equals:hover {
    background: var(--primary-dark);
    box-shadow: 0 5px 15px rgba(0, 155, 75, .25);
}


/* =====================================================
   14. SCIENTIFIC FOOTER
   ===================================================== */

.scientific-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 10px;

    padding-top: 15px;
    margin-top: 15px;

    border-top: 1px solid var(--border);

    color: var(--text-secondary);

    font-size: 10px;
    font-weight: 600;
}


/* =====================================================
   15. COMMON BUTTONS
   ===================================================== */

.text-button {
    border: none;

    background: transparent;
    color: var(--primary);

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;
}

.text-button:hover {
    color: var(--primary-dark);
}

.primary-button {
    width: 100%;

    padding: 14px;

    border: none;
    border-radius: 11px;

    background: var(--primary);
    color: white;

    font-size: 15px;
    font-weight: 600;

    cursor: pointer;

    transition: var(--transition);
}

.primary-button:hover {
    background: var(--primary-dark);
}


/* =====================================================
   16. CONVERTER CATEGORY GRID
   ===================================================== */

.category-grid {
    display: grid;

    grid-template-columns: repeat(3, minmax(0, 1fr));

    gap: 10px;

    margin-bottom: 22px;
}

.category-card {
    min-height: 83px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 7px;

    padding: 8px 4px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: var(--surface-secondary);
    color: var(--text-secondary);

    font-size: 11px;
    font-weight: 600;

    cursor: pointer;

    transition: .2s;
}

.category-icon {
    font-size: 23px;
}

.category-card.active {
    background: var(--primary-light);

    border-color: var(--primary);

    color: var(--primary-dark);
}

body.dark-theme .category-card.active {
    background: rgba(21, 155, 80, .2);
    color: #35db80;
}

.category-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}


/* =====================================================
   17. CONVERTER PANEL
   ===================================================== */

.converter-panel {
    padding: 17px;

    background: var(--surface-secondary);

    border: 1px solid var(--border);
    border-radius: 16px;
}

.converter-title {
    margin-bottom: 20px;
}

.converter-title h3,
.converter-panel > h3 {
    font-size: 17px;
    margin-bottom: 7px;
}

.rate-status {
    display: inline-block;

    color: var(--text-secondary);
    font-size: 11px;
}

.rate-status.success {
    color: var(--primary);
}

.rate-status.error {
    color: #dc5555;
}


/* =====================================================
   18. INPUT FIELDS
   ===================================================== */

.conversion-field,
.form-field {
    display: flex;
    flex-direction: column;

    gap: 9px;

    margin-bottom: 17px;
}

.conversion-field label,
.form-field label {
    color: var(--text-secondary);

    font-size: 12px;
    font-weight: 600;
}

.conversion-field input,
.form-field input,
.conversion-field select,
.form-field select,
.height-inputs select {
    width: 100%;
    min-width: 0;

    padding: 12px;

    border: 1px solid var(--border);
    border-radius: 9px;

    background: var(--surface);
    color: var(--text);

    outline: none;
}

.conversion-field input,
.form-field input {
    font-size: 20px;
    font-weight: 600;
}

.conversion-field input:focus,
.form-field input:focus,
.conversion-field select:focus,
.form-field select:focus {
    border-color: var(--primary);
}

.conversion-field select {
    font-size: 13px;
}

.swap-btn {
    display: block;

    width: 38px;
    height: 38px;

    margin: 0 auto 15px;

    border: 1px solid var(--border);
    border-radius: 50%;

    background: var(--primary-light);
    color: var(--primary-dark);

    font-size: 22px;

    cursor: pointer;

    transition: var(--transition);
}

.swap-btn:hover {
    transform: rotate(180deg);
}

body.dark-theme .swap-btn {
    background: rgba(21, 155, 80, .2);
    color: #35db80;
}

.conversion-result {
    padding: 12px;

    margin: 10px 0 15px;

    border-radius: 9px;

    background: var(--primary-light);
    color: var(--primary-dark);

    font-size: 13px;
    font-weight: 600;

    overflow-wrap: anywhere;
}

body.dark-theme .conversion-result {
    background: rgba(21, 155, 80, .15);
    color: #4be68c;
}

.refresh-button {
    display: block;
    margin: 15px auto 0;
}


/* =====================================================
   19. DISCOUNT & BMI
   ===================================================== */

.result-card {
    display: flex;
    flex-direction: column;

    gap: 15px;

    margin-top: 20px;
    padding: 15px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 12px;
}

.result-card > div {
    display: flex;
    justify-content: space-between;

    gap: 10px;
}

.result-card span {
    color: var(--text-secondary);
    font-size: 13px;
}

.result-card strong {
    color: var(--primary);
    font-size: 17px;
}

.height-inputs {
    display: grid;
    grid-template-columns: 1fr 95px;

    gap: 9px;
}

.bmi-result {
    align-items: center;
    text-align: center;
}

.bmi-result strong {
    font-size: 35px;
}

.disclaimer {
    margin-top: 15px;

    color: var(--text-secondary);

    font-size: 10px;
    line-height: 1.5;
}

.converter-info {
    text-align: center;

    margin-top: 20px;
    padding: 10px;

    color: var(--text-secondary);
    font-size: 10px;
}


/* =====================================================
   20. HISTORY
   ===================================================== */

.history-view {
    padding-bottom: 20px;
}

.history-list {
    display: flex;
    flex-direction: column;

    gap: 10px;

    max-height: 490px;

    overflow-y: auto;
}

.history-item {
    padding: 14px;

    border: 1px solid var(--border);
    border-radius: 11px;

    background: var(--surface-secondary);

    cursor: pointer;
}

.history-expression {
    margin-bottom: 8px;

    color: var(--text-secondary);
    font-size: 13px;
}

.history-result {
    font-size: 20px;
    font-weight: 700;
}

.empty-state {
    padding: 55px 10px;

    text-align: center;

    color: var(--text-secondary);
}


/* =====================================================
   21. SETTINGS
   ===================================================== */

.settings-group {
    margin-bottom: 22px;

    padding: 15px;

    border: 1px solid var(--border);
    border-radius: 14px;

    background: var(--surface-secondary);
}

.settings-group h3 {
    margin-bottom: 12px;

    font-size: 14px;
    color: var(--primary);
}

.setting-item {
    min-height: 65px;

    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 12px;

    border-bottom: 1px solid var(--border);
}

.setting-item:last-of-type {
    border-bottom: none;
}

.setting-item strong {
    font-size: 13px;
}

.setting-item p {
    margin-top: 4px;

    color: var(--text-secondary);

    font-size: 10px;
    line-height: 1.4;
}

.setting-select {
    max-width: 135px;

    padding: 8px;

    background: var(--surface);
    color: var(--text);

    border: 1px solid var(--border);
    border-radius: 8px;

    font-size: 12px;
}


/* =====================================================
   22. TOGGLE SWITCH
   ===================================================== */

.switch {
    position: relative;

    display: inline-block;

    flex-shrink: 0;

    width: 43px;
    height: 24px;
}

.switch input {
    width: 0;
    height: 0;

    opacity: 0;
}

.slider {
    position: absolute;
    inset: 0;

    background: #c7c7c7;

    border-radius: 30px;

    cursor: pointer;

    transition: .25s;
}

.slider::before {
    content: "";

    position: absolute;

    width: 18px;
    height: 18px;

    left: 3px;
    top: 3px;

    border-radius: 50%;

    background: white;

    transition: .25s;
}

.switch input:checked + .slider {
    background: var(--primary);
}

.switch input:checked + .slider::before {
    transform: translateX(19px);
}


/* =====================================================
   23. RESET BUTTON
   ===================================================== */

.reset-button {
    width: 100%;

    margin-top: 15px;
    padding: 12px;

    border: 1px solid #df5555;
    border-radius: 9px;

    background: transparent;
    color: #df5555;

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;

    transition: var(--transition);
}

.reset-button:hover {
    background: #df5555;
    color: #fff;
}


/* =====================================================
   24. ABOUT CARD
   ===================================================== */

.about-card {
    padding: 18px;

    text-align: center;

    border: 1px solid var(--border);
    border-radius: 13px;

    background: var(--surface-secondary);
}

.about-card h3 {
    font-size: 16px;
    margin-bottom: 8px;
}

.about-card p {
    margin-top: 7px;

    color: var(--text-secondary);
    font-size: 11px;
}

.about-card strong {
    color: var(--primary);
}


/* =====================================================
   25. FOOTER
   ===================================================== */

.calculator-footer {
    display: flex;
    justify-content: space-between;

    gap: 10px;

    padding-top: 18px;

    color: var(--text-secondary);
    font-size: 10px;
}


/* =====================================================
   26. SCROLLBARS
   ===================================================== */

* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}


/* =====================================================
   27. ACCESSIBILITY
   ===================================================== */

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}


/* =====================================================
   28. TABLET RESPONSIVE
   ===================================================== */

@media (max-width: 768px) {

    .app-container {
        max-width: 500px;
    }

    .scientific-keypad {
        gap: 7px;
    }

}


/* =====================================================
   29. MOBILE RESPONSIVE
   ===================================================== */

@media (max-width: 480px) {

    body {
        padding: 0;

        background: var(--surface);
    }

    .app-container {
        max-width: 100%;
    }

    .calculator {
        min-height: 100vh;
        min-height: 100dvh;

        padding: 20px 22px 20px;

        border-radius: 0;

        box-shadow: none;
    }

    .display {
        min-height: 0;
        flex: 1;

        padding-top: 30px;
    }

    .keypad {
        grid-template-rows: repeat(5, minmax(52px, 1fr));

        gap: 12px;
    }

    .key {
        font-size: 23px;
    }

    .result {
        font-size: 34px;
    }

    .category-grid {
        gap: 8px;
    }

    .category-card {
        min-height: 76px;

        font-size: 10px;
    }

    .converter-panel {
        padding: 14px;
    }

    .scientific-view {
        padding-top: 15px;
        padding-bottom: 15px;
    }

    .scientific-heading {
        margin-top: 10px;
    }

    .scientific-heading h2 {
        font-size: 19px;
    }

    .scientific-display {
        min-height: 120px;
        padding: 15px;
    }

    .scientific-result {
        font-size: 27px;
    }

    .scientific-keypad {
        gap: 6px;
    }

    .sci-key {
        min-height: 45px;

        border-radius: 9px;

        font-size: 12px;
    }

    .sci-number {
        font-size: 16px;
    }

    .sci-operator {
        font-size: 16px;
    }

}


/* =====================================================
   30. SMALL MOBILE
   ===================================================== */

@media (max-width: 350px) {

    .calculator {
        padding-left: 15px;
        padding-right: 15px;
    }

    .keypad {
        gap: 9px;
    }

    .category-card {
        font-size: 9px;
    }

    .scientific-keypad {
        gap: 4px;
    }

    .sci-key {
        min-height: 41px;
        font-size: 10px;
    }

    .scientific-mode-label {
        font-size: 8px;
    }

}


/* =====================================================
   31. LANDSCAPE MOBILE
   ===================================================== */

@media (max-height: 600px) and (orientation: landscape) {

    body {
        align-items: flex-start;
    }

    .app-container {
        max-width: 650px;
    }

    .calculator {
        min-height: auto;
    }

    .scientific-display {
        min-height: 95px;
    }

    .sci-key {
        min-height: 38px;
    }

}


/* =====================================================
   END OF SMARTCALCULATOR STYLE.CSS
   Version: 2.3.0
   Developer: Sajan Khadka
   ===================================================== */
