
/* Font Definitions */
@font-face {
    font-family: 'KhmerOS_battambang';
    src: url('../fonts/KhmerOS_battambang.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'KhmerOS_muollight';
    src: url('../fonts/KhmerOS_muollight.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'times';
    src: url('../fonts/times.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Times New Roman';
    src: url('../fonts/Times New Roman.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* Global Language Based Font Application */

/* Khmer Language - /km */
html[lang="km"], html[lang="kh"] {
    font-family: 'KhmerOS_battambang', sans-serif !important;
}

html[lang="km"] body, html[lang="kh"] body {
    font-family: 'KhmerOS_battambang', sans-serif !important;
}

html[lang="km"] h1, html[lang="km"] h2, html[lang="km"] h3, html[lang="km"] h4, html[lang="km"] h5, html[lang="km"] h6,
html[lang="kh"] h1, html[lang="kh"] h2, html[lang="kh"] h3, html[lang="kh"] h4, html[lang="kh"] h5, html[lang="kh"] h6 {
    font-family: 'KhmerOS_muollight', serif !important;
}

/* English and others - /en, /cn, /ja, /fr... */
/* Default to 'times' if not Khmer */
html:not([lang="km"]):not([lang="kh"]) {
    font-family: 'times', 'Times New Roman', serif !important;
}

html:not([lang="km"]):not([lang="kh"]) body {
    font-family: 'times', 'Times New Roman', serif !important;
}

html:not([lang="km"]):not([lang="kh"]) h1, 
html:not([lang="km"]):not([lang="kh"]) h2, 
html:not([lang="km"]):not([lang="kh"]) h3, 
html:not([lang="km"]):not([lang="kh"]) h4, 
html:not([lang="km"]):not([lang="kh"]) h5, 
html:not([lang="km"]):not([lang="kh"]) h6 {
    font-family: 'times', 'Times New Roman', serif !important;
}

/* Completely Reset Scrolling for Login Page - Force single scrollbar */
html:has(#login-page) {
    overflow: hidden !important;
    height: 100% !important;
}

body:has(#login-page) {
    overflow: hidden !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

#login-page {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e063 50%, #20e3b2 100%);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    height: 100vh !important;
    width: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-y: auto !important; /* THE ONLY SCROLLBAR FOR LOGIN */
    overflow-x: hidden !important;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.login-navbar {
    width: 100%;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-brand img {
    height: 28px; /* Even smaller logo */
    object-fit: contain;
}

.nav-brand .brand-text {
    font-size: 13px; /* Smaller text */
    font-weight: 700;
    color: #0056b3;
    line-height: 1.1;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-select {
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: white;
    font-size: 11px;
}

.login-content {
    flex: 1;
    display: flex;
    flex-direction: column; /* Allow content to stack */
    align-items: center;
    justify-content: center;
    padding: 30px 15px;
    position: relative;
}

.cover-wrapper {
    width: 100%;
    max-width: 800px;
    display: flex;
    backdrop-filter: blur(10px);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 2;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.cover-image {
    width: 45%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid rgba(0,0,0,0.05);
    background: rgba(0,0,0,0.02);
}

.cover-image img {
    object-fit: contain;
}

.h-80 {
    height: 80px !important;
}

.w-80 {
    width: 80px !important;
}

.login-form-side {
    width: 55%;
    padding: 30px;
}

.school-bottom-info {
    z-index: 2;
    text-align: center;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    padding-bottom: 20px;
}

.school-bottom-info h2 {
    font-size: 18px;
    margin-bottom: 5px;
    font-weight: 700;
}

.school-bottom-info p {
    font-size: 14px;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .cover-wrapper {
        flex-direction: column;
        max-width: 400px;
    }
    .cover-image, .login-form-side {
        width: 100%;
    }
    .cover-image {
        height: 160px;
    }
    .login-form-side {
        padding: 20px;
    }
}

.login-header {
    text-align: center;
    margin-bottom: 20px;
}

.login-header img {
    width: 80px;
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 20px;
    color: #0056b3;
    font-weight: 700;
    margin-bottom: 5px;
    line-height: 1.4;
}

.login-header p {
    color: #666;
    font-size: 13px;
}

/* Bootstrap Overrides for custom look */
.form-control:focus, .form-select:focus {
    border-color: #56ab2f;
    box-shadow: 0 0 0 0.25rem rgba(86, 171, 47, 0.25);
}

.btn-primary {
    background-color: #56ab2f !important;
    border-color: #56ab2f !important;
}

.btn-primary:hover {
    background-color: #458a25 !important;
    border-color: #458a25 !important;
}

.login-footer {
    text-align: center;
    margin-top: 15px;
    font-size: 13px;
    color: #666;
}

.login-footer a {
    color: #56ab2f;
    text-decoration: none;
    font-weight: 600;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* Khmer Specific Adjustments */
body {

}


/* Liquid Glass Effect Utilities */
.liquid-glass {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1) !important;
    position: relative;
}

/* 100% Transparent Inputs with Blue Border */
#login-page input.glass-input, 
#login-page select.glass-input {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 1px solid rgba(0, 86, 179, 0.3) !important;
    color: #0056b3 !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

/* Override any system/browser colors */
#login-page input.glass-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0px 1000px #a8e06300 inset !important;
    -webkit-text-fill-color: #0056b3 !important;
    transition: background-color 5000s ease-in-out 0s !important;
}

#login-page .glass-input:focus {
    border-color: #003d80 !important;
    background-color: rgba(0, 86, 179, 0.05) !important;
    box-shadow: 0 0 0 4px rgba(0, 86, 179, 0.15) !important;
}

#login-page .glass-input::placeholder {
    color: rgba(0, 86, 179, 0.5) !important;
}

/* Fix for Select dropdown arrow color/visibility */
#login-page select.glass-input {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%230056b3' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
    background-position: right 0.75rem center !important;
    background-repeat: no-repeat !important;
    background-size: 1.5em 1.5em !important;
    padding-right: 2.5rem !important;
}

body.dark-mode .glass-input {
    background: transparent !important;
    border-color: #3b82f6 !important;
    color: #3b82f6 !important;
}

body.dark-mode .glass-input::placeholder {
    color: rgba(255, 255, 255, 0.3) !important;
}

body.dark-mode .liquid-glass-card {
    background: rgba(30, 41, 59, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* Global Loading Overlay Styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease-in-out;
}

.loading-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-text {
    margin-top: 25px;
    color: #56ab2f;
    font-size: 18px;
    font-weight: 700;

    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}


.glass {
  position: relative;
  background: rgb(255, 255, 255);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2), 
              inset 0 4px 20px rgba(255, 255, 255, 0.3);
}
.glass::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgb(249, 249, 249);
  box-shadow: inset -10px -8px 0px -11px rgba(255, 255, 255, 1),
              inset 0px -9px 0px -8px rgba(255, 255, 255, 1);
  z-index: -1;
}
/* Custom Language Switcher Styles */
.lang-dropdown {
    position: relative;
    display: inline-block;
}

.lang-dropbtn {
    background: var(--bg-secondary, #f8f9fa);
    color: var(--text-primary, #333);
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border, #dee2e6);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    min-width: 120px;
}

.lang-dropbtn:hover {
    background: var(--bg-hover, #e9ecef);
    border-color: var(--primary, #56ab2f);
}

.lang-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: var(--bg-primary, #fff);
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.1);
    z-index: 1000;
    border-radius: 8px;
    margin-top: 5px;
    border: 1px solid var(--border, #dee2e6);
    overflow: visible;
    animation: fadeIn 0.2s ease;
}

/* Bridge the gap between button and dropdown to prevent hover loss */
.lang-dropdown-content::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
    background: transparent;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.lang-dropdown-content a {
    color: var(--text-primary, #333);
    padding: 10px 15px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    transition: background 0.2s;
}

.lang-dropdown-content a:hover {
    background-color: var(--bg-hover, #f1f3fd);
    color: var(--primary, #56ab2f);
}

.lang-dropdown-content a.active {
    background-color: var(--bg-active, #f1f3fd);
    font-weight: 700;
    color: var(--primary, #56ab2f);
}

.lang-dropdown:hover .lang-dropdown-content {
    display: block;
}

.fi {
    border-radius: 2px;
    box-shadow: 0 0 1px rgba(0,0,0,0.2);
}

