
@font-face {
    font-family: 'digital-7';
    src: url(/digital-7/digital-7.ttf);
    font-style: normal;
}
* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

body {
    background-color: #f3f3f3c5;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
}

.container {
    background-color: #333;
    padding: 40px 30px 30px;
    padding-right: 20px;
    border-radius: 20px;
    min-width: 300px;
    min-height: 400px;
    box-shadow: 25px 25px 75px rgba(0,0,0,0.25), 10px 10px 70px rgba(0,0,0,0.25)
    inset -5px -5px 15px rgba(0,0,0,0.25)
    inset 5px 5px 15px rgba(0,0,0,0.25);
}

.calculator {
    display: grid;
    gap: 10px;
    position: relative;
    
}

.calculator .value {
    grid-column: span 4;
    height: 100px;
    width: calc(100% - 10px);
    background-color: #a7af7c;
    margin-bottom: 10px;
    border-radius: 10px;
    border: none;
    outline: none;
    font-size: 36px;
    padding: 10px;
    text-align: right;
    /* font-family: 'digital-7'; */
}

.calculator button {
    border: none;
    width: 80px;
    height: 80px;
    background: linear-gradient(180deg, #2f2f2f, #3f3f3f);
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: inset -8px 0 8px rgba(0,0,0,0.15), inset 0 -8px 8px rgba(0,0,0,0.25), 
    0 0 0 2px rgba(0,0,0,0.75), 10px 20px 25px rgba(0,0,0,0.4);
    position: relative;
}

.calculator button::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 4px;
    right: 12px;
    bottom: 14px;
    border-radius: 10px;
    background: linear-gradient(90deg, #2d2d2d, #4d4d4d);
    box-shadow: -5px -5px -15px rgba(0,0,0,0.1), 10px 5px 10px rgba(0,0,0,0.15);
    border-left: 1px solid rgba(0,0,0,0.27);
    border-right: 1px solid rgba(0,0,0,0.27);
    border-top: 1px solid rgba(0,0,0,0.6);
}

.calculator button:active{
    filter: brightness(1.5);
}

.calculator button.key-press {
    filter: brightness(1.5);
}


.calculator button i {
    position: relative;
    text-transform: uppercase;
    font-style: normal;
    font-size: 1.5em;
}

.calculator button.clear{
    background: #f00;
}

.calculator button.clear::before{
    background: linear-gradient(90deg, #d20000, rgba(255,255,255,0.36));
    border-left: 1px solid rgba(255,255,255,0.27);
    border-right: 1px solid rgba(255,255,255,0.27);
    border-top: 1px solid rgba(255,255,255,0.27);
}


.calculator button.equal {
    grid-row: span 2;
    height: 180px;
    background: #2196f3;
}

.calculator button.equal::before{
    background: linear-gradient(90deg, #1479c9, rgba(255,255,255,0.36));
    border-left: 1px solid rgba(255,255,255,0.27);
    border-right: 1px solid rgba(255,255,255,0.27);
    border-top: 1px solid rgba(255,255,255,0.27);
}

@media screen and (max-width: 600px) {
    .container {
        width: 90%;
        padding: 20px;
    }

    .calculator {
        grid-template-columns: repeat(4, 1fr);
    }

    .calculator .value {
        font-size: 28px;
        height: 80px;
    }

    .calculator button {
        width: 100%;
        height: 60px;
        font-size: 1.2em;
    }

    .calculator button.equal {
        height: 130px;
    }
}

@media screen and (max-width: 400px) {
    .calculator button {
        height: 50px;
        font-size: 1em;
    }

    .calculator .value {
        font-size: 24px;
        height: 70px;
    }
}

.main-wrapper {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.history-tape {
    width: 100%;
    margin-top: 20px;
    background-color: #222;
    color: #fff;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    max-height: 165px;
    min-height: 120px;
    overflow-y: auto;
    font-size: 0.95rem;
}

.history-tape {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#historyPanel.hidden {
    opacity: 0;
    visibility: hidden;
}

.history-tape h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    text-align: center;
    color: #ddd;
}

.history-tape ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.history-tape li {
    padding: 8px 12px;
    margin-bottom: 6px;
    background-color: #2a2a2a;
    border-left: 4px solid #555657;
    border-radius: 6px;
    font-size: 1rem;
    font-family: 'Courier New', Courier, monospace;
    line-height: 1.4;
    color: #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}

.history-tape li:hover {
    background-color: #3a3a3a;
}

.history-tape li span.result {
    font-weight: bold;
    color: #4caf50;
    margin-left: 10px;
}


@media (max-width: 600px) {
    .calculator button {
        height: 60px;
        font-size: 1.2em;
    }

    .calculator .value {
        font-size: 28px;
        height: 80px;
    }

    .history-tape {
        font-size: 0.9rem;
        max-height: 180px;
    }
}

.history-controls {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 20px;
    width: 100%;
    max-width: 480px;
}

.history-controls button {
    flex: 1;
    padding: 12px 16px;
    background: #333;
    color: #f0f0f0;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.35),
        inset 0 0 0 rgba(255, 255, 255, 0);
    transition:
        transform 0.15s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.25s ease-in-out,
        background 0.25s ease-in-out,
        color 0.2s ease;
}

.history-controls button:active {
    background: rgba(0, 0, 0, 0.699);
    box-shadow:
        inset 2px 2px 6px rgba(0, 0, 0, 0.6),
        inset -2px -2px 4px rgba(255, 255, 255, 0.05);
    transform: scale(0.98);
}

#historyPanel.hidden {
    display: none;
}


.toggle-container {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 100;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0;
    right: 0; bottom: 0;
    background-color: #303030;
    transition: 0.4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px; width: 26px;
    left: 4px; bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

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

.toggle-label {
    font-size: 1rem;
    color: #333;
}

@media screen and (max-width: 600px) {
    .toggle-container {
        top: 10px;
        right: 10px;
        transform: scale(0.85);
    }
}

body.dark-mode {
    background-color: #1f1f1f;
    color: #eee;
}

body.dark-mode .container {
    background-color: #c5c5c5;
}

body.dark-mode .history-tape {
    background-color: #b8b8b8;
    color: #ccc;
}

body.dark-mode .history-tape li {
    padding: 8px 12px;
    margin-bottom: 6px;
    background-color: #929292;
    border-left: 4px solid #1d1d1d;
    border-radius: 6px;
    font-size: 1rem;
    font-family: 'Courier New', Courier, monospace;
    line-height: 1.4;
    color: #000000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}

body.dark-mode .history-controls button {
    flex: 1;
    padding: 12px 16px;
    background: #b8b8b8;
    color: #000000;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.35),
        inset 0 0 0 rgba(255, 255, 255, 0);
    transition:
        transform 0.15s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.25s ease-in-out,
        background 0.25s ease-in-out,
        color 0.2s ease;
}

body.dark-mode .calculator .value {

    grid-column: span 4;
    height: 100px;
    width: calc(100% - 10px);
    background-color: #aeb96a;
    margin-bottom: 10px;
    border-radius: 10px;
    border: 0.05px solid black;
    outline: none;
    font-size: 36px;
    padding: 10px;
    text-align: right;
    /* font-family: 'digital-7'; */
}

.empty-history {
    text-align: center;
    color: #aaa;
    font-style: italic;
    padding: 10px;
}

.app-header, .app-footer {
    width: 100%;
    text-align: center;
    background-color: #222;
    color: #fff;
    padding: 15px 10px;
    font-size: 1.2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.app-footer {
    margin-top: 30px;
    font-size: 1rem;
}

body.dark-mode .app-header,
body.dark-mode .app-footer {
    background-color: #444;
    color: #ddd;
}

@media (max-width: 600px) {
    .app-header, .app-footer {
        font-size: 1rem;
        padding: 10px;
    }
}
