/**
 * Farm Helper — Global Styles
 * Theme-agnostic overrides and custom styles
 */

/* ── Farm-specific colors ─────────────────────────────────────────────────── */
:root {
    --fh-green: #2fb344;
    --fh-green-light: #d3f9d8;
    --fh-brown: #8b5e3c;
    --fh-soil: #6b4423;
}

/* ── Flag icons ───────────────────────────────────────────────────────────── */
.flag {
    display: inline-block;
    width: 1.5rem;
    height: 1.125rem;
    background-size: cover;
    background-position: center;
    border-radius: 2px;
    vertical-align: middle;
}

.flag-country-us { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Crect fill='%23BD3D44' width='512' height='512'/%3E%3Cpath fill='none' stroke='%23FFF' stroke-width='37' d='M0 96h512M0 192h512M0 288h512M0 384h512'/%3E%3Cpath fill='%23192F5D' d='M0 0h256v256H0z'/%3E%3C/svg%3E"); }
.flag-country-cn { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Crect fill='%23DE2910' width='512' height='512'/%3E%3Cpath fill='%23FFDE00' d='M128 128l16 48h-48l16-48zm64 32l8 24h-24l8-24zm32 48l8 24h-24l8-24zm32 48l8 24h-24l8-24zm32 48l8 24h-24l8-24z'/%3E%3C/svg%3E"); }
.flag-country-my { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Crect fill='%23012169' width='512' height='512'/%3E%3Crect fill='%23CC0001' y='128' width='512' height='384'/%3E%3Cpath fill='%23FFF' d='M0 128h512v32H0zm0 64h512v32H0zm0 64h512v32H0zm0 64h512v32H0z'/%3E%3Crect fill='%23012169' width='256' height='256'/%3E%3Ccircle fill='%23FFCC00' cx='128' cy='128' r='48'/%3E%3C/svg%3E"); }
.flag-country-th { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Crect fill='%23A51931' width='512' height='512'/%3E%3Crect fill='%23F4F5F8' y='85' width='512' height='342'/%3E%3Crect fill='%232D2A4A' y='170' width='512' height='172'/%3E%3C/svg%3E"); }
.flag-country-vn { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Crect fill='%23DA251D' width='512' height='512'/%3E%3Cpath fill='%23FFFF00' d='M256 128l48 148h-96l48-148zm0 0l-48 148h96l-48-148z'/%3E%3C/svg%3E"); }

/* ── Language switcher ────────────────────────────────────────────────────── */
.dropdown-item.active .flag {
    box-shadow: 0 0 0 2px var(--tblr-primary);
}

/* ── Dashboard map container ──────────────────────────────────────────────── */
#farmMap {
    min-height: 300px;
    z-index: 1;
}

/* ── Sensor chart containers ──────────────────────────────────────────────── */
canvas {
    max-width: 100%;
}

/* ── Custom status indicators ─────────────────────────────────────────────── */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.status-dot.online { background-color: var(--fh-green); }
.status-dot.offline { background-color: #d63939; }
.status-dot.warning { background-color: #f76707; }

/* ── Responsive adjustments ───────────────────────────────────────────────── */
@media (max-width: 768px) {
    .page-header {
        padding: 1rem 0;
    }

    .page-header .page-title {
        font-size: 1.25rem;
    }
}

/* ── Print styles ─────────────────────────────────────────────────────────── */
@media print {
    .navbar,
    .navbar-vertical,
    .footer,
    .btn,
    .dropdown-menu {
        display: none !important;
    }

    .page-wrapper {
        margin-left: 0 !important;
    }

    .card {
        break-inside: avoid;
        border: 1px solid #dee2e6;
    }
}

/* ── Badge text color fix ─────────────────────────────────────────────────── */
/* Tabler's .badge defaults to gray text (--tblr-secondary). Force white on
   solid bg-* badges; black on light backgrounds (warning, yellow, light). */
.badge:not([class*="-lt"]):not([class*="text-"]):not(.bg-warning):not(.bg-yellow):not(.bg-light) {
    color: #fff !important;
}
.badge.bg-warning,
.badge.bg-yellow,
.badge.bg-light {
    color: #000 !important;
}
