/*
 * Upay Crypto Calculator - FINAL Mobile & Formatting Fixes (Version 1.8.5 - Responsive Update)
 * - Major update to mobile styling to reduce font sizes and prevent overflow.
 */

/* Define the Upay Green color variable */
:root {
    --upay-green: #00CC99; /* Upay Green */
}

/* ============================
   Base Styles and Layout (Desktop Default)
   ============================ */

.upaycc-wrap {
    max-width: 900px !important;
    margin: 2rem auto !important;
    padding: 2.5rem !important; 
    background-color: #000000 !important;
    color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 255, 0, 0.2); 
    font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
    /* Base font size for desktop */
    font-size: 1.4rem; 
    border: 2px solid var(--upay-green); 
    flex-direction: row !important; 
    /* display: flex and gap: 2rem are handled by the inline style in PHP */
}

.upaycc-left {
    flex: 2 !important; 
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.upaycc-right {
    flex: 1 !important; 
    display: flex;
    flex-direction: column;
    justify-content: center !important; 
    
    background-color: #1a1a1a !important; 
    padding: 2.5rem;
    border-radius: 12px;
    color: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 255, 0, 0.2); 
    border: 1px solid var(--upay-green); 
}


/* ============================
   Input Cards and Elements
   ============================ */

.upaycc-card {
    background-color: #1a1a1a !important; 
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--upay-green); 
    transition: box-shadow 0.3s ease;
}

.upaycc-card label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 600;
    color: var(--upay-green); 
    font-size: 1.5rem;
}

.upaycc-card select,
.upaycc-card input {
    width: 100%;
    padding: 1.2rem;
    border: 1px solid var(--upay-green); 
    border-radius: 8px;
    background-color: #000000 !important; 
    color: #ffffff !important; 
    font-size: 1.4rem;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.upaycc-row2 {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 576px) {
    .upaycc-row2 {
        flex-direction: row;
    }
}

/* --- Select2 Styling --- */
.select2-container .select2-selection--single {
    height: 60px;
    border: 1px solid var(--upay-green); 
    border-radius: 8px;
    background-color: #000000 !important; 
    padding: 1rem 1rem;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #ffffff;
    line-height: 40px;
}

/* ============================
   Result Section Styling
   ============================ */

.upaycc-results {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.upaycc-rrow {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; 
    padding: 0.75rem 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
}

.upaycc-rrow:last-child {
    border-bottom: none;
}

.upaycc-rrow span {
    font-size: 1.5rem;
    color: #bbbbbb;
    font-weight: 500;
    white-space: nowrap; 
    margin-right: 1rem;
    flex-shrink: 0; 
}

.upaycc-rrow strong {
    font-size: 1.3rem; 
    font-weight: 700;
    color: var(--upay-green); 
    word-break: break-all;
    text-align: right;
    flex-shrink: 1; 
    min-width: 0; 
}

/* Specific result colors */
#upaycc-res-profit.upaycc-profit {
    color: var(--upay-green); 
}

#upaycc-res-profit.upaycc-loss {
    color: #ff3333; 
}

/* --- Clear Button --- */
.upaycc-clear-btn {
    background-color: transparent;
    border: 2px solid var(--upay-green); 
    color: var(--upay-green); 
    padding: 0.8rem 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
    margin-top: 1rem;
    align-self: flex-start;
}

/* ============================
   MOBILE OPTIMIZATION (max-width: 768px)
   ============================ */

@media (max-width: 768px) {
    .upaycc-wrap {
        flex-direction: column !important; /* Forces columns to stack */
        gap: 1rem !important;
        padding: 1.25rem !important; /* Reduced padding */
        font-size: 1.2rem; /* Reduced base font size */
    }
    .upaycc-left, .upaycc-right {
        width: 100% !important;
        flex: 1 !important;
        min-width: unset !important;
    }

    /* Input Card Adjustments */
    .upaycc-card {
        padding: 1rem; /* Reduced card padding */
    }

    .upaycc-card label {
        font-size: 1.3rem; /* Reduced label font size */
        margin-bottom: 0.5rem;
    }

    .upaycc-card select,
    .upaycc-card input {
        padding: 0.8rem; /* Reduced input padding */
        font-size: 1.2rem; /* Reduced input font size */
    }

    /* Select2 Adjustments */
    .select2-container .select2-selection--single {
        height: 48px; /* Reduced height */
        padding: 0.5rem 0.5rem; /* Reduced padding */
    }
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 32px; /* Adjusted line height */
    }

    /* Results Adjustments for Small Screens */
    .upaycc-right {
        padding: 1.5rem; /* Reduced results card padding */
    }
    .upaycc-rrow span {
        font-size: 1.2rem; /* Reduced label size */
        margin-right: 0.5rem;
    }
    .upaycc-rrow strong {
        font-size: 1.1rem; /* Further reduced result value size to prevent overflow */
    }

    .upaycc-clear-btn {
        padding: 0.6rem 1.2rem;
        font-size: 1rem;
    }
}