/*
 * 檔案用途：為證件產生器 (id-card.html) 提供特定的樣式。
 * This file provides specific styles for the ID Card Generator (id-card.html).
 */

/* 繼承自 style.css 的變數 */

.id-card-container {
    width: 100%;
    max-width: 500px;
    /* 限制此特定工具的寬度 */
    margin: 0 auto 60px auto;
}

/* 表單群組 */
.form-group label {
    color: var(--accent-color);
}

/* 輸入框樣式由 style.css 控制 */

/* 圖片上傳 */
.image-upload-container {
    margin-bottom: 20px;
    text-align: center;
}

#image-preview-container {
    width: 150px;
    height: 150px;
    border: 2px dashed var(--accent-color);
    border-radius: 50%;
    margin: 0 auto 15px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background-color: rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

#image-preview {
    display: none;
    max-width: 100%;
    max-height: 100%;
}

#image-preview-placeholder {
    font-size: 5em;
    color: var(--text-color);
    opacity: 0.3;
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
}

.file-input-button {
    padding: 10px 20px;
    border-radius: 5px;
    background-color: var(--input-bg);
    color: var(--accent-color);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.3s;
}

.file-input-button:hover {
    background-color: var(--border-color);
}

#photo-upload {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* 操作按鈕 */
.action-btn {
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    background-color: var(--accent-color);
    color: var(--bg-color);
    font-weight: bold;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.action-btn:hover {
    background-color: var(--accent-dark);
}

/* 預覽卡片 - 必須保持適合列印的樣式 */
#id-card-preview {
    display: none; /* 預設隱藏，由 JS 控制 */
    width: 100%;
    max-width: 320px;
    margin: 20px auto;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 10px;
    background-color: #fff;
    color: #000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-family: 'Noto Sans TC', sans-serif;
}

.id-card-header {
    text-align: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.id-card-header h2 {
    color: #000;
    text-shadow: none;
    font-size: 1.2em;
    margin: 0;
}

.id-card-body {
    display: flex;
    align-items: center;
    gap: 15px;
}

.id-card-photo {
    width: 80px;
    height: 100px;
    border: 1px solid #ddd;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}
.id-card-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.id-card-info {
    font-size: 0.9em;
}
.id-card-info div {
    margin-bottom: 5px;
}

.id-card-footer {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed #ccc;
    font-size: 0.8em;
    text-align: center;
    color: #555;
}

/* 裁切工具 Modal */
#cropper-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    display: none; /* 由 JS 控制 */
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.cropper-modal-content {
    background-color: var(--container-bg);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid var(--accent-color);
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#cropper-image {
    max-width: 100%;
    max-height: calc(90vh - 100px); /* 留空間給按鈕 */
}
.cropper-actions {
    margin-top: 15px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.cropper-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}
.cropper-btn-primary {
    background-color: var(--accent-color);
    color: var(--bg-color);
}
.cropper-btn-secondary {
    background-color: #555;
    color: white;
}


/* 列印樣式覆蓋 */
@media print {
    body {
        background: none;
        color: black;
        padding: 0;
        margin: 0;
    }

    body::before {
        display: none;
    }

    /* 隱藏所有非列印內容 */
    .id-card-container, .menu-btn, .footer, .button-container {
        display: none !important;
    }

    /* 只顯示預覽卡片 */
    #id-card-preview {
        display: block !important;
        width: 100%;
        max-width: 100%;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 0;
        margin: 0;
    }
}