* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1 {
    text-align: center;
    color: #dc2626;
    margin-bottom: 20px;
    font-size: 28px;
}

h2 {
    color: #333;
    font-size: 20px;
    margin: 15px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.language-selector {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px;
}

.lang-btn {
    padding: 8px 15px;
    background-color: #f0f0f0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.lang-btn.active {
    background-color: #dc2626;
    color: white;
}

.lang-btn:hover:not(.active) {
    background-color: #e0e0e0;
}

.random-btn {
    margin-left: 15px;
    padding: 8px 15px;
    background-color: #4a7aff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.random-btn:hover {
    background-color: #3a6aef;
}

.random-btn:disabled {
    background-color: #a0a0a0;
    cursor: not-allowed;
}

.main-content {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.form-container {
    flex: 1;
    min-width: 300px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #eee;
}

.form-group {
    margin-bottom: 15px;
}

.date-group {
    display: flex;
    gap: 15px;
}

.date-group>div {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 14px;
    color: #555;
}

input,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border 0.3s;
}

input[type="color"] {
    height: 40px;
    padding: 5px;
    cursor: pointer;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: #dc2626;
}

.photo-input {
    display: flex;
    gap: 10px;
    align-items: center;
}

.photo-input input[type="file"] {
    flex: 1;
}

#generatePhotoBtn {
    padding: 8px 15px;
    background-color: #555;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

#generatePhotoBtn:hover {
    background-color: #444;
}

.preview-container {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#cardPreview {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

/* 学生证整体样式 */
.student-card {
    width: 420px;
    height: 270px;
    /* 增加高度，确保能显示所有内容 */
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    background-color: #fff;
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid #e0e0e0;
    background-image:
        linear-gradient(45deg, rgba(245, 245, 245, 0.4) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(245, 245, 245, 0.4) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(245, 245, 245, 0.4) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(245, 245, 245, 0.4) 75%);
    background-size: 100px 100px;
    background-position: 0 0, 0 50px, 50px -50px, -50px 0px;
}

/* 卡片头部样式 */
.card-header {
    background-color: #dc2626;
    color: white;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 50px;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 校徽样式 */
.logo-container {
    width: 36px;
    height: 36px;
    background-color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.logo-container img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* 卡片标题样式 */
.header-content h3 {
    font-size: 18px;
    margin: 0;
    line-height: 1.2;
    font-weight: 700;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.header-content p {
    font-size: 12px;
    opacity: 0.9;
    margin: 2px 0 0;
    font-weight: 500;
}

/* 卡片主体区域 */
.card-body {
    display: flex;
    padding: 15px;
    height: 145px;
    /* 精确设置高度 */
    position: relative;
}

/* 照片区域 */
.card-photo {
    width: 100px;
    height: 130px;
    margin-right: 15px;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border-radius: 3px;
    overflow: hidden;
    background-color: #f9f9f9;
    flex-shrink: 0;
}

.card-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 信息区域 */
.card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3px 0;
}

.info-group {
    margin-bottom: 6px;
    position: relative;
    border-bottom: 1px dashed #eaeaea;
    padding-bottom: 4px;
}

.info-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.info-label {
    font-size: 10px;
    color: #666;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    line-height: 1;
}

.info-value {
    font-size: 13px;
    font-weight: 600;
    color: #222;
    margin: 2px 0 0;
    letter-spacing: 0.3px;
    line-height: 1.2;
}

/* 卡片底部区域 */
.card-footer {
    display: flex;
    justify-content: space-between;
    padding: 8px 15px;
    background-color: rgba(245, 245, 245, 0.5);
    border-top: 1px solid #e5e5e5;
    position: relative;
    height: 45px;
}

.card-footer::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.02));
    pointer-events: none;
}

.date-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.date-label {
    font-size: 9px;
    color: #666;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.1;
}

.date-value {
    font-size: 11px;
    font-weight: 600;
    color: #222;
    margin: 1px 0 0;
    line-height: 1.1;
}

/* 签发机构 */
.card-issuer {
    background-color: #f0f0f0;
    padding: 6px 15px;
    text-align: center;
    border-top: 1px solid #e5e5e5;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.issuer-label {
    font-size: 9px;
    color: #666;
    margin: 0;
    text-transform: uppercase;
    display: inline-block;
    margin-right: 5px;
}

.issuer-value {
    font-size: 12px;
    font-weight: 600;
    color: #222;
    margin: 0;
    display: inline-block;
}

/* 学生证背面样式 */
.back-card {
    position: relative;
    background-image:
        linear-gradient(45deg, rgba(240, 240, 240, 0.5) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(240, 240, 240, 0.5) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(240, 240, 240, 0.5) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(240, 240, 240, 0.5) 75%);
    background-size: 100px 100px;
    background-position: 0 0, 0 50px, 50px -50px, -50px 0px;
}

.magnetic-strip {
    height: 40px;
    background-color: #000;
    margin-top: 16px;
    width: 100%;
}

.back-content {
    padding: 20px;
    flex: 1;
}

.back-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    font-weight: 600;
}

.back-text {
    font-size: 14px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eaeaea;
}

.notes-text {
    font-size: 10px;
    line-height: 1.5;
    color: #555;
    font-style: italic;
    padding: 10px;
    background-color: rgba(245, 245, 245, 0.6);
    border-radius: 4px;
    border-left: 3px solid #dc2626;
}

.back-footer {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
}

.signature-area {
    text-align: left;
    border-top: 1px solid #ddd;
    padding-top: 5px;
    width: 150px;
}

.signature-text {
    font-family: 'Brush Script MT', cursive;
    font-size: 18px;
    margin-bottom: 4px;
    color: #333;
}

.signature-label {
    font-size: 9px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.back-logo {
    width: 70px;
    height: 70px;
    object-fit: contain;
    opacity: 0.7;
}

/* 按钮样式 */
.download-btn {
    width: 100%;
    max-width: 380px;
    padding: 12px;
    background-color: #dc2626;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.download-btn:hover:not(:disabled) {
    background-color: #b91c1c;
    transform: translateY(-2px);
}

.download-btn:disabled {
    background-color: #aaa;
    cursor: not-allowed;
}

.back-btn {
    background-color: #555;
}

.back-btn:hover:not(:disabled) {
    background-color: #444;
}

hr {
    width: 80%;
    margin: 15px 0;
    border: none;
    border-top: 1px dashed #ddd;
}

.hidden {
    display: none;
}

/* 全息效果元素 */
.card-header::after {
    content: "";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #dc2626, #fecaca);
    border-radius: 50%;
    opacity: 0.8;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.7);
}

/* 微光荧光效果 */
.student-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.2) 50%,
            rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
    z-index: 2;
}

/* 响应式设计 */
@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
    }

    .preview-container {
        margin-top: 30px;
    }

    .student-card {
        width: 100%;
        max-width: 420px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    .date-group {
        flex-direction: column;
        gap: 10px;
    }

    .student-card {
        height: auto;
    }

    .card-body {
        height: auto;
        flex-direction: column;
    }

    .card-photo {
        margin-right: 0;
        margin-bottom: 15px;
        align-self: center;
    }
}