/* ============================================================
   login.css — Trng Mm Non Ngôi Sao Nh
   Aesthetic: Warm forest green — refined, trustworthy, welcoming
   ============================================================ */

/* Font stack — không ph thuc Google Fonts */
/* Display/heading font */
@font-face {
    font-family: 'DisplaySerif';
    src: local('Palatino Linotype'), local('Palatino'), local('Book Antiqua'), local('Georgia');
}

/*  Reset & base  */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Palatino Linotype', 'Palatino', 'Book Antiqua', Georgia, serif;
    background: #002200;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/*  Animated background  */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 30%, rgba(0,80,0,.45) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 70%, rgba(0,40,0,.6) 0%, transparent 55%),
        radial-gradient(ellipse 100% 80% at 50% 100%, rgba(0,20,0,.7) 0%, transparent 70%);
    z-index: 0;
}

/* Floating leaf shapes */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle 2px at 15% 20%, rgba(255,255,255,.06) 0%, transparent 100%),
        radial-gradient(circle 1px at 75% 15%, rgba(255,255,255,.08) 0%, transparent 100%),
        radial-gradient(circle 3px at 90% 45%, rgba(0,200,0,.06) 0%, transparent 100%),
        radial-gradient(circle 1px at 30% 80%, rgba(255,255,255,.05) 0%, transparent 100%),
        radial-gradient(circle 2px at 60% 90%, rgba(0,180,0,.07) 0%, transparent 100%);
    z-index: 0;
    animation: bgFloat 12s ease-in-out infinite alternate;
}

@keyframes bgFloat {
    from { transform: translateY(0) scale(1); }
    to   { transform: translateY(-8px) scale(1.01); }
}

/*  Login container  */
.login-container {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, .97);
    border-radius: 16px;
    box-shadow:
        0 0 0 1px rgba(0,100,0,.12),
        0 8px 32px rgba(0,0,0,.25),
        0 32px 64px rgba(0,0,0,.15);
    width: 100%;
    max-width: 420px;
    padding: 0;
    overflow: hidden;
    animation: cardIn .5s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(24px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/*  Header band  */
.login-header {
    background: linear-gradient(135deg, #003300 0%, #004d00 60%, #005500 100%);
    padding: 28px 32px 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0; right: 0;
    height: 20px;
    background: rgba(255,255,255,.97);
    border-radius: 50% 50% 0 0 / 20px 20px 0 0;
}

.logo-container {
    margin-bottom: 10px;
}

.logo {
    height: 70px;
    width: auto;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,.3));
    animation: logoIn .6s .2s ease both;
}

@keyframes logoIn {
    from { opacity: 0; transform: scale(.85); }
    to   { opacity: 1; transform: scale(1); }
}

h1 {
    font-family: 'Palatino Linotype', 'Palatino', 'Book Antiqua', Georgia, serif;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .04em;
    margin: 0;
    text-shadow: 0 1px 4px rgba(0,0,0,.3);
}

/* School name subtitle */
.school-name {
    font-family: 'Palatino Linotype', 'Palatino', 'Book Antiqua', Georgia, serif;
    font-size: 11px;
    font-weight: 300;
    color: rgba(255,255,255,.7);
    letter-spacing: .12em;
    text-transform: uppercase;
    margin-top: 4px;
}

/*  Form body  */
.login-body {
    padding: 28px 32px 32px;
}

/*  Form groups  */
.form-group {
    margin-bottom: 16px;
    text-align: left;
    animation: fieldIn .4s ease both;
}

.form-group:nth-child(1) { animation-delay: .1s; }
.form-group:nth-child(2) { animation-delay: .18s; }
.form-group:nth-child(3) { animation-delay: .24s; }
.form-group:nth-child(4) { animation-delay: .3s; }

@keyframes fieldIn {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #446;
    margin-bottom: 6px;
}

/* Input wrapper with icon */
.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 12px;
    color: #888;
    font-size: 15px;
    pointer-events: none;
    transition: color .2s;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 11px 12px 11px 38px;
    font-family: 'Palatino Linotype', 'Palatino', 'Book Antiqua', Georgia, serif;
    font-size: 14px;
    color: #222;
    background: #f7f9f7;
    border: 1.5px solid #d0ddd0;
    border-radius: 8px;
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
    border-color: #004d00;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0,100,0,.1);
}

.form-group input[type="text"]:focus ~ .input-icon,
.form-group input[type="password"]:focus ~ .input-icon {
    color: #004d00;
}

