/**
 * Scientific Calculator Styles
 * Design inspired by classic calculator interfaces
 */

:root {
    --bg-primary: #5a7a42;
    --bg-secondary: #4a6935;
    --bg-dark: #3d5a2b;
    --calc-body: #e8e8e8;
    --calc-body-dark: #d4d4d4;
    --display-bg: #c8d8c0;
    --display-text: #1a2a14;
    --key-light: #ffffff;
    --key-dark: #2d3a26;
    --key-func: #3d4a36;
    --key-op: #f5f5f5;
    --key-equals: #c94040;
    --text-light: #ffffff;
    --text-dark: #1a1a1a;
    --shadow-color: rgba(0, 0, 0, 0.15);
    --border-radius: 8px;
}

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

html, body {
    height: 100%;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 50%, var(--bg-dark) 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.background-symbols {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.sym {
    position: absolute;
    font-family: 'Roboto Mono', monospace;
    color: rgba(60, 90, 45, 0.6);
    font-weight: 600;
    user-select: none;
}

.sym-1 {
    font-size: 120px;
    top: 5%;
    left: 8%;
    transform: rotate(-15deg);
}

.sym-2 {
    font-size: 180px;
    top: 60%;
    right: 5%;
    transform: rotate(10deg);
    color: rgba(75, 110, 55, 0.5);
}

.sym-3 {
    font-size: 200px;
    bottom: 10%;
    right: 15%;
    transform: rotate(-5deg);
    color: rgba(55, 85, 40, 0.55);
}

.sym-4 {
    font-size: 90px;
    top: 20%;
    right: 25%;
    transform: rotate(20deg);
}

.sym-5 {
    font-size: 100px;
    bottom: 30%;
    left: 5%;
    transform: rotate(-10deg);
}

.sym-6 {
    font-size: 80px;
    top: 40%;
    left: 3%;
    transform: rotate(5deg);
}

.sym-7 {
    font-size: 70px;
    top: 8%;
    right: 10%;
    transform: rotate(-8deg);
}

.sym-8 {
    font-size: 85px;
    bottom: 5%;
    left: 20%;
    transform: rotate(12deg);
}

.sym-9 {
    font-size: 110px;
    bottom: 25%;
    right: 30%;
    transform: rotate(-3deg);
    color: rgba(70, 105, 50, 0.4);
}

.sym-10 {
    font-size: 75px;
    top: 65%;
    left: 12%;
    transform: rotate(8deg);
}

.sym-11 {
    font-size: 65px;
    top: 15%;
    left: 30%;
    transform: rotate(-12deg);
}

.sym-12 {
    font-size: 55px;
    bottom: 40%;
    right: 8%;
    transform: rotate(15deg);
}

.container {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    position: relative;
    z-index: 1;
    max-width: 100%;
}

.calculator-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.mode-title {
    font-size: 22px;
    font-weight: 500;
    color: var(--text-light);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
}

.calculator {
    background: var(--calc-body);
    border-radius: 16px;
    padding: 12px;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    width: 320px;
    max-width: 100%;
}

.calc-header {
    background: linear-gradient(to bottom, #3a3a3a 0%, #2a2a2a 100%);
    border-radius: 8px 8px 0 0;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
}

.header-dots {
    display: flex;
    gap: 4px;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #5a5a5a;
}

.header-title {
    font-size: 11px;
    color: #888;
    font-weight: 500;
}

.header-time {
    font-size: 11px;
    color: #888;
    font-family: 'Roboto Mono', monospace;
}

.display-container {
    background: var(--display-bg);
    border: 2px solid #a8b8a0;
    border-radius: 0 0 6px 6px;
    padding: 16px;
    margin-bottom: 12px;
}

.display {
    width: 100%;
    background: transparent;
    border: none;
    font-family: 'Roboto Mono', monospace;
    font-size: 32px;
    font-weight: 500;
    color: var(--display-text);
    text-align: right;
    outline: none;
    letter-spacing: 2px;
}

.error-msg {
    color: #a03030;
    font-size: 11px;
    margin-top: 6px;
    text-align: right;
}

.mode-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    padding: 0 4px;
}

.mode-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: #d0d0d0;
    color: #555;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn:hover {
    background: #c0c0c0;
}

.mode-btn.active {
    background: var(--key-dark);
    color: var(--text-light);
}

.keypad {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.scientific-keypad {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ccc;
}

.scientific-keypad.hidden {
    display: none;
}

.key-row {
    display: flex;
    gap: 8px;
}

.scientific-row .key {
    flex: 1;
    padding: 10px 4px;
    font-size: 11px;
}

.key {
    flex: 1;
    padding: 16px 8px;
    border: none;
    border-radius: 6px;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'Roboto', sans-serif;
}

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

.num-key {
    background: var(--key-light);
    color: var(--text-dark);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.num-key:hover {
    background: #f8f8f8;
}

.op-key {
    background: var(--key-op);
    color: var(--text-dark);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.op-key:hover {
    background: #e8e8e8;
}

.func-key {
    background: var(--key-func);
    color: var(--text-light);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.func-key:hover {
    background: #4a5a40;
}

.clear-key {
    background: var(--key-dark);
    color: var(--text-light);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.clear-key:hover {
    background: #3a4830;
}

.equals-key {
    background: var(--key-equals);
    color: var(--text-light);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.equals-key:hover {
    background: #b83838;
}

.history-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 16px;
    width: 240px;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.history-header h2 {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.clear-history-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.clear-history-btn:hover {
    background: #f0f0f0;
    color: #555;
}

.history-list {
    list-style: none;
}

.history-item {
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 6px;
    background: #f8f8f8;
    cursor: pointer;
    transition: background 0.2s;
}

.history-item:hover {
    background: #f0f0f0;
}

.hist-expr {
    display: block;
    font-size: 12px;
    color: #666;
    font-family: 'Roboto Mono', monospace;
    word-break: break-all;
}

.hist-result {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-top: 4px;
}

.history-empty {
    color: #999;
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

@media (max-width: 700px) {
    .container {
        flex-direction: column;
        align-items: center;
    }
    
    .history-panel {
        width: 100%;
        max-width: 320px;
        max-height: 200px;
    }
}

@media (max-width: 360px) {
    .calculator {
        width: 100%;
        padding: 10px;
    }
    
    .key {
        padding: 14px 6px;
        font-size: 16px;
    }
    
    .display {
        font-size: 26px;
    }
}
