/* Farm Easy Theme - Enhanced */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;700&display=swap');

:root {
    --sky-top: #00B4DB;
    --sky-bottom: #87CEEB;
    --grass-light: #7CFC00;
    --grass-dark: #32CD32;
    --dirt: #8B4513;
    --wood-light: #DEB887;
    --wood-dark: #8B4513;
    --barn-red: #D32F2F;
    --sun-yellow: #FFD700;
    --cloud-white: #FFFFFF;
    --text-dark: #333;
    --card-bg: #FFF8DC;
    /* Cornsilk for a warmer look */
}

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(to bottom, var(--sky-top), var(--sky-bottom));
    margin: 0;
    padding: 0;
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Sun */
.sun {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 80px;
    height: 80px;
    background: var(--sun-yellow);
    border-radius: 50%;
    box-shadow: 0 0 40px var(--sun-yellow);
    z-index: -2;
    animation: pulseSun 4s infinite alternate;
}

@keyframes pulseSun {
    from {
        box-shadow: 0 0 20px var(--sun-yellow);
        transform: scale(1);
    }

    to {
        box-shadow: 0 0 60px var(--sun-yellow);
        transform: scale(1.1);
    }
}

/* Clouds Container */
.clouds-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.cloud {
    position: absolute;
    background: var(--cloud-white);
    border-radius: 50px;
    opacity: 0.8;
    animation: floatCloud linear infinite;
}

.cloud::after,
.cloud::before {
    content: '';
    position: absolute;
    background: inherit;
    border-radius: 50%;
}

/* Cloud Variations */
.cloud-1 {
    top: 10%;
    width: 120px;
    height: 40px;
    animation-duration: 60s;
    left: -150px;
}

.cloud-1::after {
    width: 50px;
    height: 50px;
    top: -25px;
    left: 20px;
}

.cloud-1::before {
    width: 40px;
    height: 40px;
    top: -15px;
    left: 60px;
}

.cloud-2 {
    top: 25%;
    width: 100px;
    height: 35px;
    animation-duration: 45s;
    animation-delay: -20s;
    left: -150px;
    opacity: 0.6;
    transform: scale(0.8);
}

.cloud-2::after {
    width: 40px;
    height: 40px;
    top: -20px;
    left: 15px;
}

.cloud-3 {
    top: 15%;
    width: 150px;
    height: 50px;
    animation-duration: 70s;
    animation-delay: -10s;
    left: -200px;
}

.cloud-3::after {
    width: 60px;
    height: 60px;
    top: -30px;
    left: 25px;
}

.cloud-3::before {
    width: 50px;
    height: 50px;
    top: -20px;
    left: 80px;
}

@keyframes floatCloud {
    from {
        transform: translateX(-200px);
    }

    to {
        transform: translateX(100vw);
    }
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(5px);
    padding: 10px 20px;
    border-bottom: 4px solid var(--wood-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

h1 {
    font-family: 'Fredoka One', cursive;
    color: var(--barn-red);
    margin: 0;
    font-size: 1.8rem;
    text-shadow: 2px 2px 0px #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.hud-stats {
    display: flex;
    gap: 10px;
}

.stat-pill {
    background: var(--card-bg);
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: bold;
    border: 2px solid var(--wood-dark);
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1);
}

.stat-pill.profit {
    color: #2E7D32;
    background-color: #E8F5E9;
}

.stat-pill.loss {
    color: #C62828;
    background-color: #FFEBEE;
}

/* Main Farm Container */
.farm-container {
    flex: 1;
    padding: 20px;
    display: grid;
    /* Smaller cards: min 240px instead of 280px */
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    padding-bottom: 80px;
    align-items: start;
    /* Prevents cards from stretching */
}

/* Bot Card */
.bot-card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 3px solid var(--wood-dark);
    overflow: hidden;
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.1);
    height: auto;
    /* Ensure height fits content */
}

.bot-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.15);
}

.bot-header {
    background: var(--barn-red);
    color: white;
    padding: 8px;
    text-align: center;
    font-family: 'Fredoka One', cursive;
    font-size: 1.1rem;
    border-bottom: 3px solid var(--wood-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bot-body {
    padding: 12px;
    /* Removed flex: 1 to prevent stretching */
    background: url('data:image/svg+xml;utf8,<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><g fill="%23DEB887" fill-opacity="0.2"><path d="M0 0h20v20H0z"/></g></svg>');
    /* Subtle wood texture */
}

.bot-status {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    z-index: 2;
}

.status-online {
    background-color: #00E676;
    box-shadow: 0 0 8px #00E676;
}

.status-offline {
    background-color: #FF1744;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.9rem;
    border-bottom: 1px dashed rgba(139, 69, 19, 0.2);
    padding-bottom: 2px;
}

.metric-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.metric-label {
    color: #5D4037;
    font-weight: 600;
}

.metric-value {
    font-weight: bold;
    color: #3E2723;
}

/* Footer */
footer {
    background: linear-gradient(to bottom, var(--grass-light), var(--grass-dark));
    height: 50px;
    margin-top: auto;
    border-top: 6px solid #558B2F;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #1B5E20;
    font-weight: bold;
    font-family: 'Fredoka One', cursive;
    position: relative;
    font-size: 0.9rem;
}

/* Detail View */
.barn-panel {
    background: var(--card-bg);
    border: 4px solid var(--wood-dark);
    border-radius: 15px;
    padding: 20px;
    max-width: 800px;
    margin: 20px auto;
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.15);
}

.back-btn {
    display: inline-block;
    background: var(--wood-dark);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    margin-bottom: 15px;
    transition: transform 0.2s;
}

.back-btn:hover {
    transform: scale(1.05);
}

.trade-list th {
    background: var(--wood-light);
    color: #3E2723;
    border-bottom: 2px solid var(--wood-dark);
}

@media (max-width: 600px) {
    .hud-stats {
        flex-direction: column;
        gap: 5px;
    }

    margin: 10px auto;
}

/* Adjust Info Grid for mobile */
.barn-panel>div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    /* Stack columns */
    gap: 10px !important;
}

/* Adjust Stats Cards Grid */
.barn-panel>div[style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
    /* Stack cards vertically */
}

.metric-value {
    font-size: 1.1em !important;
    /* Reduce font size */
}

/* Table adjustments */
.trade-list th,
.trade-list td {
    padding: 5px !important;
    font-size: 0.8rem;
}

h2 {
    font-size: 1.2rem;
}

h3 {
    font-size: 1.1rem;
    margin-top: 20px;
}
}

/* Custom Scrollbar for Farm Theme */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: #bbb;
    /* Neutral grey like the screenshot */
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: content-box;
}


/* Utility to hide scrollbar but allow scrolling */
.hidden-scroll {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.hidden-scroll::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}