/*--------------------------------------------------------------
  CALC.HTML - Universal Converter (Green Theme)
  
  Based on calc.py functionality
--------------------------------------------------------------*/

/* Smartphone keyboard mode - input field above everything */
.smartphone-keyboard-active #converterInput {
    position: fixed !important;
    z-index: 999999 !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: calc(100% - 40px) !important;
    background: rgba(0, 0, 0, 0.9) !important;
    border: 2px solid #33c972 !important;
    border-radius: 8px !important;
    padding: 20px !important;
    font-size: 18px !important;
    color: white !important;
}

/* Longpress keyboard state - Buttons ausblenden ohne Layout zu ändern */
.longpress-keyboard-active .cal2,
.longpress-keyboard-active .cal3,
.longpress-keyboard-active .cal4 {
    visibility: hidden;
}

.longpress-keyboard-active .cal5 button:not(#zcken2) {
    visibility: hidden;
}

.cal2, .cal3, .cal4, .cal5 button {
    transition: visibility 0.3s ease;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    height: 100vh;
    height: 100svh;
    width: 100%;
    background-color: #357199;
    font-family: sans-serif;
    font-weight: normal;
    cursor: pointer;
    justify-content: center;
    flex-direction: column;
    align-items: center;
    text-align: center;
    overflow: hidden;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

* {
    box-sizing: border-box;
}

#calccolor {
    position: fixed;
    width: 100%;
    height: 100vh;
    top: 0;
    left: 0;
    overflow: hidden;
}


table {
    width: 100%;
    height: 100vh;
    height: 100svh;
    margin: auto;
    padding: auto;
    flex-direction: column;
    box-sizing: border-box;
    text-align: center;
    align-items: center;
    align-content: center;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 0;
    margin-top: 0;
}

#backpng {
    margin: 0;
    padding: 0;
    width: 100%;
    background-image: url("/back1.webp");
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: top left; /* Geändert von 'top right' zu 'top left' */
    overflow: hidden;
    opacity: 0.6;
}

.output {
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 40px 15px 120px 15px;
    word-wrap: break-word;
    word-break: break-all;
    min-height: 220px;
    width: calc(100% - 30px);
    margin: 15px;
    border-radius: 0;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    transition: height 0.15s ease, margin-top 0.15s ease, padding-bottom 0.15s ease;
}

/* Header styling */
.cal0 {
    padding: 0;
    margin: 0;
    width: 100%;
    height: 4svh;
    margin-bottom: 50svh;
    display: flex;
    position: fixed;
    box-sizing: border-box;
    font-size: 12px;
    text-align: center;
    align-items: center;
    justify-content: center;
    align-content: center;
    color: #33c972;
    background-color: rgb(13, 13, 13);
    bottom: 0;
    transition: color 0.12s ease-out, border-bottom-color 0.12s ease-out, bottom 0.15s ease, margin-bottom 0.15s ease;
    border-bottom: 1px solid transparent;
}

.cal0.flash-green {
    animation: headerFlashGreen 0.18s ease-out, borderFlashGreen 0.18s ease-out;
}

.cal0.flash-red {
    animation: headerFlashRed 0.15s ease-out, borderFlashRed 0.15s ease-out;
}

.cal0.flash-orange {
    animation: headerFlashOrange 0.18s ease-out, borderFlashOrange 0.18s ease-out;
}

.cal0.flash-transparent {
    animation: headerFlashTransparent 0.18s ease-out;
}

.cal0.flash-white {
    animation: headerFlashWhite 0.18s ease-out, borderFlashWhite 0.18s ease-out;
}

