/* Reset & body */
body {
    background: rgba(0, 0, 0, 0.689);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

/* Calculator container */
.calc {
    width: 370px;
    max-width: 90vw;
    background: #1e1e2f;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* Wraps the input + copy button together */
.display-wrapper {
    position: relative;
    margin-bottom: 10px;
}

/* Live preview */
.preview {
    height: 20px;
    color: #0ab448;
    font-size: 16px;
    text-align: right;
    margin-bottom: 10px;
    padding-right: 10px;
    opacity: 0.8;
}

/* Input display */
input {
    width: 100%;
    padding: 20px;
    padding-left: 50px;
    /* space for copy button */
    font-size: 28px;
    text-align: right;
    background: #2c2c3c;
    color: #fff;
    border: none;
    border-radius: 12px;
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}

/* Copy button */
.copy-btn {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.7;
    transition: 0.2s ease;
    display: none;
    /* shown only when result exists */
}

.copy-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.copy-btn.copied {
    color: #0ab448;
    opacity: 1;
}

/* Button Grid */
.row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

button {
    padding: 18px 0;
    font-size: 20px;
    border: none;
    border-radius: 12px;
    background: #33334d;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

button:hover {
    transform: translateY(-2px);
    background: #4b4b6a;
}

button:active {
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Operators */
.operator {
    background: linear-gradient(45deg, #0ab448, #22933e);
    font-weight: bold;
    color: #fff;
}

.operator:hover {
    background: linear-gradient(45deg, #22933e, #0ab448);
}

/* Equal button */
.equalbtn {
    grid-column: span 4;
    background: linear-gradient(45deg, #ff005f, #ff5f00);
    font-weight: bold;
}

.equalbtn:hover {
    background: linear-gradient(45deg, #ff5f00, #ff005f);
}

/* Small responsive tweaks */
@media screen and (max-width: 400px) {
    input {
        font-size: 22px;
        padding: 15px;
    }

    button {
        font-size: 18px;
        padding: 15px 0;
    }
}
/* ===== Unit Converter ===== */
.unit-bar {
    margin-bottom: 8px;
}

.unit-toggle-btn {
    width: 100%;
    background: rgba(255,255,255,0.07);
    color: #ccc;
    font-size: 13px;
    padding: 7px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: 0.2s;
}

.unit-toggle-btn:hover {
    background: rgba(255,255,255,0.13);
    color: #fff;
    transform: none;
}

.unit-panel {
    background: #252535;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
}

.unit-panel.hidden {
    display: none;
}

.unit-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.unit-select {
    flex: 1;
    background: #2c2c3c;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 13px;
}

.unit-select-small {
    flex: 1;
    background: #2c2c3c;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 5px 6px;
    font-size: 12px;
}

.unit-input {
    width: 80px;
    background: #2c2c3c;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 14px;
    text-align: right;
}

.unit-arrow {
    color: #0ab448;
    font-size: 16px;
}

.unit-result {
    text-align: center;
    color: #0ab448;
    font-size: 18px;
    font-weight: bold;
    margin: 4px 0 8px;
}

.unit-use-btn {
    width: 100%;
    background: rgba(10,180,72,0.15);
    color: #0ab448;
    border: 1px solid rgba(10,180,72,0.3);
    border-radius: 8px;
    padding: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: 0.2s;
}

.unit-use-btn:hover {
    background: rgba(10,180,72,0.25);
    transform: none;
}
