/* --- CSS --- */
        
/* 1. Deklarasi Font Lokal */
@font-face {
    font-family: 'CalcFont';
    src: url('http://localhost/xls/calc.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* --- TOMBOL BUKA KALKULATOR --- */


/* Container Kalkulator Utama */
#calculator {
    display: none; 
    position: fixed;
    width: 320px;
    background: linear-gradient(180deg, #1e5f8faa, #1e5f8f33);
    backdrop-filter: blur(20px);
    border-radius: 15px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 2px 5px rgba(255,255,255,0.2);
    padding-bottom: 5px;
    cursor: grab;
    z-index: 9999;
}

#calculator:active {
    cursor: grabbing;
}

/* --- TOMBOL CLOSE (Kiri Atas) --- */
#close-calc-btndh {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 28px;
    height: 28px;
    background-color: #fff0;
    color: #ff4d4d;
    border: none;
    border-radius: 0 0 4px 0; 
    cursor: pointer;
    z-index: 1001;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    transition: background 0.2s;
}

#close-calc-btndh:hover {
    color: #f00;
}

/* --- PANEL HISTORI --- */
#history-panel {
    display: none;
    position: absolute;
    right: 100%;
    top: 0;
    margin-right: 15px;
    width: 250px;
    height: 100%;
    background-color: #1a4a70;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    padding: 15px 25px;
    color: #d1d1d1;
    overflow-y: auto;
    cursor: default;
}

#history-panel h3 {
    text-align: center;
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 5px;
}

#history-list {
    list-style: none;
    font-family: 'CalcFont', monospace; 
    font-size: 16px;
}

#history-list li {
    border-bottom: 1px dashed #31638b;
    padding: 10px 0;
    text-align: right;
    word-wrap: break-word;
}

/* --- REDESAIN BAGIAN LAYAR --- */
.display-container {
    background-color: #4a4a4a;
    background-image: url('../../displaybg.jpg');
    background-size: cover;
    background-position: center center;
    padding: 25px 20px 15px 20px; 
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    border-bottom: 2px solid #15456b;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

/* Sub-Display untuk jejak operasi */
#sub-display {
    min-height: 20px;
    color: #aed3ef;
    font-family: 'CalcFont', monospace;
    font-size: 16px;
    text-align: right;
    margin-bottom: 5px;
    padding-right: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Layar Utama menggunakan DIV */
#display {
    width: 100%;
    color: #ffffff; 
    font-family: 'CalcFont', monospace; 
    font-size: 40px; 
    text-align: right;
    pointer-events: none;
    min-height: 42px;
    line-height: 1.2;
    word-break: break-all;
}

/* Class untuk transparansi titik dan koma */
.sep {
    opacity: 0.35; /* Transparan sedikit sebagai pembeda */
    line-height: 0.8;
}

/* --- SWITCH CONTAINER --- */
.controls {
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    background-color: #174d75;
    border-bottom: 2px solid #15456b;
}

.switch-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #aed3ef;
    font-weight: bold;
}

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

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #113654;
    transition: .2s;
    border-radius: 18px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

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

input:checked + .slider {
    background-color: #3fa9f5;
}

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

/* Grid Tombol */
.keypad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 15px;
}

.btndh {
    background-color: #3fa9f5;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 20px;
    font-weight: 800;
    height: 60px;
    cursor: pointer;
    box-shadow: 0 6px 0 #1b6da7, 0 8px 10px rgba(0,0,0,0.3);
    transition: all 0.1s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: inherit; 
}

.btndh:active, .btndh.active-key {
    transform: translateY(6px);
    box-shadow: 0 0 0 #1b6da7, 0 2px 4px rgba(0,0,0,0.3);
}

.btndh-enter {
    grid-column: span 2;
    flex-direction: column;
    line-height: 1.2;
    background-color: #00b950;
}

.btndh-enter span {
    font-size: 10px;
    margin-top: 4px;
    font-family: inherit;
}

.btndh-op { background-color: #7dc3f2; }
.btndh-op:active, .btndh-op.active-key { box-shadow: 0 0 0 #134e75, 0 2px 4px rgba(0,0,0,0.3); }