/* ============================================
   CropBook - Estilos Customizados
   ============================================ */

/* --------------------------------------------
   CSS Variables - Cores da Marca CropBook
   -------------------------------------------- */
:root {
    /* Cores principais */
    --cropbook-green-dark: #1a5d1a;
    --cropbook-green: #3e8e41;
    --cropbook-green-light: #6ab04c;
    --cropbook-green-accent: #90EE90;
    
    /* Gradientes */
    --cropbook-gradient-primary: linear-gradient(135deg, #1a5d1a 0%, #3e8e41 50%, #6ab04c 100%);
    --cropbook-gradient-horizontal: linear-gradient(90deg, #1a5d1a 0%, #3e8e41 100%);
    --cropbook-gradient-dark: linear-gradient(135deg, #1a5d1a 0%, #3e8e41 100%);
    
    /* Backgrounds */
    --cropbook-bg-light: #f5f5f5;
    --cropbook-bg-surface: #fafafa;
    --cropbook-bg-white: #ffffff;
    --cropbook-bg-overlay: rgba(255, 255, 255, 0.95);
    --cropbook-bg-glass: rgba(255, 255, 255, 0.1);
    
    /* Texto */
    --cropbook-text-white: #ffffff;
    --cropbook-text-white-secondary: rgba(255, 255, 255, 0.85);
    --cropbook-text-white-muted: rgba(255, 255, 255, 0.7);
    
    /* Grid heights */
    --grid-list-height: calc(100vh - 265px);
    --grid-popup-height: calc(100vh - 265px);
    --grid-list2-height: calc(100vh - 265px);
}

/* --------------------------------------------
   Cores de Texto
   -------------------------------------------- */
.text-cropbook-green-dark { color: var(--cropbook-green-dark) !important; }
.text-cropbook-green { color: var(--cropbook-green) !important; }
.text-cropbook-green-light { color: var(--cropbook-green-light) !important; }
.text-white { color: var(--cropbook-text-white) !important; }
.text-white-secondary { color: var(--cropbook-text-white-secondary) !important; }
.text-white-muted { color: var(--cropbook-text-white-muted) !important; }

/* --------------------------------------------
   Backgrounds
   -------------------------------------------- */
.bg-cropbook-gradient { background: var(--cropbook-gradient-primary) !important; }
.bg-cropbook-gradient-horizontal { background: var(--cropbook-gradient-horizontal) !important; }
.bg-cropbook-gradient-dark { background: var(--cropbook-gradient-dark) !important; }
.bg-cropbook-green-dark { background-color: var(--cropbook-green-dark) !important; }
.bg-cropbook-green { background-color: var(--cropbook-green) !important; }
.bg-cropbook-green-light { background-color: var(--cropbook-green-light) !important; }
.bg-light { background-color: var(--cropbook-bg-light) !important; }
.bg-surface { background-color: var(--cropbook-bg-surface) !important; }
.bg-overlay { background: var(--cropbook-bg-overlay) !important; }
.bg-glass { 
    background: var(--cropbook-bg-glass) !important; 
    backdrop-filter: blur(10px);
}

/* --------------------------------------------
   Tipografia
   -------------------------------------------- */
.font-weight-semibold { font-weight: 600 !important; }
.font-weight-bold { font-weight: 700 !important; }
.text-transform-none { text-transform: none !important; }
.letter-spacing-normal { letter-spacing: normal !important; }
.letter-spacing-wide { letter-spacing: 0.5px !important; }

/* --------------------------------------------
   Layout e Espaçamento
   -------------------------------------------- */
.min-height-100vh { min-height: 100vh; }
.h-100 { height: 100% !important; }
.w-100 { width: 100% !important; }

/* --------------------------------------------
   Bordas e Sombras
   -------------------------------------------- */
.rounded-xl { border-radius: 16px !important; }
.rounded-2xl { border-radius: 24px !important; }

/* Bordas coloridas para cards selecionados */
.mud-border-primary { border: 2px solid var(--mud-palette-primary) !important; }
.mud-border-secondary { border: 2px solid var(--mud-palette-secondary) !important; }
.mud-border-info { border: 2px solid var(--mud-palette-info) !important; }
.mud-border-success { border: 2px solid var(--mud-palette-success) !important; }
.mud-border-warning { border: 2px solid var(--mud-palette-warning) !important; }
.mud-border-error { border: 2px solid var(--mud-palette-error) !important; }
.mud-border-dark { border: 2px solid var(--mud-palette-dark) !important; }

/* Cursor pointer para elementos clicáveis */
.cursor-pointer { cursor: pointer; }
.cursor-pointer:hover { opalocality: 0.9; }

/* --------------------------------------------
   Botões CropBook
   -------------------------------------------- */
.btn-cropbook-primary {
    background: var(--cropbook-green) !important;
    color: white !important;
}
.btn-cropbook-primary:hover {
    background: var(--cropbook-green-dark) !important;
}

.btn-cropbook-white {
    background: white !important;
    color: var(--cropbook-green-dark) !important;
}
.btn-cropbook-white:hover {
    background: #f5f5f5 !important;
}

.btn-cropbook-outline {
    border-color: white !important;
    color: white !important;
    background: transparent !important;
}
.btn-cropbook-outline:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* --------------------------------------------
   Cards e Painéis
   -------------------------------------------- */
.card-elevated {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.card-glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 16px;
}

/* --------------------------------------------
   Estados de Ícones
   -------------------------------------------- */
.icon-success { color: var(--cropbook-green) !important; }
.icon-success-light { color: var(--cropbook-green-light) !important; }

/* --------------------------------------------
   MudBlazor Overrides
   -------------------------------------------- */
.mud-list.mud-list-padding {
    padding: 0;
}

.mud-button-label {
    padding-left: 5px;
    padding-right: 5px;
}

/* Nav links ativos */
.mud-nav-link.active {
    background-color: rgba(62, 142, 65, 0.1) !important;
    border-left: 3px solid var(--cropbook-green);
}

.mud-nav-link.active .mud-nav-link-text {
    color: var(--cropbook-green-dark) !important;
    font-weight: 600;
}

/* AppBar transparente sobre gradiente */
.appbar-transparent {
    background: transparent !important;
    box-shadow: none !important;
}

/* --------------------------------------------
   Loading Progress (Blazor)
   -------------------------------------------- */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--cropbook-green);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

.linear-progress {
    background: silver;
    width: 50vw;
    margin: 20% auto;
    height: 1rem;
    border-radius: 10rem;
    overflow: hidden;
    position: relative;
}

.linear-progress:after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--cropbook-green);
    scale: var(--blazor-load-percentage, 0%) 100%;
    transform-origin: left top;
    transition: scale ease-out 0.5s;
}

