/* Fix vertical alignment and layout issues */
body {
    writing-mode: horizontal-tb !important; /* Force horizontal text */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.auth-container {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    padding: clamp(1rem, 3vw, 2rem);
    width: 100%;
    position: relative;
    flex: 1; /* Ensure it takes available space in flex body */
}

.auth-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--border-radius-lg, 12px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    
    /* Responsive Width Settings */
    width: 100%;
    max-width: 400px;
    min-width: 320px;
    
    padding: clamp(1.5rem, 5vw, 3.5rem);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.5);
    margin: auto;
}

/* Make the bootstrap column wider on medium screens if needed, 
   but generally the card handles the content. 
   We rely on the HTML structure's col-md-5 col-lg-4 for the max-width logic on desktop.
   On mobile (xs), it takes full width.
*/

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

.auth-header {
    text-align: center;
    margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.auth-title {
    /* Responsive font size: minimum 1.5rem, preferred 5vw, maximum 2.5rem */
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 800;
    margin-bottom: clamp(0.5rem, 1.5vw, 1rem);
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.text-muted {
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    color: var(--text-secondary) !important;
}

.auth-form .form-group, .mb-3 {
    margin-bottom: clamp(1rem, 3vw, 1.5rem) !important;
}

.auth-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: clamp(0.9rem, 2.5vw, 1rem);
}

.auth-form .form-control {
    width: 100%;
    /* Responsive height for easier touch targets */
    height: clamp(45px, 10vw, 54px); 
    padding: 0 clamp(1rem, 2vw, 1.25rem);
    border: 2px solid var(--border-color);
    border-radius: clamp(8px, 1.5vw, 12px);
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
    transition: all 0.2s ease;
    background-color: #f8f9fa;
}

.auth-form .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(74,144,226,0.1);
    background-color: #fff;
    outline: none;
    transform: translateY(-1px);
}

.auth-form .form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
    padding-left: 0.2rem;
}

.auth-form .form-check-input {
    width: clamp(1.1rem, 3vw, 1.3rem);
    height: clamp(1.1rem, 3vw, 1.3rem);
    cursor: pointer;
    margin-top: 0;
}

.auth-form .form-check-label {
    margin: 0;
    font-weight: 500;
    cursor: pointer;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    color: var(--text-secondary);
}

.btn-primary {
    width: 100%;
    height: clamp(45px, 10vw, 54px);
    padding: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    color: white;
    border: none;
    border-radius: clamp(8px, 1.5vw, 12px);
    font-size: clamp(1rem, 3vw, 1.15rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74,144,226,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(74,144,226,0.4);
    background: linear-gradient(135deg, var(--primary-hover), var(--info-color));
}

.btn-primary:active {
    transform: translateY(0);
}

.auth-links {
    text-align: center;
    margin-top: clamp(1.5rem, 4vw, 2rem);
    padding-top: clamp(1rem, 3vw, 1.5rem);
    border-top: 1px solid var(--border-color);
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: clamp(0.85rem, 2.5vw, 0.95rem);
    font-weight: 500;
    transition: color 0.2s;
    margin: 0 0.5rem;
}

.auth-links a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.alert {
    border-radius: 10px;
    font-size: clamp(0.85rem, 2.5vw, 0.95rem);
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* Ensure no overflow on small screens */
@media (max-width: 360px) {
    .auth-container {
        padding: 10px;
    }
    .auth-card {
        padding: 1.5rem 1rem;
    }
}

/* ===== 首页双栏：品牌动效 + 登录表单 ===== */
.auth-split {
    flex: 1 1 auto;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    width: 100%;
}

.auth-hero {
    flex: 1 1 55%;
    background: linear-gradient(135deg, #1a252f 0%, #2c3e50 60%, #1e3a5f 100%);
    color: #e8eef5;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(2rem, 5vw, 5rem);
    position: relative;
    overflow: hidden;
}

/* 科技感网格背景 */
.auth-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(74, 144, 226, 0.09) 1px, transparent 1px),
        linear-gradient(90deg, rgba(74, 144, 226, 0.09) 1px, transparent 1px);
    background-size: 40px 40px;
    -webkit-mask-image: radial-gradient(circle at 30% 40%, #000 0%, transparent 75%);
    mask-image: radial-gradient(circle at 30% 40%, #000 0%, transparent 75%);
    pointer-events: none;
}

.hero-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: clamp(1.05rem, 2.5vw, 1.3rem);
    color: #fff;
    margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
    position: relative;
}

.hero-brand i {
    color: var(--primary-color);
    font-size: 1.4em;
}

.hero-title {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    position: relative;
    background: linear-gradient(120deg, #ffffff 30%, #8ec5ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    color: rgba(232, 238, 245, 0.75);
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    max-width: 38ch;
    margin-bottom: clamp(1.5rem, 3vw, 2rem);
    position: relative;
    line-height: 1.7;
}

/* 终端窗口 */
.terminal {
    background: #0d1620;
    border: 1px solid rgba(74, 144, 226, 0.25);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    max-width: 560px;
    position: relative;
    z-index: 1;
}

.terminal-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: #16202c;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.terminal-bar .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.terminal-bar .dot.red { background: #ff5f56; }
.terminal-bar .dot.yellow { background: #ffbd2e; }
.terminal-bar .dot.green { background: #27c93f; }

.terminal-title {
    margin-left: 0.5rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.terminal-body {
    margin: 0;
    padding: 1.1rem 1.2rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: clamp(0.78rem, 1.6vw, 0.95rem);
    line-height: 1.7;
    color: #c8d6e5;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 220px;
}

.terminal-body .cmd { color: #7ee787; }
.terminal-body .out { color: #8ec5ff; }
.terminal-body .ok { color: #27c93f; }
.terminal-body .warn { color: #ffbd2e; }

.cursor {
    display: inline-block;
    width: 9px;
    height: 1.05em;
    background: var(--primary-color);
    margin-left: 1px;
    vertical-align: text-bottom;
    animation: blink 1s steps(1) infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.hero-note {
    margin-top: clamp(1.25rem, 3vw, 1.75rem);
    font-size: clamp(0.8rem, 1.8vw, 0.95rem);
    color: rgba(232, 238, 245, 0.55);
    position: relative;
}

/* 右侧表单栏 */
.auth-form-pane {
    flex: 1 1 45%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 4vw, 3rem);
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
}

.auth-form-pane .auth-card {
    margin: 0;
    max-width: 420px;
}

/* 响应式：小屏堆叠 */
@media (max-width: 860px) {
    .auth-split {
        flex-direction: column;
    }
    .auth-hero {
        flex: none;
        padding: clamp(1.5rem, 6vw, 2.5rem);
    }
    .auth-form-pane {
        flex: none;
        padding: clamp(1.5rem, 6vw, 2.5rem);
    }
    .terminal-body {
        min-height: 180px;
    }
}
