/* ====== CSS Variables ====== */
:root {
    --mailand-gold: #B08D2D;
    --mailand-green: #4A5C3F;
    --mailand-light-gold: #D4C3A2;
    --mailand-bg-gray: #E8E6E1;
    --mailand-gold-hover: #9c7b28;
    --mailand-green-hover: #3E4D34;
    --white: #FFFFFF;
    --black: #000000;
    --gray-light: #F5F5F5;
    --gray-medium: #CCCCCC;
    --gray-dark: #666666;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --shadow-heavy: rgba(0, 0, 0, 0.25);
    --transition-fast: 0.2s;
    --transition-normal: 0.3s;
    --transition-slow: 0.5s;
}

/* ====== Global Styles ====== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--mailand-green) 0%, var(--mailand-green-hover) 100%);
    color: var(--black);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* ====== Background Shapes ====== */
.bg-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.bg-shapes::before,
.bg-shapes::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--mailand-gold), var(--mailand-light-gold));
    opacity: 0.1;
}

.bg-shapes::before {
    width: 500px;
    height: 500px;
    top: -200px;
    right: -200px;
    animation: float 20s infinite ease-in-out;
}

.bg-shapes::after {
    width: 400px;
    height: 400px;
    bottom: -150px;
    left: -150px;
    animation: float 15s infinite ease-in-out reverse;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    33% {
        transform: translate(30px, -30px) rotate(120deg);
    }
    66% {
        transform: translate(-20px, 20px) rotate(240deg);
    }
}

/* ====== Login Container ====== */
.login-container {
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 20px 60px var(--shadow-medium);
    /* Thêm viền nổi bật */
    border: 3px solid var(--mailand-gold);
    width: 90%;
    max-width: 500px;
    padding: 40px;
    position: relative;
    overflow: hidden;
    z-index: 1;
    animation: slideUp 0.6s ease-out;
}

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

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--mailand-gold), var(--mailand-light-gold));
}

/* ====== Logo Section ====== */
.logo-section {
    text-align: center;
    margin-bottom: 30px;
}

.logo-container {
    display: inline-block;
    position: relative;
}

.logo-icon {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--white);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 30px var(--shadow-light);
    /* Thêm viền dày và nổi bật */
    border: 4px solid var(--mailand-gold);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.logo-icon:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 40px var(--shadow-medium);
    /* Hiệu ứng viền khi hover */
    border-color: var(--mailand-gold-hover);
}

.logo-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, var(--mailand-light-gold), transparent);
    transform: rotate(45deg);
    transition: all 0.6s;
    opacity: 0;
}

.logo-icon:hover::before {
    animation: shine 0.6s ease-in-out;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
        opacity: 0;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
        opacity: 0;
    }
}

.logo-img {
    width: 80%;
    height: auto;
    z-index: 1;
}

/* ====== System Title ====== */
.system-title {
    text-align: center;
    color: var(--mailand-green);
    margin-bottom: 15px;
    font-size: 24px;
    font-weight: 600;
    animation: fadeIn 0.8s ease-out 0.2s both;
}

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

.system-description {
    text-align: center;
    color: var(--gray-dark);
    margin-bottom: 30px;
    font-size: 16px;
    line-height: 1.5;
    animation: fadeIn 0.8s ease-out 0.3s both;
}

/* ====== Login Button ====== */
.login-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--mailand-gold), var(--mailand-gold-hover));
    color: var(--white);
    /* Thêm viền nổi bật */
    border: 2px solid var(--mailand-gold);
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 5px 15px var(--shadow-light);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    margin-bottom: 20px;
    animation: fadeIn 0.8s ease-out 0.4s both;
}

.login-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px var(--shadow-medium);
    background: linear-gradient(135deg, var(--mailand-gold-hover), var(--mailand-gold));
    /* Đổi màu viền khi hover */
    border-color: var(--mailand-light-gold);
}

.login-button:active {
    transform: translateY(1px);
    box-shadow: 0 3px 10px var(--shadow-light);
}

.login-button.loading {
    pointer-events: none;
    opacity: 0.8;
}

.microsoft-icon {
    margin-right: 10px;
    font-size: 20px;
}

/* ====== Security Badge ====== */
.security-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-dark);
    font-size: 14px;
    margin-bottom: 30px;
    animation: fadeIn 0.8s ease-out 0.5s both;
}

.security-badge i {
    margin-right: 8px;
    color: var(--mailand-green);
}

/* ====== Public Links ====== */
.public-links {
    margin-bottom: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--mailand-light-gold);
    animation: fadeIn 0.8s ease-out 0.6s both;
}

.public-links-title {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mailand-green);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
}

.public-links-title i {
    margin-right: 8px;
}

.public-links-grid {
    display: flex;
    gap: 15px;
}

.public-link-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    background: var(--gray-light);
    color: var(--mailand-green);
    /* Thêm viền nổi bật */
    border: 2px solid var(--mailand-green);
    border-radius: 10px;
    text-decoration: none;
    transition: all var(--transition-normal);
    box-shadow: 0 3px 10px var(--shadow-light);
}

.public-link-btn:hover {
    background: var(--mailand-light-gold);
    color: var(--white);
    /* Đổi màu viền khi hover */
    border-color: var(--mailand-gold);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px var(--shadow-medium);
}

.public-link-btn i {
    font-size: 20px;
    margin-bottom: 8px;
}

/* ====== Footer ====== */
.login-footer {
    text-align: center;
    font-size: 14px;
    color: var(--gray-dark);
    animation: fadeIn 0.8s ease-out 0.7s both;
}

.footer-copyright {
    margin-bottom: 5px;
}

.footer-support {
    margin-top: 10px;
}

.footer-support a {
    color: var(--mailand-green);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.footer-support a:hover {
    color: var(--mailand-gold);
    text-decoration: underline;
}

/* ====== Responsive Design ====== */
@media (max-width: 768px) {
    .login-container {
        width: 95%;
        padding: 30px 20px;
    }
    
    .logo-icon {
        width: 100px;
        height: 100px;
    }
    
    .system-title {
        font-size: 22px;
    }
    
    .system-description {
        font-size: 15px;
    }
    
    .public-links-grid {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .login-container {
        width: 100%;
        border-radius: 20px 20px 0 0;
        padding: 30px 15px;
        max-height: 100vh;
        overflow-y: auto;
    }
    
    .logo-icon {
        width: 80px;
        height: 80px;
    }
    
    .system-title {
        font-size: 20px;
    }
    
    .system-description {
        font-size: 14px;
    }
    
    .login-button {
        padding: 12px;
        font-size: 15px;
    }
    
    .microsoft-icon {
        font-size: 18px;
    }
}

/* ====== Additional Animations ====== */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(176, 141, 45, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(176, 141, 45, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(176, 141, 45, 0);
    }
}

/* ====== Focus States ====== */
.login-button:focus,
.public-link-btn:focus {
    outline: none;
    /* Tăng cường hiệu ứng focus với viền kép */
    box-shadow: 0 0 0 3px rgba(176, 141, 45, 0.3), 0 0 0 5px rgba(176, 141, 45, 0.1);
    border-color: var(--mailand-gold-hover);
}

/* ====== Loading Animation ====== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}