@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;600;800&display=swap');

:root {
    --primary-color: #5a7a5f;
    --primary-gradient: linear-gradient(135deg, #5a7a5f 0%, #3a5a3f 100%);
    --bg-overlay: rgba(0, 0, 0, 0.5);
    --glass-bg: rgba(255, 255, 255, 0.92);
    --text-main: #0d3b1a;
    --text-muted: #5a7a5f;
    --input-bg: #f5efe7;
    --radius: 12px;
    --accent-color: #d97847;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #f5efe7;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Montserrat', sans-serif;
    height: 100vh;
    overflow: hidden;
    position: relative;
    transition: background-color 0.5s ease;
}

/* Background Image Layer */
.bg-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    z-index: -2;
}

.bg-image.loaded {
    opacity: 1;
}

/* Overlay Layer */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    z-index: -1;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

body.bg-ready::before {
    opacity: 1;
}

.container {
    background-color: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius);
    box-shadow: 0 25px 50px -12px rgba(13, 59, 26, 0.4);
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 400px;
    padding: 40px;
    animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

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

.brand-logo {
    display: block;
    width: 54px;
    height: 54px;
    object-fit: contain;
    margin: 0 auto 10px;
}

h1 {
    font-weight: 800;
    margin-bottom: 30px;
    color: var(--text-main);
    text-align: center;
    letter-spacing: -0.5px;
    font-size: 2rem;
}

form {
    display: flex;
    flex-direction: column;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    transition: color 0.3s;
}

.input-group .password-toggle {
    left: auto;
    right: 15px;
    cursor: pointer;
    z-index: 10;
}

.input-group .password-toggle:hover {
    color: var(--primary-color);
}

input {
    background-color: var(--input-bg);
    border: 2px solid transparent;
    border-radius: var(--radius);
    padding: 14px 15px 14px 45px;
    width: 100%;
    font-family: inherit;
    font-size: 15px;
    color: var(--text-main);
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    background-color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(90, 122, 95, 0.15);
}

input:focus + i {
    color: var(--primary-color);
}

.Forgot_password {
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
    margin-bottom: 25px;
    text-align: right;
    transition: color 0.3s;
    font-weight: 600;
}

.Forgot_password:hover {
    color: var(--accent-color);
}

button {
    border-radius: var(--radius);
    border: none;
    background: var(--primary-gradient);
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 600;
    padding: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 15px -3px rgba(90, 122, 95, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(90, 122, 95, 0.4);
    background: linear-gradient(135deg, #6f8f74 0%, #4a6a4f 100%);
}

button:active {
    transform: scale(0.98);
}

.error, .is_register {
    font-size: 13px;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
}

.error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.is_register {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

@media (max-width: 480px) {
    .container {
        max-width: 90%;
        padding: 35px 25px;
    }
}

/* Premium Preloader - Natural Bloom */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f5efe7;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.6s cubic-bezier(0.65, 0, 0.35, 1), visibility 0.6s;
}

#preloader.loaded {
    opacity: 0;
    visibility: hidden;
}

.bloom-container {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.petal {
    position: absolute;
    width: 35px;
    height: 35px;
    border-radius: 40% 60% 70% 30% / 40% 40% 60% 60%;
    background: #5a7a5f;
    opacity: 0.8;
    filter: blur(1px);
    animation: bloomRotate 3s infinite ease-in-out;
}

.p1 { background: #5a7a5f; animation-delay: 0s; }
.p2 { background: #1a5028; animation-delay: -1s; width: 40px; height: 40px; }
.p3 { background: #d97847; animation-delay: -2s; width: 30px; height: 30px; }

.loader-text {
    position: absolute;
    bottom: -40px;
    font-weight: 700;
    letter-spacing: 4px;
    color: #0d3b1a;
    font-size: 0.75rem;
    text-transform: uppercase;
    animation: textPulse 2s infinite ease-in-out;
}

@keyframes bloomRotate {
    0% { transform: rotate(0deg) translate(0, 0) scale(1); border-radius: 40% 60% 70% 30% / 40% 40% 60% 60%; }
    33% { transform: rotate(120deg) translate(10px, -10px) scale(1.2); border-radius: 60% 40% 30% 70% / 60% 60% 40% 40%; }
    66% { transform: rotate(240deg) translate(-10px, 10px) scale(0.8); border-radius: 30% 70% 70% 30% / 50% 50% 50% 50%; }
    100% { transform: rotate(360deg) translate(0, 0) scale(1); border-radius: 40% 60% 70% 30% / 40% 40% 60% 60%; }
}

@keyframes textPulse {
    0%, 100% { opacity: 0.4; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1); }
}

body.loading {
    overflow: hidden !important;
}