/**
 * 見積書固有スタイル
 * estimate.css
 */

/* ===== 見積書専用カラーテーマ ===== */
:root {
    --estimate-primary: #17a2b8;
    --estimate-secondary: #138496;
    --estimate-accent: #20c997;
    --estimate-light: #e1f5fe;
    --estimate-dark: #0d5aa7;
}

/* ===== 見積書モーダルのカスタマイズ ===== */
.invoice-modal.estimate-modal .invoice-modal-header {
    background: linear-gradient(135deg, var(--estimate-primary) 0%, var(--estimate-secondary) 100%);
}

.invoice-modal.estimate-modal .invoice-tab-btn.active {
    background: linear-gradient(135deg, var(--estimate-primary) 0%, var(--estimate-secondary) 100%);
}

.invoice-modal.estimate-modal .invoice-tab-btn.active::after {
    background: linear-gradient(135deg, var(--estimate-primary) 0%, var(--estimate-secondary) 100%);
}

.invoice-modal.estimate-modal .invoice-tab-content h3 {
    border-left-color: var(--estimate-primary);
}

/* ===== 見積書専用アイコンとラベル ===== */
.estimate-modal #invoiceModalTitle::before {
    content: '📋 ';
}

.estimate-modal .btn-primary {
    background: linear-gradient(135deg, var(--estimate-primary) 0%, var(--estimate-secondary) 100%);
}

.estimate-modal .form-group input:focus,
.estimate-modal .form-group select:focus,
.estimate-modal .form-group textarea:focus {
    border-color: var(--estimate-primary);
    box-shadow: 0 0 0 3px rgba(23, 162, 184, 0.1);
}

/* ===== 見積書固有フィールドスタイル ===== */
.estimate-specific {
    background: linear-gradient(135deg, var(--estimate-light) 0%, #f0fdff 100%);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid rgba(23, 162, 184, 0.2);
    margin: 16px 0;
}

.estimate-specific h4 {
    color: var(--estimate-primary);
    margin: 0 0 12px 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.estimate-specific h4::before {
    content: '📅';
}

/* ===== 有効期限表示の強調 ===== */
.valid-until-display {
    background: var(--estimate-light);
    border: 2px solid var(--estimate-primary);
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    margin: 12px 0;
}

.valid-until-label {
    font-size: 12px;
    color: var(--estimate-dark);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.valid-until-date {
    font-size: 18px;
    font-weight: 700;
    color: var(--estimate-primary);
    margin-top: 4px;
}

.valid-until-warning {
    font-size: 11px;
    color: #dc3545;
    margin-top: 4px;
    font-style: italic;
}

/* ===== 見積書明細テーブル ===== */
.estimate-modal .invoice-item-header {
    background: linear-gradient(135deg, var(--estimate-primary) 0%, var(--estimate-secondary) 100%);
}

.estimate-modal .add-item-btn {
    background: linear-gradient(135deg, var(--estimate-primary) 0%, var(--estimate-accent) 100%);
}

.estimate-modal .add-item-btn:hover {
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
}

/* ===== 見積金額計算の強調表示 ===== */
.estimate-modal .invoice-calculation {
    background: linear-gradient(135deg, var(--estimate-light) 0%, #e8f8f9 100%);
    border: 2px solid rgba(23, 162, 184, 0.3);
}

.estimate-modal .calculation-row.total {
    border-top-color: var(--estimate-primary);
    color: var(--estimate-primary);
}

.estimate-modal .calc-value {
    color: var(--estimate-primary);
}

/* ===== 見積書特有の注意事項 ===== */
.estimate-notes {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 12px;
    margin: 16px 0;
}

.estimate-notes h5 {
    margin: 0 0 8px 0;
    color: #856404;
    font-size: 14px;
    font-weight: 600;
}

.estimate-notes p {
    margin: 0;
    font-size: 13px;
    color: #856404;
    line-height: 1.5;
}

/* ===== 見積書プレビューカード ===== */
.estimate-preview-card {
    border: 2px solid var(--estimate-primary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.15);
}

.estimate-preview-card .card-header {
    background: linear-gradient(135deg, var(--estimate-primary) 0%, var(--estimate-secondary) 100%);
    color: white;
    padding: 16px;
    font-weight: 600;
}

.estimate-preview-card .card-body {
    padding: 20px;
    background: white;
}

/* ===== 見積書ステータスバッジ ===== */
.estimate-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.estimate-status.draft {
    background: #e9ecef;
    color: #6c757d;
}

.estimate-status.draft::before {
    content: '📝';
}

.estimate-status.sent {
    background: var(--estimate-light);
    color: var(--estimate-primary);
}

.estimate-status.sent::before {
    content: '📤';
}

.estimate-status.accepted {
    background: #d4edda;
    color: #155724;
}

.estimate-status.accepted::before {
    content: '✅';
}

.estimate-status.expired {
    background: #f8d7da;
    color: #721c24;
}

.estimate-status.expired::before {
    content: '⏰';
}

/* ===== 見積書→請求書変換ボタン ===== */
.convert-to-invoice {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.25);
}

.convert-to-invoice:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.35);
}

.convert-to-invoice::before {
    content: '🔄';
}

/* ===== 見積書リスト表示 ===== */
.estimate-list-item {
    border: 1px solid #e0e6ed;
    border-left: 4px solid var(--estimate-primary);
    border-radius: 6px;
    margin-bottom: 12px;
    transition: box-shadow 0.2s;
}

.estimate-list-item:hover {
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.1);
}

.estimate-list-item .item-header {
    background: linear-gradient(to right, var(--estimate-light), transparent);
    padding: 16px;
    border-bottom: 1px solid #e0e6ed;
}

.estimate-list-item .item-body {
    padding: 16px;
}

.estimate-number {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--estimate-primary);
    font-size: 16px;
}

.estimate-amount {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 18px;
    color: var(--estimate-primary);
    text-align: right;
}

/* ===== 見積書印刷時の調整 ===== */
@media print {
    .estimate-modal .invoice-modal-header,
    .estimate-modal .invoice-modal-footer {
        background: white !important;
        color: black !important;
    }
    
    .estimate-preview-card {
        border-color: #000 !important;
        box-shadow: none !important;
    }
    
    .estimate-status {
        border: 1px solid #000 !important;
        background: white !important;
        color: black !important;
    }
}

/* ===== アニメーション ===== */
@keyframes estimateGlow {
    0% { box-shadow: 0 0 5px rgba(23, 162, 184, 0.3); }
    50% { box-shadow: 0 0 20px rgba(23, 162, 184, 0.6); }
    100% { box-shadow: 0 0 5px rgba(23, 162, 184, 0.3); }
}

.estimate-highlight {
    animation: estimateGlow 2s ease-in-out infinite;
}

/* ===== レスポンシブ調整 ===== */
@media (max-width: 768px) {
    .estimate-preview-card .card-header {
        padding: 12px;
        font-size: 14px;
    }
    
    .estimate-amount {
        font-size: 16px;
    }
    
    .convert-to-invoice {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .estimate-list-item .item-header,
    .estimate-list-item .item-body {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .estimate-number {
        font-size: 14px;
    }
    
    .estimate-amount {
        font-size: 14px;
    }
    
    .valid-until-date {
        font-size: 16px;
    }
}