@keyframes headerFlashGreen {
    0% { color: #33c972; text-shadow: 0 0 12px rgba(51,201,114,0.9); background-color: #33c972; }
    50% { color: #33c972; text-shadow: 0 0 22px rgba(51,201,114,0.95); background-color: #33c972; }
    100% { color: rgba(51, 201, 114, 1); text-shadow: none; }
}

@keyframes borderFlashGreen {
    0% { border-bottom-color: transparent; }
    30% { border-bottom-color: #33c972; }
    100% { border-bottom-color: transparent; }
}

@keyframes headerFlashRed {
    0% { color: #e63636; text-shadow: 0 0 12px rgba(230,54,54,0.9); }
    25% { color: rgba(51, 201, 114, 1); text-shadow: none; }
    50% { color: #e63636; text-shadow: 0 0 22px rgba(230,54,54,0.95); }
    75% { color: rgba(51, 201, 114, 1); text-shadow: none; }
    100% { color: #e63636; text-shadow: 0 0 12px rgba(230,54,54,0.9); }
}

@keyframes borderFlashRed {
    0% { border-bottom-color: #e63636; }
    25% { border-bottom-color: transparent; }
    50% { border-bottom-color: #e63636; }
    75% { border-bottom-color: transparent; }
    100% { border-bottom-color: #e63636; }
}

@keyframes headerFlashOrange {
    0% { color: #ff8c00; text-shadow: 0 0 12px rgba(255,140,0,0.9); }
    50% { color: #ff8c00; text-shadow: 0 0 22px rgba(255,140,0,0.95); }
    100% { color: rgba(51, 201, 114, 1); text-shadow: none; }
}

@keyframes borderFlashOrange {
    0% { border-bottom-color: transparent; }
    30% { border-bottom-color: #ff8c00; }
    100% { border-bottom-color: transparent; }
}

@keyframes headerFlashTransparent {
    0% { color: rgba(51, 201, 114, 1); }
    50% { color: rgba(51, 201, 114, 0.5); }
    100% { color: rgba(51, 201, 114, 1); }
}

@keyframes headerFlashWhite {
    0% { color: #ffffff; text-shadow: 0 0 12px rgba(255,255,255,0.9); }
    50% { color: #ffffff; text-shadow: 0 0 22px rgba(255,255,255,0.95); }
    100% { color: rgba(51, 201, 114, 1); text-shadow: none; }
}

@keyframes borderFlashWhite {
    0% { border-bottom-color: transparent; }
    30% { border-bottom-color: rgba(255, 255, 255, 0.5); }
    100% { border-bottom-color: transparent; }
}


/* Reduce hover effects temporarily during flash */
.reduce-hover button:hover {
    transition: none !important;
    box-shadow: none !important;
}

/* Button rows */
.cal1 {
    padding: 0;
    margin: 0;
    width: 100%;
    height: 10svh;
    margin-bottom: 0;
    display: flex;
    box-sizing: border-box;
    justify-content: center;
    align-content: center;
    position: fixed;
    bottom: 0;
    z-index: 100;
    transition: transform 0.15s ease;
}

.cal2 {
    padding: 0;
    margin: 0;
    width: 100%;
    height: 10svh;
    margin-bottom: 30svh;
    display: flex;
    box-sizing: border-box;
    justify-content: center;
    align-content: center;
    position: fixed;
    bottom: 0;
    transition: transform 0.15s ease;
}

.cal3 {
    padding: 0;
    margin: 0;
    width: 100%;
    height: 10svh;
    margin-bottom: 20svh;
    display: flex;
    box-sizing: border-box;
    justify-content: center;
    align-content: center;
    position: fixed;
    bottom: 0;
    transition: transform 0.15s ease;
}

.cal4 {
    padding: 0;
    margin: 0;
    width: 100%;
    height: 10svh;
    margin-bottom: 10svh;
    display: flex;
    box-sizing: border-box;
    justify-content: center;
    align-content: center;
    position: fixed;
    bottom: 0;
    transition: transform 0.15s ease;
}

.cal5 {
    padding: 0;
    margin: 0;
    width: 100%;
    height: 10svh;
    display: flex;
    box-sizing: border-box;
    justify-content: center;
    align-content: center;
    position: fixed;
    bottom: 0;
    transition: transform 0.15s ease;
}

/* Default state - keyboard expanded */

body:not(.keyboard-minimized) .cal1 {
    transform: translateY(-40svh);
}

body:not(.keyboard-minimized) .output {
    height: calc(100svh - 54svh);
    margin-top: 30px;
    padding-bottom: 20px;
}

/* Keyboard minimized state */

body.keyboard-minimized .cal0 {
    bottom: 10svh;
    margin-bottom: 0;
}

body.keyboard-minimized .cal1 {
    transform: translateY(0);
}

body.keyboard-minimized .output {
    height: calc(100svh - 14svh);
    margin-top: 30px;
    padding-bottom: 120px;
}

body.keyboard-minimized .cal2 {
    transform: translateY(100vh);
}

body.keyboard-minimized .cal3 {
    transform: translateY(100vh);
}

body.keyboard-minimized .cal4 {
    transform: translateY(100vh);
}

body.keyboard-minimized .cal5 {
    transform: translateY(100vh);
}

/* Button styling */
button {
    height: 10vh;
    width: 25%;
    padding: 0;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: opacity 0.1s ease;
    cursor: pointer;
    flex-direction: row;
    font-size: 2rem;
    border: 1px solid rgb(22, 22, 22);
}

button:active {
    opacity: 0.3;
    transition: opacity 0.05s ease;
    transform: none;
    height: 10vh;
}

button:active:not(.span-two) {
    width: 25%;
}

button.span-two:active {
    width: 50%;
}

button:hover {
    box-shadow: 0 0 80px #000000 inset;
}

/* Green theme buttons */
#green {
    font-size: 32px;
    background-color: rgb(16, 16, 16);
    color: #33c972;
    transition: opacity 0.3s ease;
}

#green:hover,
button[onclick="clearConverter()"]:hover {
    background-color: #33c972 !important;
    color: #ffffff !important;
}

#green.inactive,
.inactive {
    opacity: 0.5;
}

#green2 {
    background-color: rgb(13, 13, 13);
    color: #ffffff;
}

#green2:hover {
    background-color: #33c972;
    color: #ffffff;
}

#green2.dark-bg {
    background-color: #101010;
    color: #33c972;
}

#green2.dark-bg:hover {
    background-color: #33c972;
    color: #ffffff;
}

#numlock {
    font-size: 16px;
    text-align: center;
    background-color: rgb(16, 16, 16);
    color: #33c972;
    flex-direction: column;
    transition: opacity 0.15s ease;
}

#numlock:hover {
    background-color: #33c972;
    color: #ffffff;
}

#zcken2 {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0%;
    box-sizing: border-box;
    background-color: rgb(16, 16, 16);
    transition: opacity 0.15s ease;
}

#zcken2:hover {
    background-color: #33c972;
    color: #ffffff;
}

/* Converter display styling */
.converter-display {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
}

#converterInput {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 15px;
    font-size: 1.8rem;
    color: white;
    font-family: 'Consolas', 'Monaco', monospace;
    margin-top: 20px;
    margin-bottom: 25px;
    outline: none;
    order: 2;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

#converterInput::placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8em;
}

#converterInput:focus {
    border-color: #33c972;
    box-shadow: 0 0 10px rgba(51, 201, 114, 0.3);
}

#converterInput.error {
    border-color: #e63636 !important;
    box-shadow: 0 0 10px rgba(230, 54, 54, 0.5) !important;
}

#converterInput.error-white {
    border-color: #ffffff !important;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8) !important;
}

#converterInput.success {
    border-color: #33c972 !important;
    box-shadow: 0 0 15px rgba(51, 201, 114, 0.8) !important;
    transition: all 0.05s ease !important;
}

