@import url("https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300..700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap");

:root {
    --bg-color: #e5e5e5;
    --font-sans:
        "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
    --teal: #078;
    --teal-accent: #035;
    --orange: #f70;
    --hover: #f50;
    --focus-ring: #f90;
}

/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow: hidden;
    height: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    overflow: hidden;
    height: 100%;
    border-top: 9px solid var(--teal);
}

.app-body {
    background-color: var(--bg-color);
    height: 100%;
    display: flex;
    justify-content: center;
    overflow-y: auto;
    overflow-x: hidden;
}

@media (min-width: 768px) {
    .app-body {
        height: auto;
        min-height: 90vh;
        margin-top: 20px;
    }
}

/* Card and Header */
.card {
    background-color: var(--bg-color);
    border-radius: 0.75rem;
    width: 100%;
    max-width: 32rem;
    position: relative;
    padding-bottom: 60px;
}

@media (max-width: 600px) {
    .card {
        border-radius: 0;
    }
}

.header-content {
    background: var(--bg-color);
    padding: 15px 2rem 25px 2rem;
    color: #000;
    display: flex;
    justify-content: space-between;
}

@media (min-width: 640px) {
    .header-content {
        padding: 2rem;
    }
}

.sugiro-logo {
    color: #000;
    font-size: 1rem;
    font-weight: 500;
}

.sugiro-logo a {
    text-decoration: none;
    color: #000;
}

.main-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.subtitle {
    display: none;
    color: #000;
    font-size: 18px;
    font-weight: 600;
    margin-top: -12px;
}

/* Header Buttons */

.btn {
    background-color: var(--teal);
    border: 0;
    border-radius: 7px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        transform 0.2s,
        box-shadow 0.2s,
        background-color 0.2s;
    z-index: 1000;
    color: #fff;
    font-weight: 900;
}

.btn:hover {
    background-color: var(--hover);
    color: #fff;
}

.header-btn {
    margin-top: 5px;
    display: flex;
    gap: 5px;
    align-items: center;
}

/* Circle buttons for EN, PT, and Help */
.circle-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 14px;
    padding: 0;
}

.circle-btn.active {
    background-color: var(--teal-accent);
    color: #fff;
}

.btn-help {
    background-color: var(--orange);
    font-size: 18px;
    font-weight: 700;
}

.btn-help:hover {
    background-color: var(--hover);
}

.miner-select-group {
    padding: 10px 30px 15px 30px;
    background-color: var(--bg-color);
}

/* Content Section */
.content-section {
    padding: 5px 30px 0 30px;
}

.input-row-3col {
    display: flex;
    gap: 15px; /* Space between fields */
    margin-bottom: 25px; /* Space between this row and Tariff input below */
}

.input-row-3col .input-group {
    flex: 1 1 33.33%; /* Occupy ~33% of width, with capacity to grow/shrink */
    margin-bottom: 0; /* Remove default bottom margin to prevent accumulation */
}

/* Input Groups */
.input-group {
    margin-bottom: 5px;
}

/* Form Elements */
.input-label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: #000;
    margin-left: 2px;
    margin-bottom: 0.25rem;
}

.input-field-group {
    position: relative;
    margin-top: 0.25rem;
    border-radius: 0.375rem;
}