/* --------------------------------------------
   Error UI (Blazor)
   -------------------------------------------- */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    margin: 20px 0;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgz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ink ~ label.mud-input-label.mud-input-label-inputcontrol {
    color: black; 
    font-size: 1.1rem;
}



.mud-input.mud-input-filled {
    position: relative;
    transition: background-color 200ms cubic-bezier(0,0,.2,1) 0ms;
    background-color: rgba(0,0,0,0.04);
    border-radius: 4px;
}


.mud-table-root .mud-table-head .mud-table-cell {
    font-weight: 600 !important;
    line-height: 1.5rem;
}

.mud-table-dense * .mud-table-row .mud-table-cell {
    padding: 6px 6px 6px 6px;
    padding-inline-start: 6px;
    padding-inline-end: 6px;
}

.mud-table-row-pointer .mud-table-body .mud-table-cell:hover {
    cursor: pointer;
}

.mud-expand-panel .mud-expand-panel-header {
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
    background-color: var(--mud-palette-background-gray);
}


.mud-expand-panel.mud-panel-expanded {
    margin: 16px 0;
    border-radius: inherit;
    transition-delay: 0ms;
}

.mud-expand-panel {
    flex: 1 0 100%;
    max-width: 100%;
    position: relative;
    transition: margin .3s cubic-bezier(.25,.8,.5,1);
    transition-delay: 100ms;
    color: var(--mud-palette-text-primary);
    background-color: var(--mud-palette-surface);
    margin-top: 8px;
}

    .mud-expand-panel.mud-expand-panel-border {
        border-bottom: 0px solid var(--mud-palette-lines-default);
    }

    .mud-expand-panel:last-child {
        border-bottom-left-radius: inherit;
        border-bottom-right-radius: inherit;
    }

    .mud-expand-panel .mud-expand-panel-content {
        padding:0;
        flex: 1 1 auto;
        max-width: 100%;
    }

.text-muted {
    color: #6c757d;
}

input.mud-input-slot {
    text-transform: var(--text-transform, none);
}

/*
    Alinha o texto do cabeçalho da tabela no centro
*/
.mud-simple-table table * tr > td, .mud-simple-table table * tr th {
    text-align: center !important;
    padding: 6px !important;
}

/*
  Altera o tamanho do icon size smal dos botões
*/
.mud-icon-size-small {
    font-size: 1rem;
}
/*
    ALtera o tamanho do start icon dos botões
*/
.mud-button-icon-size-small > *:first-child {
    font-size: 12px;
}


