/**
 * 认证页面共享样式
 * login.html, register.html, reset-password.html
 */

:root {
    --deep-bg: #0b1120;
    --card-white: #f8fafc;
    --agency-red: #d50000;
    --agency-black: #0f172a;
    --text-gray: #64748b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: "Roboto Mono", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    background-color: var(--deep-bg);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1200px;
    margin: 0;
}

#bg-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* === 3D 容器 === */
.badge-container {
    position: relative;
    z-index: 10;
    width: 280px;
    height: 510px;
    perspective: 1500px;
    transition:
        width 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        height 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: width, height;
    animation: badge-drop 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes badge-drop {
    0% {
        transform: translateY(-120vh);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* === 翻转全屏状态 === */
.badge-container.expanded {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0;
    z-index: 9999;
    transform: none !important;
}

.badge-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.badge-inner.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 12px;
    overflow: hidden;
    transition: border-radius 0.4s ease;
}

.badge-container.expanded .card-face {
    border-radius: 0;
    box-shadow: none;
}

/* === 正面样式 === */
.card-face.front {
    background: var(--card-white);
    box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    display: flex;
    flex-direction: column;
    clip-path: polygon(
        0% 0%,
        28% 0%, 28% 6%, 72% 6%, 72% 0%,
        100% 0%,
        100% 100%,
        0% 100%
    );
}

.badge-container.expanded .card-face.front {
    clip-path: none;
}

/* === 背面样式 === */
.card-face.back {
    background-color: #ffffff;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
    position: relative;
}

.card-face.back::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(15, 23, 42, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 23, 42, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: 0;
}

.circuit-deco {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(15, 23, 42, 0.05);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.5s ease 0.5s, transform 20s linear;
    pointer-events: none;
}

.circuit-deco::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 173px;
    background: transparent;
    border: 2px solid rgba(15, 23, 42, 0.08);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    transform: translate(-50%, -50%);
}

.badge-container.expanded .circuit-deco {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(360deg);
}

.loading-text {
    margin-top: 20px;
    font-family: "Noto Sans SC", sans-serif;
    color: var(--agency-black);
    font-weight: 900;
    z-index: 2;
    font-size: 16px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* === 顶部挂绳装饰 === */
.header-stripe {
    height: 8px;
    background: var(--agency-black);
    width: 100%;
    margin-top: 12px;
}

/* === 挂绳卡扣 === */
.lanyard-clip {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    height: 24px;
    background: #1e293b;
    border-radius: 6px;
    z-index: 5;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.lanyard-clip::before {
    content: '';
    position: absolute;
    top: -100vh;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 100vh;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(255,255,255,0.06) 0px,
            rgba(255,255,255,0.06) 1px,
            transparent 1px,
            transparent 3px
        ),
        linear-gradient(90deg, #161e2e, #2a3a4e, #3a4d65, #2a3a4e, #161e2e);
    border-radius: 2px;
    box-shadow: 2px 0 4px rgba(0,0,0,0.3), -2px 0 4px rgba(0,0,0,0.3);
}

.lanyard-clip::after {
    content: '';
    width: 70px;
    height: 6px;
    background: rgba(0, 0, 0, 0.4);
    margin-bottom: 6px;
    border-radius: 3px;
}

.watermark {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 150px;
    color: rgba(0, 0, 0, 0.04);
    pointer-events: none;
    z-index: 0;
}

.content-area {
    padding: 15px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
}

.triangle-frame {
    width: 90px;
    height: 78px;
    background: var(--agency-red);
    clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12px;
    box-shadow: 0 8px 15px rgba(213, 0, 0, 0.3);
    transition: transform 0.3s;
}

.triangle-frame i {
    font-size: 34px;
    color: white;
    transition: all 0.3s;
}

.badge-container:hover .triangle-frame {
    transform: scale(1.05);
}

.org-title {
    text-align: center;
    margin-bottom: 20px;
    width: 100%;
    line-height: 0.85;
}

.org-title .org-logo {
    width: 100%;
    max-width: 200px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.org-title h2 {
    font-family: "Noto Sans SC", sans-serif;
    font-size: 10px;
    color: var(--text-gray);
    letter-spacing: 4px;
    text-transform: uppercase;
    font-weight: 700;
    display: block;
    margin-top: 8px;
}

/* === 表单样式 === */
.form-group {
    width: 100%;
    margin-bottom: 15px;
}

.form-group label {
    font-family: "Noto Sans SC", sans-serif;
    font-size: 9px;
    color: var(--text-gray);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 3px;
}

.form-group input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2px solid #cbd5e1;
    padding: 5px 0;
    font-family: "Roboto Mono", monospace;
    font-size: 14px;
    font-weight: bold;
    color: var(--agency-black);
    outline: none;
    transition: all 0.3s;
}

.form-group input:focus {
    border-bottom-color: var(--agency-red);
}

.form-group input::placeholder {
    font-family: "Noto Sans SC", sans-serif;
    font-weight: normal;
    opacity: 0.5;
    font-size: 12px;
}

.btn-verify {
    margin-top: 8px;
    background: var(--agency-red);
    color: white;
    border: none;
    padding: 12px 0;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(213, 0, 0, 0.2);
    font-family: "Noto Sans SC", sans-serif;
}

.btn-verify:hover {
    background: #b71c1c;
    transform: translateY(-1px);
}

.btn-verify:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

/* === 底部扫描条 === */
.footer-scan {
    margin-top: auto;
    width: 100%;
    padding: 12px;
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
    position: relative;
    overflow: visible;
    z-index: 10;
}

.barcode {
    height: 25px;
    width: 100%;
    background: repeating-linear-gradient(90deg, #334155 0, #334155 2px, transparent 2px, transparent 4px);
    opacity: 0.6;
}

.laser-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--agency-red);
    box-shadow: 0 0 10px var(--agency-red), 0 0 20px var(--agency-red);
    animation: scan 2.5s infinite ease-in-out;
    z-index: 10;
}

@keyframes scan {
    0% { top: 0; opacity: 0; }
    10% { top: 10%; opacity: 1; }
    90% { top: 90%; opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

/* === 状态消息 === */
.status-msg {
    font-size: 10px;
    color: var(--agency-red);
    margin-top: 10px;
    font-weight: bold;
    height: 12px;
    text-align: center;
    opacity: 0;
    font-family: "Noto Sans SC", sans-serif;
}

.status-msg.show {
    opacity: 1;
}

.status-msg.success {
    color: #15803d;
}

/* === 链接样式 === */
.register-link,
.login-link,
.back-link {
    margin-top: 8px;
    text-align: center;
}

.register-link a,
.login-link a,
.back-link a {
    color: var(--text-gray);
    font-size: 11px;
    text-decoration: none;
}

.register-link a span,
.login-link a span,
.back-link a span {
    color: var(--agency-red);
    font-weight: bold;
}

/* === 响应式 === */
@media (max-width: 400px) {
    .badge-container {
        width: 80vw;
        max-width: 280px;
        height: 510px;
    }
}

/* === 注册页面特定样式 === */
.badge-container.register-mode {
    width: 300px;
    height: 510px;
}

.badge-container.email-mode {
    height: 650px;
}

.badge-container.invitation-mode {
    height: 580px;
}

.badge-container.email-mode.invitation-mode {
    height: 700px;
}

.email-section,
.invitation-section {
    display: none;
    width: 100%;
}

.email-section.show,
.invitation-section.show {
    display: block;
}

.code-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.code-row input {
    flex: 1;
    min-width: 0;
}

.btn-code {
    background: var(--agency-black);
    color: white;
    border: none;
    padding: 6px 0;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 3px;
    white-space: nowrap;
    transition: all 0.2s;
    min-width: 72px;
    text-align: center;
    flex-shrink: 0;
}

.btn-code:hover {
    background: var(--agency-red);
}

.btn-code:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

/* === 重置密码页面特定样式 === */
.badge-container.reset-mode {
    height: 510px;
}

.badge-container.request-mode {
    height: 420px;
}

.username-display {
    background: #f1f5f9;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    text-align: center;
    width: 100%;
}

.username-display span {
    font-size: 11px;
    color: var(--text-gray);
}

.username-display strong {
    display: block;
    font-size: 16px;
    color: var(--agency-black);
    margin-top: 3px;
}

.error-container {
    text-align: center;
    padding: 30px 20px;
}

.error-container i {
    font-size: 48px;
    color: #94a3b8;
    margin-bottom: 15px;
}

.error-container h3 {
    color: var(--agency-black);
    margin-bottom: 10px;
    font-size: 16px;
}

.error-container p {
    color: var(--text-gray);
    font-size: 12px;
    margin-bottom: 20px;
}

@media (max-width: 400px) {
    .badge-container.register-mode {
        width: 85vw;
        max-width: 300px;
        height: 510px;
    }

    .badge-container.email-mode {
        height: 650px;
    }

    .badge-container.invitation-mode {
        height: 580px;
    }

    .badge-container.email-mode.invitation-mode {
        height: 700px;
    }
}

@media (max-height: 700px) {
    .badge-container.email-mode {
        height: 90vh;
    }

    .badge-container.invitation-mode {
        height: 85vh;
    }

    .badge-container.email-mode.invitation-mode {
        height: 95vh;
    }
}
