/* ========================================
   見積書ダウンロード機能用CSS
   ======================================== */

/* 隠し状態 */
.estimate-hidden {
    display: none !important;
}

.estimate-download-section.estimate-visible {
    display: block !important;
    animation: estimateFadeIn 0.5s ease-out;
}

@keyframes estimateFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 見積書ダウンロードセクション */
.estimate-download-section {
    margin-top: 40px;
    padding: 35px;
    background: linear-gradient(135deg, #f8f9fc 0%, #e9ecf5 100%);
    border-radius: 16px;
    border: 2px dashed rgba(52, 152, 219, 0.3);
    text-align: center;
}

.estimate-download-section h3 {
    font-size: 22px;
    color: #2c3e50;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.estimate-download-section h3 i {
    color: #e74c3c;
    font-size: 24px;
}

.estimate-download-section > p {
    color: #666;
    font-size: 15px;
    margin-bottom: 25px;
}

/* 見積書フォーム */
.estimate-form {
    max-width: 500px;
    margin: 0 auto;
}

.estimate-form-row {
    margin-bottom: 20px;
}

.estimate-form-row-half {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.estimate-form-group {
    text-align: left;
}

.estimate-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.estimate-form-group label .required {
    color: #e74c3c;
    margin-left: 3px;
}

.estimate-form-group input,
.estimate-form-group select {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    border: 2px solid #dde1e8;
    border-radius: 10px;
    background: white;
    color: #333;
    transition: all 0.3s ease;
}

.estimate-form-group input:focus,
.estimate-form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.15);
}

.estimate-form-group input::placeholder {
    color: #aaa;
}

#downloadEstimateBtn {
    margin-top: 10px;
    padding: 16px 40px;
    font-size: 17px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

#downloadEstimateBtn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.35);
}

#downloadEstimateBtn i {
    margin-right: 8px;
}

/* ========================================
   見積書プレビューモーダル
   ======================================== */
.estimate-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    overflow-y: auto;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.estimate-modal.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    opacity: 1;
}

.estimate-modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.estimate-modal.active .estimate-modal-content {
    transform: translateY(0);
}

.estimate-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.estimate-modal-header h3 {
    margin: 0;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.estimate-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.estimate-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.estimate-modal-body {
    padding: 30px;
    background: #f5f6fa;
    max-height: 60vh;
    overflow-y: auto;
}

.estimate-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding: 20px 25px;
    background: white;
    border-top: 1px solid #eee;
}

.estimate-modal-footer .btn {
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
}

/* ========================================
   見積書プレビュー本体
   ======================================== */
.estimate-preview {
    background: white;
    padding: 50px;
    border: 1px solid #ddd;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
    color: #333;
    line-height: 1.6;
}

/* 見積書ヘッダー */
.estimate-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    padding-bottom: 25px;
    border-bottom: 3px solid #2c3e50;
}

.estimate-title-section h1 {
    font-size: 32px;
    font-weight: bold;
    color: #2c3e50;
    margin: 0 0 10px 0;
    letter-spacing: 8px;
}

.estimate-number {
    font-size: 14px;
    color: #666;
}

.estimate-meta {
    text-align: right;
    font-size: 14px;
    color: #555;
}

.estimate-meta p {
    margin: 5px 0;
}

/* 宛先 */
.estimate-addressee {
    margin-bottom: 35px;
}

.estimate-addressee-name {
    font-size: 22px;
    font-weight: bold;
    color: #2c3e50;
    padding-bottom: 10px;
    border-bottom: 2px solid #2c3e50;
    display: inline-block;
    min-width: 250px;
}

.estimate-addressee-sama {
    font-size: 18px;
    font-weight: normal;
    margin-left: 10px;
}

/* 合計金額 */
.estimate-total-section {
    background: linear-gradient(135deg, #f8f9fc 0%, #e8eef5 100%);
    padding: 25px 30px;
    border-radius: 12px;
    margin-bottom: 35px;
    border: 2px solid #3498db;
}

.estimate-total-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.estimate-total-amount {
    font-size: 36px;
    font-weight: bold;
    color: #2c3e50;
}

.estimate-total-amount .currency {
    font-size: 24px;
    margin-right: 5px;
}

.estimate-total-tax {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

/* 明細テーブル */
.estimate-details {
    margin-bottom: 35px;
}

.estimate-details h3 {
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
}

.estimate-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.estimate-table th,
.estimate-table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.estimate-table th {
    background: #f5f6fa;
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
}

.estimate-table td {
    color: #333;
}

.estimate-table .text-right {
    text-align: right;
}

.estimate-table .text-center {
    text-align: center;
}

.estimate-table tbody tr:hover {
    background: #fafbfd;
}

.estimate-table tfoot td {
    font-weight: bold;
    background: #f8f9fc;
}

/* 備考欄 */
.estimate-notes {
    margin-bottom: 35px;
    padding: 20px;
    background: #fafafa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.estimate-notes h3 {
    font-size: 15px;
    color: #2c3e50;
    margin: 0 0 12px 0;
}

.estimate-notes ul {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    color: #555;
}

.estimate-notes ul li {
    margin-bottom: 6px;
}

/* 発行元情報 */
.estimate-issuer {
    text-align: right;
    padding-top: 30px;
    border-top: 1px solid #ddd;
    margin-top: 40px;
}

.estimate-issuer-name {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 8px;
}

.estimate-issuer-info {
    font-size: 13px;
    color: #666;
    line-height: 1.8;
}

/* ローディング */
.estimate-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: #666;
    font-size: 16px;
}

.estimate-loading i {
    margin-right: 10px;
    font-size: 24px;
}

/* ========================================
   レスポンシブデザイン
   ======================================== */
@media (max-width: 768px) {
    .estimate-download-section {
        padding: 25px 20px;
    }

    .estimate-download-section h3 {
        font-size: 18px;
    }

    .estimate-form-row-half {
        grid-template-columns: 1fr;
    }

    .estimate-modal-body {
        padding: 15px;
    }

    .estimate-preview {
        padding: 25px 20px;
    }

    .estimate-header {
        flex-direction: column;
        gap: 15px;
    }

    .estimate-meta {
        text-align: left;
    }

    .estimate-title-section h1 {
        font-size: 24px;
        letter-spacing: 4px;
    }

    .estimate-total-amount {
        font-size: 28px;
    }

    .estimate-table {
        font-size: 12px;
    }

    .estimate-table th,
    .estimate-table td {
        padding: 10px 8px;
    }

    .estimate-modal-footer {
        flex-direction: column;
    }

    .estimate-modal-footer .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .estimate-download-section {
        padding: 20px 15px;
        margin-top: 30px;
    }

    .estimate-form-group input,
    .estimate-form-group select {
        padding: 12px 14px;
        font-size: 14px;
    }

    #downloadEstimateBtn {
        width: 100%;
        padding: 14px 20px;
    }

    .estimate-preview {
        padding: 20px 15px;
    }

    .estimate-title-section h1 {
        font-size: 20px;
        letter-spacing: 2px;
    }

    .estimate-addressee-name {
        font-size: 18px;
        min-width: auto;
    }

    .estimate-total-section {
        padding: 20px;
    }

    .estimate-total-amount {
        font-size: 24px;
    }
}

