/*
 * File: rate-calculator.css
 * Location: /wp-content/plugins/rate-calculator/css/
 * Description: Styles for the Live Market Rates & Calculator widget, 
 * including dark mode theme variables and layout.
*/

/* ========================================
1. THEME VARIABLES (DARK MODE SUPPORT)
========================================
*/
:root {
    /* General Theme Colors (Light Mode Default) */
    --widget-bg: #F8F8F8;        /* Main container background */
    --card-bg: #FFFFFF;          /* Card background (brighter than widget-bg) */
    --border-color: #D0D0D0;     /* Border for structure definition */
    --text-color: #333333;
    --subtle-text-color: #555555;
    --input-bg: #F0F0F0;
    --close-btn-color: #333;

    /* Accent Colors (Remain constant for branding) */
    --silver-color: #007A3E;    /* Primary Green */
    --idr-color: #105671;       /* Secondary Blue */
    --stackers-color: #FFD700;  /* Accent Gold */
}

/* --- Dark Mode Overrides (Assumes template uses 'body.color-switch-dark') --- */
body.color-switch-dark :root,
body.color-switch-dark .calculator-widget {
    --widget-bg: #1A1A1A;       
    --card-bg: #2C2C2C;         
    --border-color: #444444;    
    --text-color: #EEEEEE;      
    --subtle-text-color: #AAAAAA; 
    --input-bg: #1A1A1A;
    --close-btn-color: #DDDDDD;
}

/* Apply base text and background colors to the whole widget */
.calculator-widget {
    color: var(--text-color);
    background-color: var(--widget-bg);
}

/* ========================================
2. GLOBAL STRUCTURE & LAYOUT
========================================
*/
.calculator-container {
    padding: 2.5rem;
    border: 1px solid var(--border-color);
    background-color: var(--widget-bg); 
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15); 
}

.rate-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .rate-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .rate-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
3. RATE CARDS
========================================
*/
.rate-card {
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    /* Explicit border properties for colored top line */
    border-top-width: 8px;
    border-top-style: solid;
    border-top-color: var(--border-color); /* Default color, will be overridden */
    
    border-radius: 8px;
    text-align: center;
    position: relative; 
    background-color: var(--card-bg); 
}

/* --- IMPROVEMENT: Reduce horizontal padding on small screens to fit numbers --- */
@media (max-width: 500px) {
    .rate-card {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

.stackers-card { 
    border-top-color: var(--stackers-color);
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.stackers-card:hover {
    box-shadow: 0 0 0 2px var(--stackers-color); 
}

.silver-card { border-top-color: var(--silver-color); }
.idr-card { border-top-color: var(--idr-color); }

/* Content height placeholder */
#silver-container,
#idr-rate-container,
#stackers-container {
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* --- IMPLEMENTED IMPROVEMENTS for Rate Value --- */
.rate-value {
    /* 1. Requested: Font size reduced by 2 steps */
    font-size: 1.85rem; 
    
    /* 2. Requested: Increased visual weight */
    font-weight: 900;
    text-shadow: 0 0 1px currentColor, 0 0 1px currentColor; 
    
    /* 3. Fix for mobile wrapping issue (seen in screenshot) */
    white-space: nowrap;
    
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

/* Sublte text color for time/formula */
.update-time, 
.rate-formula,
.data-loading p {
    color: var(--subtle-text-color);
}

/* --- IMPROVEMENT: Ensure card titles are very bold for consistency --- */
.rate-card h3 { 
    font-weight: 900; 
}


/* COLOR THE RATE NUMBERS TO MATCH THEIR CARD ACCENTS */
.silver-card .rate-value { color: var(--silver-color); }
.idr-card .rate-value { color: var(--idr-color); }
.stackers-card .rate-value { color: var(--stackers-color); }

/*
========================================
4. PREMIUM CONTROL (OVERLAY)
========================================
*/
#margin-rate-control {
    margin-top: 0; 
    padding: 1.5rem 1rem 1rem 1rem; 
    border: 1px solid var(--stackers-color);
    border-radius: 4px;
    background-color: var(--card-bg); 
    text-align: left;
    position: absolute; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
    width: 90%; 
    z-index: 10;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.close-btn {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--close-btn-color);
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    padding: 5px;
}
.close-btn:hover {
    color: var(--text-color);
}

#margin-rate-control label,
#margin-rate-control input,
#margin-rate-control button {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    vertical-align: middle;
}
#premium-input {
    width: 80px;
    text-align: center;
    padding: 0.25rem;
    border: 1px solid var(--border-color); 
    border-radius: 4px;
    color: var(--text-color);
    background-color: var(--input-bg); 
}
#set-premium-btn {
    background-color: var(--stackers-color);
    color: #333; 
    font-weight: bold;
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
#set-premium-btn:hover {
    opacity: 0.9;
}

/* ========================================
5. HINT, BUTTON & INFO
========================================
*/
.stackers-card-hint {
    grid-column: 1 / -1; 
    text-align: center;
    margin-top: -1.25rem; 
    margin-bottom: 2rem; 
    font-size: 0.8rem;
    color: var(--subtle-text-color);
    padding-bottom: 0.5rem; 
}

@media (min-width: 768px) {
    .stackers-card-hint {
        grid-column: 2 / 3;
    }
}

@media (min-width: 1024px) {
    .stackers-card-hint {
        grid-column: 3 / 4;
    }
}

.refresh-button-container {
    text-align: center;
    margin-bottom: 2rem;
}

.rate-button {
    background-color: var(--silver-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* --- IMPROVEMENT: Button shadow for depth and hover effect --- */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2); 
}
.rate-button:hover {
    opacity: 0.9;
    /* --- IMPROVEMENT: Slight movement on hover --- */
    transform: translateY(-1px); 
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.3); 
}

/* Info section remains fixed background/text for high contrast */
.calculator-info {
    background-color: var(--silver-color); 
    color: white; 
    padding: 1.5rem;
    border-radius: 8px;
}

/* --- FIX FOR WRAPPING 'IMPORTANT INFORMATION' TITLE ON MOBILE --- */
@media (max-width: 500px) {
    .calculator-info {
        /* Reduce left and right padding from 1.5rem to 1rem to gain space for the title */
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

.calculator-info a {
    color: var(--stackers-color); 
    text-decoration: underline;
}
.calculator-info h3 {
    /* --- NEW: Bold White color for the title --- */
    color: white; 
    font-weight: 900;
    
    border-bottom: 1px solid var(--stackers-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}
.calculator-info ul {
    list-style: disc;
    margin-left: 1.5rem;
}

/* Ensure spinner colors are set based on card accent colors, not text color */
.spinner circle { opacity: 0.25; }