/* 1. Reset / Global */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@200;300;400;500;700;800;900&display=swap');

body {
    margin: 0;
    font-family: "Tajawal", sans-serif;
    direction: rtl;
    box-sizing: border-box;
    background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("../assets/bg.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: clamp(20px, 5vw, 50px);
    overflow-x: hidden;
    overflow-y: auto;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.986);
    z-index: -1;
}

/* 2. Layout */
.login-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
}

.login-container {
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    width: 100%;
    max-width: 450px;
    min-width: 280px;
    padding: clamp(18px, 4vw, 35px);
    border-radius: clamp(12px, 2vw, 16px);
    box-sizing: border-box;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 0 15px rgba(0, 166, 156, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin: 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.8s ease-out;
}

/* 3. Components */
.logo-top {
    display: block;
    width: 100%;
    max-width: 175px;
    height: auto;
}

.login-title {
    font-family: "Tajawal", sans-serif;
    color: #00A69C;
    font-weight: 500;
    font-size: clamp(10px, 10vw, 15px);
    line-height: 1.4;
    margin-bottom: 15px;
    text-align: center;
    text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.08);
}

.login-subtitle {
    font-family: "Tajawal", sans-serif;
    font-size: 0.70rem !important;
    font-weight: 500;
    text-align: center;
    color: #3d5a58;
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 10px auto 25px auto;
    padding: 8px 12px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(0, 166, 156, 0.08) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 150, 136, 0.2);
    border-radius: 15px;
    box-sizing: border-box;
    line-height: 1.4;
    -webkit-text-size-adjust: 100%;
    position: relative;
    overflow: hidden;
    opacity: 0;
    animation: framePop 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.1) forwards;
}

.login-subtitle span {
    display: inline-block;
    opacity: 0;
    animation: textSlideDown 0.8s ease-out 0.4s forwards;
}

.login-subtitle::before {
    content: "";
    position: absolute;
    left: 0;
    top: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.9) 50%, rgba(0, 255, 242, 0.3) 60%, transparent);
    z-index: 2;
    animation: lightSweep 0.8s ease-out 0.4s forwards;
}

.password-wrapper {
    position: relative;
    width: 100%;
    max-width: 320px;
    margin: 0 auto 15px auto;
}

.password-wrapper input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    box-sizing: border-box;
}

.eye-on {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    width: 20px;
    cursor: pointer;
    z-index: 10;
    opacity: 0.6;
}

.login-container input {
    width: 100%;
    max-width: 320px;
    min-width: 320px;
    padding: 6px 15px;
    margin: 0 0 15px 0;
    border-radius: 8px;
    display: block;
    box-sizing: border-box;
    border: 1px solid #00A69C;
    font-size: clamp(14px, 3vw, 14px);
    outline: none;
    box-shadow: none;
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

.login-container input::placeholder {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.35);
    opacity: 1;
    font-family: "Tajawal", sans-serif;
    transition: opacity 0.3s ease;
}

.login-container input:focus::placeholder {
    opacity: 0;
}

.login-container input.error {
    border: 1px solid rgb(160, 0, 0);
    background-color: transparent;
}

.login-btn {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 320px;
    height: clamp(38px, 5vw, 45px);
    background-color: #00A69C;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-family: "Tajawal", sans-serif;
    font-size: clamp(16px, 3vw, 14px);
    font-weight: 400;
    cursor: pointer;
    padding: 0 16px;
    box-sizing: border-box;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.login-btn:hover {
    background-color: #008981;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    opacity: 0.9;
}

.login-icon {
    width: clamp(18px, 4vw, 22px);
    height: auto;
}

.footer-copy {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: clamp(8px, 2vw, 10px) 0;
    font-size: clamp(0.7rem, 2.5vw, 0.8rem);
    color: #777;
    text-align: center;
    background-color: #fff;
    border-top: 1px solid #00A69C;
    z-index: 999;
}

.clock-container {
    position: fixed;
    top: 25px;
    right: 25px;
    z-index: 9999;
}

.clock {
    width: 100px;
    height: 100px;
    background: #ffffff00;
    border: 4px solid #00A69C;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    direction: ltr;
}

.hand {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform-origin: bottom center;
    border-radius: 5px;
    transform: translateX(-50%);
}

.hour { width: 3px; height: 25px; background: #2c3e50; z-index: 3; }
.minute { width: 2px; height: 35px; background: #34495e; z-index: 2; }
.second { width: 1px; height: 40px; background: #00A69C; z-index: 1; }

.center-dot {
    width: 6px; height: 6px; background: #2c3e50;
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%); border-radius: 50%; z-index: 10;
}

.number {
    position: absolute;
    font-size: 10px;
    font-weight: bold;
    color: #2c3e50;
    width: 100%;
    text-align: center;
}

.n12 { top: 4px; }
.n6 { bottom: 4px; }
.n3 { right: 6px; top: 41px; text-align: right; }
.n9 { left: 6px; top: 41px; text-align: left; }

.clock-label {
    position: absolute;
    bottom: 22px;
    width: 100%;
    text-align: center;
    font-size: 8px;
    color: #00A69C;
    font-weight: bold;
}

/* 4. Utilities */
.login-options {
    text-align: right;
    margin: 12px 0;
    padding-right: 10px;
}
.forgot-password-link {
    color: #00A69C;
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.2s;
}
.forgot-password-link:hover {
    color: #007a73;
    text-decoration: underline;
}
#loginError {
    display: none;
    color: rgb(192, 0, 0);
    margin-top: 10px;
    font-size: 0.9rem;
}

/* 5. Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes framePop {
    0% { opacity: 0; transform: scale(0.6); filter: blur(5px); }
    100% { opacity: 1; transform: scale(1); filter: blur(0); }
}

@keyframes textSlideDown {
    0% { opacity: 0; transform: translateY(-30px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes lightSweep {
    0% { top: -100%; }
    100% { top: 100%; }
}

/* 6. Media Queries */
@media (min-width: 768px) {
    .login-wrapper { max-width: 520px; padding: 30px; }
    .login-subtitle { font-size: 1.1rem; }
    .logo-top { width: 220px; margin-bottom: 35px; }
}

@media (min-width: 1024px) {
    .login-wrapper { max-width: 600px; padding: 35px; }
    .login-subtitle { font-size: 1.2rem; }
    .logo-top { width: 250px; margin-bottom: 10px; }
}

@media (max-width: 480px) {
    .clock-container { display: none; }
    .login-container { max-width: 100%; padding-left: 15px; padding-right: 15px; }
}