#converterInput.success-fade {
    border-color: #33c972 !important;
    box-shadow: 0 0 15px rgba(51, 201, 114, 0) !important;
    transition: all 1s ease !important;
}

#converterResult {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    font-size: 1.2rem;
    color: white;
    font-family: 'Consolas', 'Monaco', monospace;
    overflow-y: auto;
    text-align: left;
    width: 100%;
    order: 1;
    margin-bottom: 25px;
    max-height: calc(100% - 85px);
}

.conversion-category {
    font-size: 1.4rem;
    color: #33c972;
    font-weight: bold;
    margin: 20px 0 10px 0;
    text-shadow: 0 0 10px rgba(51, 201, 114, 0.3);
}

.conversion-item {
    margin: 5px 0;
    padding: 0;
    background: transparent;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    border-left: 4px solid rgba(255, 255, 255, 0.3);
    padding-left: 4px;
    width: 100%;
}

.conversion-item.highlight {
    border-left: 4px solid #33c972;
    padding-left: 4px;
}

.unit-value {
    color: #ffffff;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    padding: 8px;
    min-width: 120px;
    background: rgba(51, 201, 114, 0.1);
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.unit-value:hover {
    background: rgba(51, 201, 114, 0.3);
}

.unit-symbol {
    color: rgba(255, 255, 255, 0.7);
    text-align: left;
    cursor: pointer;
    padding: 8px;
    min-width: 60px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.unit-symbol:hover {
    background: rgba(51, 201, 114, 0.25);
}

.unit-name {
    color: rgba(255, 255, 255, 0.6);
    flex-grow: 1;
    cursor: pointer;
    padding: 8px 12px 8px 8px;
    font-size: 0.9em;
    background: rgba(51, 201, 114, 0.05);
    border-radius: 4px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    text-align: right;
}

.unit-name:hover {
    background: rgba(51, 201, 114, 0.2);
}

.error-message {
    color: #e63636;
    font-size: 1.4rem;
    text-align: center;
    margin: 20px 0;
    text-shadow: 0 0 10px rgba(230, 54, 54, 0.3);
}

.help-content {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    line-height: 1.4;
}

.help-category {
    color: #33c972;
    font-weight: bold;
    margin: 15px 0 5px 0;
}

.help-examples {
    margin: 10px 0;
    padding: 10px;
    background: rgba(51, 201, 114, 0.1);
    border-radius: 4px;
}

/* Feedback Section */
.feedback-section {
    background: rgba(51, 201, 114, 0.15);
    border: 1px solid #33c972;
    border-radius: 8px;
    padding: 15px;
    margin: 30px 0 15px 0; /* Volle Breite wie vorher */
}

.feedback-title {
    color: #33c972;
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#feedbackText {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #33c972;
    border-radius: 4px;
    color: white;
    padding: 12px;
    font-size: 0.9rem;
    font-family: sans-serif;
    min-height: 80px;
    resize: vertical;
}

#feedbackText::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#sendFeedback {
    width: 100%;
    background: rgba(51, 201, 114, 0.2);
    color: #33c972;
    border: 1px solid #33c972;
    border-radius: 6px;
    padding: 18px 15px; /* Um die Hälfte größer */
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    height: auto;
    line-height: 1.2;
}

#sendFeedback:hover {
    background: rgba(51, 201, 114, 0.3);
    color: white;
}

