:root {
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.8);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --glass-blur: blur(20px);
    --primary-color: #2e7d32;
    --primary-dark: #1b5e20;
    --primary-light: #4caf50;
    --font-family-base: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --kendo-font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --text-color: #222222;
    --text-secondary: #555;
    --text-muted: #888;
    --error-bg: #fef2f2;
    --error-border: #fecaca;
    --error-text: #dc2626;
    --success-bg: #f0fdf4;
    --success-border: #bbf7d0;
    --success-text: #16a34a;
}

.dark-mode {
    --glass-bg: rgba(30, 30, 30, 0.95);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    --text-color: #f3f4f6;
    --text-secondary: #aaa;
    --text-muted: #777;
}

html {
    font-family: var(--font-family-base);
}

.k-body,
body {
    font-family: var(--font-family-base);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.light-mode {
    background-color: #f4f5f7;
}

body.dark-mode {
    background-color: #121212;
}

/* Drawer Font Awesome Icons */
.k-drawer-icon {
    width: 20px;
    text-align: center;
    margin-right: 15px;
    flex-shrink: 0;
    font-size: 1.1rem;
}

/* Auth Background — self-contained with its own background image */
.auth-background {
    position: relative;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: url('../assets/fruit_factory_bg.jpg') center/cover no-repeat;
    padding: 1rem;
    overflow: hidden;
}

/* Dark overlay on top of the background image */
.auth-background::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1;
}

/* Decorative floating shape */
.auth-background::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    top: -80px;
    right: -80px;
    z-index: 1;
}

@media (min-width: 768px) {
    .auth-background::after {
        width: 500px;
        height: 500px;
        top: -150px;
        right: -150px;
    }
}

/* Auth Card */
.auth-card {
    position: relative;
    z-index: 2;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 20px;
    padding: 1.75rem 1.5rem;
    width: 100%;
    max-width: 400px;
    animation: authFadeIn 0.5s ease-out;
    transition: padding 0.3s ease;
}

@media (min-width: 480px) {
    .auth-card {
        padding: 2.25rem 2rem;
    }
}

@media (min-width: 768px) {
    .auth-card {
        padding: 2.5rem;
    }
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Auth Brand Header */
.auth-brand {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-brand h1 {
    color: var(--primary-color);
    font-weight: 800;
    font-size: 1.6rem;
    margin: 0;
    letter-spacing: -0.02em;
}

.auth-brand p {
    color: var(--text-secondary);
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
}

@media (min-width: 480px) {
    .auth-brand h1 {
        font-size: 1.8rem;
    }
}

/* Auth Page Title */
.auth-title {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-title h2 {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.2rem;
    margin: 0 0 0.35rem;
}

.auth-title p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.4;
}

/* Form Groups - Mobile friendly touch targets */
.auth-field {
    margin-bottom: 1rem;
}

.auth-field label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
}

/* Override Telerik input height for mobile touch */
.auth-field .k-textbox,
.auth-field .k-input {
    border-radius: 10px;
    min-height: 48px;
}

.auth-field .k-input-inner {
    font-family: var(--font-family-base);
    font-size: 16px !important; /* Prevent iOS zoom on focus */
    padding: 0.75rem 0.5rem; /* Reduced horizontal padding to accommodate prefix/suffix */
}

/* Fix prefix and suffix alignment, margins, padding, and icons */
.auth-field .k-input-prefix {
    padding: 0 0.75rem;
    color: var(--text-muted);
    border-right: none !important;
}

.auth-field .k-input-suffix {
    padding: 0 0.5rem;
    color: var(--text-muted);
    border-left: none !important;
}

.auth-field .k-input-separator {
    display: none !important;
}

.auth-field .k-input-prefix svg,
.auth-field .k-input-suffix svg {
    width: 1.25rem;
    height: 1.25rem;
    opacity: 0.7;
}

.auth-field .k-input-suffix .k-button {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0.5rem;
    color: var(--text-muted);
}

.auth-field .k-input-suffix .k-button:hover {
    color: var(--primary-color);
}

/* Fix Autofill styling on glass */
.auth-field input:-webkit-autofill,
.auth-field input:-webkit-autofill:hover, 
.auth-field input:-webkit-autofill:focus, 
.auth-field input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: #222222 !important;
    transition: background-color 5000s ease-in-out 0s;
}

.dark-mode .auth-field input:-webkit-autofill,
.dark-mode .auth-field input:-webkit-autofill:hover, 
.dark-mode .auth-field input:-webkit-autofill:focus, 
.dark-mode .auth-field input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #2d2d2d inset !important;
    -webkit-text-fill-color: #f3f4f6 !important;
}

/* Validation messages */
.auth-field .k-field-info {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* Alert Messages */
.auth-alert {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    line-height: 1.4;
}

.auth-alert-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error-text);
}

.auth-alert-success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success-text);
}

.dark-mode .auth-alert-error {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
}

.dark-mode .auth-alert-success {
    background: rgba(22, 163, 74, 0.1);
    border-color: rgba(22, 163, 74, 0.3);
}

/* Auth Submit Button */
.auth-btn {
    width: 100%;
    min-height: 48px;
    border-radius: 10px !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    margin-top: 0.5rem;
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #ffffff !important;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s !important;
}

.auth-btn:hover {
    transform: translateY(-1px);
    background-color: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
    box-shadow: 0 4px 14px rgba(46, 125, 50, 0.35);
}

.auth-btn:active {
    transform: translateY(0);
}

/* Auth Links */
.auth-links {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    padding: 0.4rem 0;
    display: inline-block;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.auth-links a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.auth-links .auth-link-separator {
    display: none;
}

@media (min-width: 480px) {
    .auth-links {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 0;
    }

    .auth-links .auth-link-separator {
        display: inline;
        color: #ccc;
        margin: 0 1rem;
    }
}

/* KPI Cards (existing, non-auth) */
.kpi-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
}

.kpi-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
}

.offline-disabled {
    opacity: 0.5 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
    filter: grayscale(100%);
}

@keyframes pulse-amber-btn {
    0%   { box-shadow: 0 0 0 0    rgba(245, 158, 11, 0.8); }
    60%  { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
    100% { box-shadow: 0 0 0 0    rgba(245, 158, 11, 0); }
}
@keyframes pulse-amber-btn-dark {
    0%   { box-shadow: 0 0 0 0    rgba(251, 191, 36, 0.9); }
    60%  { box-shadow: 0 0 0 14px rgba(251, 191, 36, 0); }
    100% { box-shadow: 0 0 0 0    rgba(251, 191, 36, 0); }
}
@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
@keyframes pulse-red-btn {
    0%   { box-shadow: 0 0 0 0    rgba(239, 68, 68, 0.8); }
    60%  { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0    rgba(239, 68, 68, 0); }
}
@keyframes pulse-red-btn-dark {
    0%   { box-shadow: 0 0 0 0    rgba(248, 113, 113, 0.9); }
    60%  { box-shadow: 0 0 0 14px rgba(248, 113, 113, 0); }
    100% { box-shadow: 0 0 0 0    rgba(248, 113, 113, 0); }
}
@keyframes btn-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.55; }
}

/* Hide native browser password reveal icon in Edge */
input.k-input-inner[type="password"]::-ms-reveal,
input.k-input-inner[type="password"]::-ms-clear {
    display: none;
}