/* Password toggle button */
.pwd-toggle {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: #888;
    font-size: 15px;
    cursor: pointer;
    width: auto;
    padding: 4px;
    transition: color .2s;
}
.pwd-toggle:hover { color: #004d00; background: none; }

/*  Submit button  */
.btn-login {
    width: 100%;
    padding: 12px;
    font-family: 'Palatino Linotype', 'Palatino', 'Book Antiqua', Georgia, serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .06em;
    color: #fff;
    background: linear-gradient(135deg, #004400, #006600);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity .18s, transform .12s, box-shadow .18s;
    box-shadow: 0 4px 12px rgba(0,80,0,.3);
    margin-top: 4px;
}
.btn-login:hover {
    opacity: .92;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,80,0,.35);
}
.btn-login:active { transform: translateY(0); }

/*  Checkbox  */
.checkbox-group { margin-bottom: 8px; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #004400;
    cursor: pointer;
    flex-shrink: 0;
}

/*  Forgot password  */
.form-footer {
    display: flex;
    flex-direction: column;  /* line 1: forgot password; line 2: support + privacy */
    align-items: center;
    gap: 6px;
    margin-top: 14px;
}

.forgot-password-link {
    font-size: 13px;
    color: #004d00;
    text-decoration: none;
    font-weight: 600;
    transition: color .18s;
}
.forgot-password-link:hover { color: #006600; text-decoration: underline; }
.form-footer-sub { font-size: 12.5px; color: #6b7c70; text-align: center; }
.form-footer-sub a { color: inherit; text-decoration: none; }
.form-footer-sub a:hover { color: #004d00; text-decoration: underline; }

/*  Error message  */
.error-message {
    background: #fdf0f0;
    border: 1px solid #f5c6c6;
    border-left: 4px solid #d9534f;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 13px;
    color: #b52b2b;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/*  DB alert  */
.alert {
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 13px;
}
.alert-danger {
    background: #fff3f3;
   border: 1px solid #f5c6c6;
    color: #b52b2b;
}

/*  Role picker  */
.role-picker { padding-top: 4px; }

.role-picker-title {
    font-family: 'Palatino Linotype', 'Palatino', 'Book Antiqua', Georgia, serif;
    font-size: 20px;
    font-weight: 700;
    color: #003300;
    text-align: center;
    margin-bottom: 6px;
}
.role-picker-desc {
    font-size: 13px;
    color: #666;
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Card grid — 2 cols, wraps if more roles */
.role-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.role-card-btn {
    position: relative;
    border: 1.5px solid #d0ddd0;
    border-radius: 12px;
    padding: 18px 14px 16px;
    cursor: pointer;
    background: #f7f9f7;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    transition: border-color .18s, background .18s, transform .15s;
    user-select: none;
}
.role-card-btn:hover {
    /* border-color handled by inline style */
    filter: brightness(.97);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,.1);
}
.role-card-btn.selected {
    /* background kept from inline, just strengthen border */
    border-width: 2.5px !important;
    filter: brightness(.95);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,.12);
}
.role-card-btn input[type="radio"] { display: none; }

/* Check circle */
.role-check-circle {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid #c0ccc0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    transition: all .18s;
}
.role-card-btn.selected .role-check-circle {
    background: #004400;
    border-color: #004400;
}
.role-check-circle svg { opacity: 0; transition: opacity .15s; }
.role-card-btn.selected .role-check-circle svg { opacity: 1; }

/* Role icons — SVG inline via background-image */
.ricon-wrap {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: 60%;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
}

/* Role icon container */
.ricon-wrap {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* background-color & color set inline via PHP */
}
.ricon-wrap i {
    font-size: 26px !important;
    line-height: 1;
}

.role-card-name {
    font-size: 13px;
    font-weight: 700;
    color: #223;
    letter-spacing: .01em;
}
.role-card-btn.selected .role-card-name { color: #003300; }

.role-card-desc {
    font-size: 11px;
    color: #778;
    line-height: 1.4;
}

.role-submit {
    margin-top: 16px;
    width: 100%;
    padding: 12px;
    font-family: 'Palatino Linotype', 'Palatino', 'Book Antiqua', Georgia, serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .04em;
    color: #fff;
    background: linear-gradient(135deg, #004400, #006600);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity .18s, transform .12s, box-shadow .18s;
    box-shadow: 0 4px 12px rgba(0,80,0,.3);
}
.role-submit:hover:not(:disabled) {
    opacity: .9;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,80,0,.35);
}
.role-submit:disabled {
    background: #d0d8d0;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
    color: #99a;
}

/*  Responsive  */
@media (max-width: 480px) {
    .login-header { padding: 22px 24px 20px; }
    .login-body   { padding: 22px 24px 28px; }
    .role-card-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .role-card-btn { padding: 14px 10px 12px; }
    .ricon-wrap { width: 42px; height: 42px; }
}