/* Global Layout Resets */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    font-family: 'Noto Sans SC', sans-serif; 
    background: #0f1015; 
    color: #fff; 
    display: flex; 
    height: 100vh; 
    overflow: hidden; 
}

.app-container { display: flex; width: 100%; height: 100%; }

/* Custom Scrollbar for sidebar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
::-webkit-scrollbar-thumb { background: #555; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #777; }

/* Control Panel Sidebar */
.controls-panel { 
    width: 380px; 
    background: #1a1b26; 
    padding: 25px; 
    overflow-y: auto; 
    border-right: 1px solid #2d2e3e; 
    flex-shrink: 0;
    box-shadow: 5px 0 20px rgba(0,0,0,0.5);
    z-index: 100;
}
.app-title { 
    font-size: 26px; 
    margin-bottom: 25px; 
    text-align: center; 
    background: linear-gradient(135deg, #ff8a00, #e52e71); 
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent; 
    font-weight: 900;
}
.control-group { margin-bottom: 22px; }
.control-group label { display: block; font-size: 14px; color: #a9b1d6; margin-bottom: 8px; font-weight: bold;}

.template-selector { display: flex; gap: 10px; }
.tpl-btn { 
    flex: 1; padding: 10px 0; border: 1px solid #3b3d52; border-radius: 8px; 
    background: #24283b; color: #a9b1d6; cursor: pointer; transition: 0.3s; 
    font-size: 13px; font-weight: bold;
}
.tpl-btn:hover { background: #3b3d52; }
.tpl-btn.active { background: #e52e71; color: #fff; border-color: #e52e71; box-shadow: 0 4px 15px rgba(229, 46, 113, 0.4); }

.file-upload-wrapper { position: relative; overflow: hidden; }
#imageInput { position: absolute; left: 0; top: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; z-index: 2; }
.file-upload-btn { 
    background: #24283b; text-align: center; padding: 18px; border-radius: 8px; 
    border: 2px dashed #414868; transition: 0.3s; color: #7aa2f7; font-weight: bold;
}
.file-upload-wrapper:hover .file-upload-btn { border-color: #7aa2f7; background: #292e42; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 25px; }
.form-item label { display: block; font-size: 13px; color: #a9b1d6; margin-bottom: 6px; }
input[type="text"], textarea { 
    width: 100%; background: #24283b; border: 1px solid #414868; color: #c0caf5; 
    padding: 12px; border-radius: 8px; font-family: inherit; font-size: 14px; transition: 0.2s;
}
input[type="text"]:focus, textarea:focus { outline: none; border-color: #7aa2f7; box-shadow: 0 0 0 2px rgba(122, 162, 247, 0.2);}

textarea { resize: vertical; line-height: 1.5; }

.primary-btn { 
    width: 100%; padding: 16px; background: linear-gradient(135deg, #e52e71, #ff8a00); 
    border: none; border-radius: 10px; color: #fff; font-size: 18px; font-weight: bold; 
    cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; 
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(229, 46, 113, 0.5); }
.primary-btn:active { transform: translateY(0); }

/* Main Preview Area */
.preview-area { 
    flex: 1; display: flex; justify-content: center; align-items: center; 
    background: #11111a; 
    background-image: radial-gradient(#2d2e3e 1px, transparent 1px);
    background-size: 30px 30px;
    overflow: auto; 
    padding: 40px;
}
.preview-container {
    /* Scale logic will be handled by JS to fit screen, but fixed dimensions for capture */
    transition: transform 0.3s ease;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}

/* --- BASE CARD STYLES --- */
.card-wrapper {
    width: 600px;
    height: 1066px; /* 16:9 like */
    position: relative;
    overflow: hidden;
    background: #fff;
}
.card-inner {
    position: relative;
    z-index: 10;
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
}
.card-bg { position: absolute; inset: 0; z-index: 1; }
.photo-container {
    position: relative; z-index: 2; overflow: hidden;
    display: flex; justify-content: center; align-items: center; background: #000;
}
.photo-container img { width: 100%; height: 100%; object-fit: cover; }
.photo-overlay { position: absolute; inset: 0; pointer-events: none; }
.notice-text { position: absolute; z-index: 30; }
.special-banner { position: absolute; z-index: 40; }
.top-tags { position: absolute; z-index: 30; display: flex; flex-direction: column; align-items: center; }
.attributes-area { position: absolute; z-index: 20; display: flex; flex-direction: column; align-items: center; }


/* =========================================
   THEME 1: 少女粉紫 (Pink Theme) 
========================================= */
.theme-pink .card-bg {
    background: linear-gradient(160deg, #ffb6c1 0%, #ffc0cb 20%, #e6e6fa 60%, #ffb6c1 100%);
    /* Pattern overlay */
    background-image: radial-gradient(white 1px, transparent 2px), radial-gradient(rgba(255,105,180,0.5) 1px, transparent 2px);
    background-size: 30px 30px, 40px 40px;
    background-position: 0 0, 15px 15px;
}
.theme-pink .card-bg::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 350px;
    background: linear-gradient(to top, rgba(230,230,250,1) 0%, rgba(230,230,250,0) 100%);
}
.theme-pink .photo-container {
    margin: 110px 25px 190px 25px; border-radius: 20px; 
    border: 4px solid #fff; box-shadow: 0 10px 30px rgba(255,105,180,0.4); height: 766px; width: 550px;
}

.theme-pink .id-ribbon {
    position: absolute; top: 15px; left: 20px; z-index: 30;
    color: #fff; font-size: 32px; font-weight: 900;
    text-shadow: 3px 3px 6px rgba(255,105,180,0.8);
    display: flex; align-items: center; font-family: 'ZCOOL KuaiLe', cursive;
}
.theme-pink .id-ribbon::before {
    content: '🎁'; margin-right: 8px; font-size: 40px; text-shadow: none;
}

.theme-pink .notice-text {
    top: 65px; left: 25px; right: 25px;
    color: #fff; font-size: 13px; line-height: 1.5; font-weight: 500;
    text-shadow: 1px 1px 3px rgba(255,105,180,0.9); text-align: left;
}

.theme-pink .special-banner { display: none; }
.theme-pink .row-name-job { display: none; } /* Doesn't use name row */

.theme-pink .top-tags { bottom: 180px; right: 15px; top: auto; }
.theme-pink .tag-main {
    background: #ff69b4; color: #fff; width: 85px; height: 85px; 
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 26px; font-weight: 900; border: 4px dashed #fff; 
    box-shadow: 0 5px 15px rgba(255,105,180,0.6); transform: rotate(-10deg);
}
.theme-pink .tag-sub {
    margin-top: -15px; background: rgba(255,255,255,0.9); color: #ff69b4;
    padding: 3px 12px; border-radius: 12px; font-size: 13px; font-weight: bold;
    border: 2px solid #ff69b4; z-index: 2;
}

.theme-pink .attributes-area { bottom: 35px; width: 100%; gap: 18px; }
.theme-pink .attr-row { display: flex; width: 90%; gap: 20px; justify-content: space-between; }
.theme-pink .attr-item {
    flex: 1; background: linear-gradient(90deg, #ff7eb3, #ff758c);
    color: #fff; border-radius: 12px; padding: 14px;
    font-size: 22px; font-weight: bold; border: 3px solid #fff;
    box-shadow: 0 6px 15px rgba(255, 105, 180, 0.4);
    display: flex; align-items: center; justify-content: center;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}
.theme-pink .attr-label { color: #ffe0e5; margin-right: 8px; font-size: 20px; }


/* =========================================
   THEME 2: 激情红金 (Red Theme) 
========================================= */
.theme-red .card-bg {
    background: #8b0000;
    /* Fancy border look using outline and border */
    border: 15px solid #d4af37;
    border-image: repeating-linear-gradient(45deg, #d4af37, #d4af37 10px, #a67c00 10px, #a67c00 20px) 15;
}
.theme-red .card-bg::before {
    content: ''; position: absolute; inset: 0;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" opacity="0.1"><rect width="100" height="100" fill="none" stroke="%23fff" stroke-width="1"/></svg>') repeat;
}
.theme-red .photo-container {
    margin: 85px 20px 240px 20px; border: 4px solid #d4af37; border-radius: 5px; height: 740px; width: 560px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.8);
}

.theme-red .id-ribbon {
    position: absolute; top: 0; left: 15px; z-index: 30;
    background: #600; color: #fff; font-size: 32px; font-weight: 900;
    padding: 10px 30px; border: 4px solid #d4af37; border-top: none;
    border-radius: 0 0 15px 15px; box-shadow: 0 8px 15px rgba(0,0,0,0.5);
    display: flex; gap: 10px; align-items: baseline;
}
.theme-red .id-ribbon .prefix-text { font-size: 24px; color: #ffd700; }

.theme-red .notice-text {
    top: 65px; left: 15px; right: 15px;
    color: #ffd700; font-size: 14px; font-weight: bold; line-height: 1.4;
    text-shadow: 1px 1px 2px #000; text-align: left;
}

.theme-red .special-banner {
    top: 65px; right: -40px; background: #c00; color: #ffd700;
    font-size: 34px; font-weight: 900; padding: 12px 60px;
    transform: rotate(40deg); border: 2px solid #ffd700;
    box-shadow: 0 5px 15px rgba(0,0,0,0.6); font-family: 'Ma Shan Zheng', cursive;
    text-shadow: 2px 2px 0px #000; letter-spacing: 2px;
}

.theme-red .top-tags { top: 0; right: 25px; bottom: auto; }
.theme-red .tag-main {
    border-radius: 0 0 20px 20px; background: rgba(0,0,0,0.6); color: #fff; font-size: 22px;
    border: 2px solid #d4af37; border-top: none; padding: 15px 10px 10px 10px;
    box-shadow: 0 5px 10px rgba(0,0,0,0.5); font-family: serif;
}
.theme-red .tag-sub { display: none; }

.theme-red .attributes-area { bottom: 30px; width: 100%; gap: 15px; }
.theme-red .attr-row { display: flex; width: 92%; gap: 15px; }
.theme-red .attr-item {
    flex: 1; background: #e8e8e8; color: #800; border-radius: 25px; padding: 10px 15px;
    font-size: 20px; font-weight: 900; box-shadow: inset 0 -4px 0 #ccc, 0 4px 8px rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
    font-family: inherit;
}
.theme-red .attr-label { color: #a44; margin-right: 8px; font-size: 18px; font-weight: bold;}


/* =========================================
   THEME 3: 暗夜紫银 (Dark Theme) 
========================================= */
.theme-dark .card-bg {
    background: radial-gradient(ellipse at top, #302b63, #0f0c29 50%, #24243e 100%);
    /* Fancy inner border */
}
.theme-dark .card-bg::after {
    content: ''; position: absolute; top: 10px; bottom: 10px; left: 10px; right: 10px;
    border: 2px solid rgba(231,201,165, 0.4); z-index: 1; pointer-events: none;
    border-radius: 8px;
}

.theme-dark .photo-container {
    margin: 140px 35px 120px 35px; border: 2px solid #e7c9a5; border-radius: 10px; 
    height: 780px; width: 530px; box-shadow: 0 0 30px rgba(231,201,165,0.2);
}

.theme-dark .id-ribbon {
    position: absolute; top: 75px; left: 0; right: 0; z-index: 30;
    display: flex; justify-content: center; align-items: baseline; gap: 15px;
    color: #fff; font-size: 42px; font-weight: bold;
    text-shadow: 0 0 15px #e7c9a5; font-family: serif; letter-spacing: 2px;
}
.theme-dark .id-ribbon .prefix-text { font-size: 30px; font-style: italic; color: #e7c9a5; }

.theme-dark .notice-text {
    top: 15px; left: 30px; right: 30px;
    color: #a0a0b0; font-size: 12px; font-weight: normal; line-height: 1.6;
    text-align: center; border-bottom: 1px solid rgba(231,201,165,0.3); padding-bottom: 10px;
}

.theme-dark .special-banner { display: none; }
.theme-dark .top-tags { display: none; }

.theme-dark .attributes-area { bottom: 25px; width: 100%; gap: 15px; }

/* In dark theme, name is a big distinct badge over the photo bottom */
.theme-dark .attr-row { display: flex; width: 90%; gap: 15px; }
.theme-dark .attr-row.row-name-job {
    position: absolute; bottom: 110px; left: 50%; transform: translateX(-50%); width: auto; z-index: 40;
}
.theme-dark .attr-row.row-name-job .item-job { display: none; } /* Hide job in dark theme */
.theme-dark .attr-row.row-name-job .item-name {
    background: #e7c9a5; color: #111; padding: 12px 60px; font-size: 28px;
    border-radius: 40px; font-weight: 900; box-shadow: 0 10px 20px rgba(0,0,0,0.6);
}
.theme-dark .attr-row.row-name-job .item-name .attr-label { display: none; } /* Hide "艺名" label */

.theme-dark .attr-item:not(.item-name) {
    flex: 1; background: rgba(0,0,0,0.4); color: #fff; padding: 12px 15px;
    font-size: 22px; font-weight: 600; border: 1px solid rgba(231,201,165,0.5);
    border-radius: 12px; backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
}
.theme-dark .attr-item:not(.item-name) .attr-label { color: #e7c9a5; margin-right: 8px; font-weight: normal; }
