/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 1px solid #ddd;
}

header h1 {
    font-size: 2.5rem;
    color: #0B5345;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2rem;
    color: #666;
}

/* 主要内容区域 */
main {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.form-container, .preview-container {
    flex: 1;
    min-width: 300px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 25px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

input[type="text"],
input[type="url"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

input[type="color"] {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

button {
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-generate {
    background-color: #0B5345;
    color: white;
    width: 100%;
    margin-top: 20px;
}

.btn-generate:hover {
    background-color: #0a3d33;
}

/* 预览区域样式 */
.preview-container h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #0B5345;
}

.id-card-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    padding: 40px;
    border-radius: 8px;
    background-color: #f9f9f9;
    transition: background-image 0.3s ease;
    background-size: cover;
    background-position: center;
    /* 增大预览界面 */
    min-height: 400px;
}

/* 背景样式 */
.bg-desk {
    background-image: url('https://i.imgur.com/jyqeP3z.jpg');
}

.bg-wood {
    background-image: url('https://i.imgur.com/BgbXJFS.jpg');
}

.bg-marble {
    background-image: url('https://i.imgur.com/qQQTxrC.jpg');
}

.bg-leather {
    background-image: url('https://i.imgur.com/VdFAZ7j.jpg');
}

.id-card {
    width: 450px;
    height: 310px;
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    transform: rotate(-1deg);
    transition: all 0.3s ease;
    position: relative;
}

.id-card:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 50%, rgba(0,0,0,0.05) 100%);
    pointer-events: none;
    z-index: 10;
    border-radius: 12px;
}

/* 添加无规则水波纹防伪细线条（类似中国居民身份证） */
.id-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        /* 第一层波浪线 */
        radial-gradient(
            circle at 30% 20%,
            transparent 0%,
            transparent 3px,
            rgba(0, 100, 150, 0.03) 3px,
            rgba(0, 100, 150, 0.03) 4px,
            transparent 4px
        ),
        /* 第二层波浪线 */
        radial-gradient(
            circle at 70% 60%,
            transparent 0%,
            transparent 2px,
            rgba(150, 0, 0, 0.02) 2px,
            rgba(150, 0, 0, 0.02) 3px,
            transparent 3px
        ),
        /* 第三层波浪线 */
        repeating-radial-gradient(
            circle at 50% 50%,
            transparent 0px,
            transparent 15px,
            rgba(0, 0, 150, 0.02) 15px,
            rgba(0, 0, 150, 0.02) 17px
        ),
        /* 细线网格 */
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 5px,
            rgba(0, 150, 136, 0.01) 5px,
            rgba(0, 150, 136, 0.01) 6px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 7px,
            rgba(0, 150, 136, 0.01) 7px,
            rgba(0, 150, 136, 0.01) 8px
        ),
        /* 波浪线 */
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 10px,
            rgba(0, 0, 0, 0.01) 10px,
            rgba(0, 0, 0, 0.01) 10.5px
        );
    background-size: 
        300px 300px,
        200px 200px,
        300px 300px,
        100px 100px,
        100px 100px,
        20px 20px;
    pointer-events: none;
    z-index: 6;
    border-radius: 12px;
    mix-blend-mode: overlay;
    opacity: 0.7;
}

/* 全息防伪效果 */
.id-card::before {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><circle cx="20" cy="20" r="18" fill="none" stroke="rgba(200,200,200,0.3)" stroke-width="0.5"/><circle cx="20" cy="20" r="15" fill="none" stroke="rgba(200,200,200,0.3)" stroke-width="0.5"/><circle cx="20" cy="20" r="12" fill="none" stroke="rgba(200,200,200,0.3)" stroke-width="0.5"/><circle cx="20" cy="20" r="9" fill="none" stroke="rgba(200,200,200,0.3)" stroke-width="0.5"/><circle cx="20" cy="20" r="6" fill="none" stroke="rgba(200,200,200,0.3)" stroke-width="0.5"/><circle cx="20" cy="20" r="3" fill="none" stroke="rgba(200,200,200,0.3)" stroke-width="0.5"/><path d="M2,20 L38,20 M20,2 L20,38" stroke="rgba(200,200,200,0.3)" stroke-width="0.5" /></svg>');
    background-size: cover;
    opacity: 0.8;
    z-index: 7;
    pointer-events: none;
}