#sendFeedback:active {
    transform: scale(0.98);
}

#sendFeedback:disabled {
    background: rgba(51, 201, 114, 0.1);
    color: rgba(51, 201, 114, 0.5);
    cursor: not-allowed;
    transform: none;
}

#sendFeedback.success {
    background: #33c972;
    color: white;
    border-color: #2ea85f;
}

#sendFeedback.success:hover {
    background: #33c972;
    color: white;
    cursor: default;
    transform: none;
}


.keyboard-scroll {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.keyboard-scroll::-webkit-scrollbar {
    display: none;
}

.keyboard-scroll button {
    min-width: 25%;
    flex-shrink: 0;
}

/* Hide number input spinner arrows - Global rule */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
    display: none !important;
}

input[type="number"] {
    -moz-appearance: textfield !important;
}

/* Force hide for dynamically created inputs */
input[type="number"][style] {
    -webkit-appearance: none !important;
    -moz-appearance: textfield !important;
}

input[type="number"][style]::-webkit-outer-spin-button,
input[type="number"][style]::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
    display: none !important;
}

/* Responsive design */
@media (max-width: 420px) {
    .output {
        padding: 18px 15px 24px 15px;
        height: calc(100svh - 56svh);
        width: calc(100% - 30px);
        margin: 15px;
    }
    
    #converterInput {
        font-size: 1.4rem;
        padding: 12px;
    }
    
    #converterResult {
        font-size: 1rem;
    }
    
    .conversion-category {
        font-size: 1.2rem;
    }
}

/* Button effects for green2 buttons (numeric buttons) */
button[id="green2"].fade-hover,
button#green2.fade-hover {
    box-shadow: none !important;
    /* place a semi-transparent black layer behind the button text */
    background-color: rgba(0,0,0,0.45) !important;
    color: rgba(255,255,255,0.9) !important; /* slightly transparent white while pressed */
    transition: background-color 0.04s ease, box-shadow 0.04s ease, color 0.04s ease;
}

/* Brief press scale for green2 numeric buttons */
button[id="green2"].press-scale,
button#green2.press-scale {
    transform: scale(1.12);
    transition: transform 0.08s ease;
}

/* When user just pressed a key, reduce hover visual intensity for green2 buttons only */
body.reduce-hover button[id="green2"]:hover,
body.reduce-hover button#green2:hover {
    box-shadow: none;
    background-color: initial;
    color: inherit;
}

/* Two-line button styling for currency and symbol buttons */
.two-line-button {
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
}

.symbol-large {
    font-size: 1.8rem;
    font-weight: bold;
    line-height: 1;
    display: block;
    margin-bottom: 2px;
}

.text-small {
    font-size: 0.7rem;
    opacity: 0.7;
    line-height: 1;
    display: block;
}

/* Disable transitions for instant changes (used during long-press) */
.no-transition,
.no-transition *,
.no-transition .cal1,
.no-transition .cal2,  
.no-transition .cal3,
.no-transition .cal4,
.no-transition .cal5 {
    transition: none !important;
    animation: none !important;
    transform: translateY(100vh) !important;
}