.input-field {
    width: 100%;
    padding: 10px 10px 10px 15px;
    border: 0;
    border-radius: 7px;
    font-family: var(--font-sans);
    font-size: 1.125rem;
    font-weight: 600;
    outline: none;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

.input-field:focus,
.input-field-price:focus {
    box-shadow: 0 0 0 2px var(--focus-ring);
}

.lang-en .input-field-price {
    padding-left: 2rem;
}

.input-field-price {
    padding-left: 2.5rem;
}

.input-unit {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    padding-right: 0.75rem;
    pointer-events: none;
}

.input-unit span {
    color: #000;
    font-size: 1rem;
    font-weight: 500;
}

.input-prefix {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    padding-left: 0.75rem;
    pointer-events: none;
}

.input-prefix span {
    color: #000;
    font-size: 1.05rem;
    font-weight: 500;
}

/* Utility for removing number input arrows */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

.input-helper {
    margin-left: 2px;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.25;
    color: #000;
    white-space: pre-line;
}

/* New style for the link inside the helper text */
.helper-link {
    color: var(--teal-accent);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
    transition: color 0.2s;
}

.helper-link:hover {
    color: #000;
}

/* Results Section */
.results-section {
    padding-top: 40px;
}

.results-title {
    /*    display: none;*/
    font-size: 1rem;
    font-weight: 700;
    color: #000;
    margin-left: 2px;
    margin-top: -15px;
    margin-bottom: 10px;
}

/* Results */
.result-box-neutral {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 1rem;
    background-color: var(--teal);
    border-radius: 7px 7px 0 0;
    border: 0;
    /*    margin-bottom: 0.5rem;*/
}

.result-box-highlight {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 1rem;
    background-color: var(--teal-accent);
    border-radius: 0 0 7px 7px;
    border: 0;
    margin-bottom: 0.5rem;
}

.result-label {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
}

.result-value-neutral {
    font-size: 1.5rem;
    font-weight: 900;
    color: #fff;
    white-space: nowrap;
}

.result-label-highlight {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
}

.result-value-highlight {
    font-size: 1.5rem;
    font-weight: 900;
    color: #fff;
    white-space: nowrap;
}

.footer-text {
    position: absolute;
    bottom: 30px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
    color: #000;
}

.footer-text a {
    color: var(--orange);
    text-decoration: none;
    font-weight: 500;
}

/* CUSTOM SELECT (DIV/UL) STYLING */

/* Container that encompasses the visible field and list */
.custom-select-wrapper {
    position: relative;
    z-index: 10;
    margin-top: 0.25rem;
}

/* The visible dropdown field (Where the selected value appears) */
/* Inherits input-field style for input appearance */
.custom-select-trigger {
    cursor: pointer;
    position: relative;
    padding-right: 2.5rem;
    display: flex;
    align-items: center;
    min-height: 40px;
    background-color: #fff;
    color: #f50;
    font-weight: 500;
}

/* Adds custom arrow to the visible field */
.custom-select-trigger::after {
    content: "▼";
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: #000;
    pointer-events: none;
    transition: transform 0.2s;
}

/* Arrow rotation when menu is active */
.custom-select-trigger.is-active::after {
    transform: translateY(-50%) rotate(180deg);
}

/* The options list that drops down (The pop-up) */
/* The options list that drops down (The pop-up) */
.custom-option:first-child {
    display: none;
}

.custom-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    border-radius: 0 0 7px 7px;
    border-top: none;
    background-color: #fff;
    box-shadow: 0 0 10px #000;
    z-index: 11;

    /* Animation setup - closed state */
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: scaleY(0);
    transform-origin: top;
    transition:
        max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.5s ease,
        transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Display list when 'is-open' */
.custom-options.is-open {
    max-height: 400px; /* Adjust based on your menu height */
    opacity: 1;
    transform: scaleY(1);
    margin-top: -3px;
    box-shadow: 0 15px 20px -8px rgba(0, 0, 0, 0.7);
}

/* Individual option style */
.custom-option {
    padding: 9px 16px;
    font-size: 1.15rem;
    font-weight: 500;
    color: #000;
    cursor: pointer;
    transition:
        background-color 0.1s,
        color 0.1s;
}

.custom-option:last-child {
    padding: 9px 16px 15px 16px;
}

/* HOVER style for options */
.custom-option:hover {
    background-color: var(--teal);
    color: #fff;
}

.custom-option:last-child:hover {
    background-color: var(--teal);
    border-radius: 0 0 7px 7px;
    color: #fff;
}

/* ---------------- Modal Miners ---------------- */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background-color: #fff;
    border-radius: 0.75rem;
    max-width: 650px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Initial state off-screen */
    transform: translateY(100vh); /* Slide in from bottom */
    opacity: 0;
    transition:
        transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1),
        opacity 0.6s ease-out; /* Smooth transition */
}

.modal-content.is-open {
    transform: translateY(0); /* Slide up to its natural position */
    opacity: 1; /* Fade in */
    /*margin-top: -80%;*/
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--teal);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    font-weight: 300;
    color: #fff;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.modal-body {
    padding: 10px;
}

.miner-table {
    width: 100%;
    border-collapse: collapse;
}

.miner-table th {
    padding: 10px 10px 15px 10px;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    color: #000;
    border-bottom: 2px solid #e5e7eb;
}

.miner-table td {
    padding: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: #000;
    border-bottom: 1px solid #eee;
}

.miner-table tbody tr:hover {
    background-color: #f0f0f0;
}

.miner-table tbody tr:last-child td {
    border-bottom: none;
}

/* ---------------- Modal Help More Info ---------------- */

.modal-help {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-help .modal-content {
    background-color: #fff;
    border-radius: 0.75rem;
    max-width: 650px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Initial state off-screen */
    transform: translateY(-100vh); /* Slide in from top */
    opacity: 0;
    transition:
        transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1),
        opacity 0.6s ease-out;
}

.modal-help .modal-content.is-open {
    transform: translateY(0);
    opacity: 1;
    margin-top: 0;
}

/* Help Modal Header */

.modal-header-help {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--orange);
}

.modal-help-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

/* Help Modal Body */
.modal-body-help {
    padding: 1.5rem;
}

.modal-body-help ul {
    list-style: none;
    padding: 0;
    margin: -10px 0 0 0;
}

.modal-body-help li {
    padding: 0.75rem 0;
    font-size: 1rem;
    font-weight: 500;
    color: #000;
    line-height: 1.5;
    border-bottom: 1px solid #ddd;
    position: relative;
    white-space: pre-line; /* ADD THIS */
}

.modal-body-help li:last-child {
    border-bottom: none;
}

.miner-examples-link {
    display: block;
    text-align: center;
    color: var(--orange);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s;
    margin-top: 30px;
    margin-bottom: 30px;
}

.miner-examples-link:hover {
    color: var(--hover);
}
