/* リセットとベーススタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --gold-color: #d4af37;
    --gold-light: #f4d03f;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --bg-color: #f8fafc;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.certificate-container {
    max-width: 1000px;
    width: 100%;
}

/* 認定証本体 */
.certificate {
    background: white;
    padding: 60px 80px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    aspect-ratio: 1.414 / 1; /* A4比率 */
    max-width: 100%;
}

/* 装飾的なボーダー */
.certificate-border {
    position: absolute;
    top: 30px;
    left: 30px;
    right: 30px;
    bottom: 30px;
    border: 3px double var(--gold-color);
    pointer-events: none;
}

.corner-decoration {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 2px solid var(--gold-color);
}

.corner-decoration.top-left {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.corner-decoration.top-right {
    top: -2px;
    right: -2px;
    border-left: none;
    border-bottom: none;
}

.corner-decoration.bottom-left {
    bottom: -2px;
    left: -2px;
    border-right: none;
    border-top: none;
}

.corner-decoration.bottom-right {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}

/* ヘッダー */
.certificate-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
}

.certificate-logo {
    margin-bottom: 20px;
}

.certificate-logo img {
    height: 80px;
    width: auto;
}

.certificate-title {
    font-family: 'Noto Serif JP', serif;
    font-size: 48px;
    font-weight: 900;
    color: var(--text-dark);
    margin-bottom: 8px;
    letter-spacing: 0.1em;
}

.certificate-title-en {
    font-size: 18px;
    color: var(--text-light);
    font-weight: 300;
    letter-spacing: 0.05em;
}

/* 本文 */
.certificate-body {
    position: relative;
    z-index: 1;
}

.certificate-number {
    text-align: right;
    margin-bottom: 30px;
    font-size: 14px;
}

.certificate-number .label {
    color: var(--text-light);
}

.certificate-number .value {
    color: var(--text-dark);
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.recipient-section {
    margin-bottom: 40px;
}

.recipient-name-wrapper {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
}

.recipient-name {
    font-family: 'Noto Serif JP', serif;
    font-size: 42px;
    font-weight: 700;
    color: var(--text-dark);
    border-bottom: 2px solid var(--text-dark);
    padding: 0 40px 8px;
    min-width: 300px;
    text-align: center;
}

.recipient-name-suffix {
    font-size: 28px;
    color: var(--text-dark);
}

.certification-text {
    text-align: center;
    margin-bottom: 40px;
}

.main-text {
    font-size: 16px;
    line-height: 2;
    color: var(--text-dark);
}

/* 認定レベル */
.certification-level {
    margin-bottom: 40px;
    text-align: center;
}

.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 20px;
    padding: 24px 48px;
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
}

.level-badge .level-icon {
    font-size: 48px;
}

.level-badge .level-info h2 {
    font-family: 'Noto Serif JP', serif;
    font-size: 32px;
    font-weight: 900;
    color: white;
    margin-bottom: 4px;
}

.level-badge .level-en {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 300;
    letter-spacing: 0.05em;
}

.level-description {
    max-width: 700px;
    margin: 0 auto;
}

.level-description p {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-dark);
}

/* 日付 */
.certification-date {
    text-align: center;
    margin-bottom: 16px;
}

.certification-date .date-text {
    font-size: 16px;
}

.certification-date .label,
.validity-period .label {
    color: var(--text-light);
    margin-right: 8px;
}

.certification-date .value,
.validity-period .value {
    color: var(--text-dark);
    font-weight: 700;
}

/* フッター（署名） */
.certificate-footer {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 60px;
}

.signature-section {
    flex: 1;
}

.organization-info {
    margin-bottom: 20px;
}

.organization-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.organization-name-en {
    font-size: 12px;
    color: var(--text-light);
}

.signature-block {
    display: flex;
    justify-content: flex-start;
}

.signature-line {
    display: flex;
    align-items: flex-end;
    gap: 20px;
}

.signature-line .title {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.signature-space {
    min-width: 150px;
}

.signatory-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    padding-bottom: 8px;
}

.seal-placeholder {
    width: 60px;
    height: 60px;
    border: 2px solid #dc2626;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #dc2626;
    font-weight: 700;
    font-size: 18px;
    background: radial-gradient(circle, rgba(220, 38, 38, 0.1) 0%, transparent 70%);
}

/* QRコード */
.certificate-qr {
    text-align: center;
}

.qr-code {
    margin-bottom: 8px;
}

.qr-placeholder {
    width: 100px;
    height: 100px;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    font-size: 12px;
    color: var(--text-light);
}

.qr-text {
    font-size: 11px;
    color: var(--text-light);
}

/* 背景の透かし */
.watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.3;
    width: 400px;
    height: 400px;
    pointer-events: none;
    z-index: 0;
}

/* 印刷ボタン */
.print-button-container {
    text-align: center;
    margin-top: 30px;
}

.print-button {
    background: white;
    color: var(--primary-color);
    padding: 16px 40px;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.print-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.print-icon {
    font-size: 20px;
}

/* 印刷スタイル */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .certificate-container {
        max-width: 100%;
    }

    .certificate {
        box-shadow: none;
        padding: 40px 60px;
        page-break-after: avoid;
    }

    .no-print {
        display: none !important;
    }

    .certificate-border {
        top: 20px;
        left: 20px;
        right: 20px;
        bottom: 20px;
    }
}

/* レスポンシブ */
@media (max-width: 768px) {
    body {
        padding: 20px 10px;
    }

    .certificate {
        padding: 40px 30px;
    }

    .certificate-border {
        top: 20px;
        left: 20px;
        right: 20px;
        bottom: 20px;
    }

    .corner-decoration {
        width: 40px;
        height: 40px;
    }

    .certificate-logo img {
        height: 60px;
    }

    .certificate-title {
        font-size: 36px;
    }

    .certificate-title-en {
        font-size: 14px;
    }

    .recipient-name {
        font-size: 32px;
        min-width: 200px;
        padding: 0 20px 8px;
    }

    .recipient-name-suffix {
        font-size: 24px;
    }

    .main-text {
        font-size: 14px;
    }

    .level-badge {
        flex-direction: column;
        gap: 12px;
        padding: 20px 32px;
    }

    .level-badge .level-info h2 {
        font-size: 28px;
    }

    .level-description p {
        font-size: 13px;
    }

    .certificate-footer {
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }

    .signature-section {
        text-align: center;
    }

    .signature-block {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .certificate {
        padding: 30px 20px;
    }

    .certificate-title {
        font-size: 28px;
    }

    .recipient-name {
        font-size: 24px;
        min-width: 150px;
    }

    .level-badge .level-info h2 {
        font-size: 24px;
    }

    .main-text {
        font-size: 12px;
    }
}