/* site.css */
.main-layout-background {
    background-image: url('/images/logo.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    height: 100vh;
    width: 100%;
}

/* Full-screen splash screen styling with background image */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /*background: url('/images/Farmtrac-background-logo.png') no-repeat center center;*/
    background-color: #dedfdc;
    background-size: cover; /* Make sure the image covers the entire screen */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: opalocality 0.5s ease-out;
}

/* Popup container styling */
#splash-screen-popup {
    font-family: var(--body-font);
    -webkit-font-smoothing: antialiased;
    background-color: white;
    color: rgb(73, 72, 71);
    --accent-fill-rest: #d3d3d3;
    user-select: none;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-align: center;
    width: 500px;
    height: 300px;
}

/* Fade-out animation for splash screen */
#splash-screen.hidden {
    opalocality: 0;
    pointer-events: none;
}

/* Text styling inside the popup */
#splash-screen-popup h1 {
    font-size: 32px;
    font-weight: 600;
    margin-top: 12px;
    line-height: 30px;
    margin: 12px 0px 0px 0px;
    user-select: none;
    outline:none;
}

#splash-screen-popup h2 {
    font-size: 24px;
    font-weight: 400;
    line-height: 32px;
    margin: 24px 0px 50px 0px;
    user-select: none;
    outline: none;
}

#splash-screen-popup h3 {
    font-size: 12px;
    font-weight: 300;
    margin: 0px;
    user-select: none;
    outline: none;
}


/* --------------------------------------------
   Leaflet Map Customizations
   -------------------------------------------- */

/* Garantir que os controlos de zoom ficam bem posicionados */
.leaflet-control-zoom {
    margin-top: 10px !important;
}

/* Custom vertex markers (polygon corners) */
.leaflet-vertex-icon {
    background-color: #ffffff !important;
    border: 2px solid #2e7d32 !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    cursor: move !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

.leaflet-vertex-icon:hover {
    transform: scale(1.3) !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4) !important;
    border-color: #1b5e20 !important;
}

/* Middle markers (add new vertex) */
.leaflet-middle-icon {
    background-color: #e8f5e9 !important;
    border: 2px dashed #4caf50 !important;
    border-radius: 50% !important;
    opalocality: 0.8 !important;
    cursor: crosshair !important;
}

.leaflet-middle-icon:hover {
    background-color: #c8e6c9 !important;
    opalocality: 1 !important;
    transform: scale(1.2) !important;
}

/* Drawing line style */
.leaflet-draw-guide-dash {
    stroke: #2e7d32 !important;
    stroke-width: 2 !important;
    stroke-dasharray: 5, 5 !important;
}

/* Toolbar styling */
.leaflet-draw-toolbar a {
    background-color: #ffffff !important;
    border-radius: 4px !important;
}

.leaflet-draw-toolbar a:hover {
    background-color: #e8f5e9 !important;
}

/* Edit handlers */
.leaflet-editing-icon {
    background-color: #ffffff !important;
    border: 2px solid #2e7d32 !important;
    border-radius: 50% !important;
    width: 12px !important;
    height: 12px !important;
    margin-left: -6px !important;
    margin-top: -6px !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

/* Delete marker style */
.leaflet-marker-icon.leaflet-div-icon.leaflet-editing-icon {
    background-color: #ffffff !important;
    border: 2px solid #2e7d32 !important;
    border-radius: 50% !important;
}


#splash-screen-popup p {
    user-select: none;
    outline: none;
}


#splash-screen-popup img {
    width: 200px;
    height: 70px;
    margin: 20px 0px 0px 0px;
    outline: none;
}

/* Loading bar container */
.loading-bar-container {
    height: 1px;
    background-color: rgba(0, 0, 0, 0.1);
    width: 70%;
    border-radius: 1px;
    overflow: hidden;
    margin: 20px auto;
}

/* Fluent UI progress bar element */
.loading-bar {
    width: 100%;
    border-radius: 2px;
    height: 4px;
    background-color: #1E88E5;
    animation: indeterminateAnimation 0.75s infinite linear;
    transform-origin: 0% 50%;
}

/* Keyframes for the indeterminate progress bar */
@keyframes indeterminateAnimation {
    0% {
        transform: translateX(0) scaleX(0);
    }

    40% {
        transform: translateX(0) scaleX(0.4);
    }

    100% {
        transform: translateX(100%) scaleX(0.5);
    }
}


.app-logo {
    width: 57px;
    height: 40px; /* This will maintain the aspect ratio */
    margin-left: 0px
}


.table-row-selected {
    background-color: #DDDDDD !important;
}

.mud-input-control.mud-field .mud-input-slot {
    height: auto;
    min-height: var(--field-min-height, 17px); /* fallback is 50px */
}


.font-weight-bold {
    font-weight: 600 !important;
}

.mud-breadcrumb-separator {
    padding: 0 4px;
}