.id-card:hover {
    transform: rotate(0deg) scale(1.02);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.id-card-header {
    background-color: #0B5345;
    color: white;
    padding: 15px;
    display: flex;
    align-items: center;
    height: 80px;
}

.logo-container {
    width: 50px;
    height: 50px;
    margin-right: 15px;
    display: flex;
    align-items: center;
}

.logo-container img {
    max-width: 100%;
    max-height: 100%;
}

.school-info h2 {
    font-size: 1.2rem;
    margin: 0;
    color: #FFD700;
    text-transform: uppercase;
}

.school-info p {
    font-size: 0.9rem;
    margin: 0;
    font-style: italic;
}

.id-card-body {
    flex: 1;
    padding: 15px;
    display: flex;
    position: relative;
}

/* 苹果Logo水印 */
.id-card-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('https://s3.tebi.io/picforedu/mac%20logo.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 150px auto;
    opacity: 0.3;
    z-index: 1;
    pointer-events: none;
}

/* 确保内容在水印上方显示 */
.teacher-info, .photo-container {
    position: relative;
    z-index: 2;
}

.teacher-info {
    flex: 3;
}

.teacher-info h3 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.teacher-info p {
    margin-bottom: 5px;
    font-size: 1rem;
}

#barcode {
    position: absolute;
    bottom: 2px;
    left: 0;
    max-width: 100%;
    height: 50px;
}

.photo-container {
    flex: 2;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 已移除Faculty标签样式 */

.photo-container img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border: 3px solid #f0f0f0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    /* 确保照片是长方形 */
    aspect-ratio: 3/4;
}

/* 签名区域 */
.id-card-footer {
    padding: 5px 15px;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid #eee;
    background-color: #fafafa;
}

/* 已移除竖向ID标签样式 */

/* 签名覆盖层 */
.signature-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20%; /* 覆盖照片底部五分之一 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    z-index: 10;
}

.signature-overlay img {
    height: auto;
    width: 85%; /* 放大签名 */
    max-width: 200px;
    object-fit: contain;
    opacity: 0.7; /* 半透明效果，像水印 */
    filter: contrast(1.2) brightness(1.1); /* 增强对比度使签名在照片上更明显 */
    mix-blend-mode: multiply; /* 混合模式，使签名与照片融合 */
    border: none !important; /* 确保无边框 */
    box-shadow: none !important; /* 移除任何阴影 */
    background: transparent !important; /* 确保背景透明 */
}

/* 微缩文本防伪线 - 类似身份证上的细密纹路 */
.id-card-body::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        /* 水平细线 */
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 3px,
            rgba(0, 0, 0, 0.01) 3px,
            rgba(0, 0, 0, 0.01) 3.5px
        ),
        /* 垂直细线 */
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 4px,
            rgba(0, 0, 0, 0.01) 4px,
            rgba(0, 0, 0, 0.01) 4.5px
        ),
        /* 波浪纹理 */
        repeating-radial-gradient(
            ellipse at 50% 50%,
            transparent,
            transparent 10px,
            rgba(0, 0, 0, 0.01) 10px,
            rgba(0, 0, 0, 0.01) 11px
        ),
        /* 微小圆点 */
        radial-gradient(
            circle at 30% 40%,
            rgba(0, 0, 0, 0.02) 1px,
            transparent 1px
        ),
        radial-gradient(
            circle at 70% 60%,
            rgba(0, 0, 0, 0.02) 1px,
            transparent 1px
        );
    background-size: 
        7px 7px,
        9px 9px,
        100px 100px,
        50px 50px,
        50px 50px;
    pointer-events: none;
    z-index: 4;
    opacity: 0.7;
}

.signature-label {
    font-size: 0.6rem;
    color: #000;
    margin-top: 0;
    font-weight: bold;
    text-shadow: 0 0 2px white; /* 文字阴影确保在任何背景上都可见 */
    opacity: 0.8;
}

/* 彩虹纹理防伪效果 */
.id-card-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(
        to right,
        #ff0000,
        #ff7f00,
        #ffff00,
        #00ff00,
        #0000ff,
        #4b0082,
        #8b00ff
    );
    opacity: 0.6;
    z-index: 11;
}

/* 表单新增样式 */
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    background-color: white;
}

/* 操作按钮 */
.actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.btn-download {
    background-color: #2980b9;
    color: white;
}

.btn-download:hover {
    background-color: #2471a3;
}

.btn-download:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.btn-reset {
    background-color: #e74c3c;
    color: white;
}

.btn-reset:hover {
    background-color: #c0392b;
}

/* 页脚样式 */
footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
    color: #777;
}

/* 响应式设计 */
@media (max-width: 768px) {
    main {
        flex-direction: column;
    }
    
    .id-card {
        width: 100%;
        max-width: 380px;
    }
}
