/* 月次レポート管理画面専用スタイル */

/* レポート管理コンテナ */
.report-management {
    padding: 32px;
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ページヘッダー */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.add-report-btn {
    background-color: #3b82f6;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.add-report-btn:hover {
    background-color: #2563eb;
}

/* コントロールセクション */
.controls-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    display: flex;
    gap: 16px;
    align-items: center;
}

.report-search {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.report-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
}

.report-search input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background-color: #f8fafc;
}

.report-search input:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: white;
}

.filter-btn {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    transition: all 0.2s;
}

.filter-btn:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

/* 統計カード */
.report-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-text h3 {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
}

.stat-icon.blue {
    background-color: #3b82f6;
}

.stat-icon.gray {
    background-color: #6b7280;
}

.stat-icon.orange {
    background-color: #f59e0b;
}

.stat-icon.green {
    background-color: #10b981;
}

/* テーブルコンテナ */
.report-table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    margin-bottom: 24px;
}

/* テーブル */
.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: fixed;
}

.report-table th:nth-child(1) {
    width: 160px;
}

/* レポート番号 */
.report-table th:nth-child(2) {
    width: 200px;
}

/* 顧客名 */
.report-table th:nth-child(3) {
    width: 120px;
}

/* 対象期間 */
.report-table th:nth-child(4) {
    width: 120px;
}

/* 作成日 */
.report-table th:nth-child(5) {
    width: 120px;
}

/* ステータス */
.report-table th:nth-child(6) {
    width: 80px;
}

/* 操作 */

.report-table thead {
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.report-table th {
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.report-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s;
}

.report-table tbody tr:hover {
    background-color: #f8fafc;
}

.report-table tbody tr:last-child {
    border-bottom: none;
}

.report-table td {
    padding: 16px 12px;
    vertical-align: middle;
}

.report-id {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.report-id-link {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    color: #3b82f6;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s;
}

.report-id-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

.customer-name {
    font-weight: 500;
    color: #1e293b;
}

.period {
    color: #374151;
    font-size: 13px;
}

.created-date {
    color: #6b7280;
    font-size: 13px;
}

/* ステータスバッジ */
.status-badge {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.approved {
    background-color: #dcfce7;
    color: #166534;
}

.status-badge.pending {
    background-color: #fef3c7;
    color: #92400e;
}

.status-badge.draft {
    background-color: #f3f4f6;
    color: #6b7280;
}

/* アクションボタン */
.actions {
    text-align: center;
}

.action-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #6b7280;
    border-radius: 4px;
    transition: all 0.2s;
    position: relative;
}

.action-btn:hover {
    background-color: #f3f4f6;
    color: #374151;
}

/* ページネーション */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px 0;
}

.pagination-btn {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    color: #64748b;
    font-size: 14px;
}

/* モーダル */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: all 0.3s;
}

.modal-overlay.active {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* display: flex で直接表示する場合のスタイル */
.modal-overlay[style*="display: flex"] {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal.large {
    max-width: 600px;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
}

.modal-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #6b7280;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.modal-body {
    padding: 24px;
    max-height: 400px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 24px;
    border-top: 1px solid #e2e8f0;
    background-color: #f8fafc;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.form-group textarea {
    resize: vertical;
}

.btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-secondary {
    background-color: white;
    color: #6b7280;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background-color: #f8fafc;
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
}

/* アクションメニュー */
.action-menu {
    position: fixed;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95);
    transition: all 0.2s;
    min-width: 170px;
}

.action-menu.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.action-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    color: #374151;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: left;
}

.action-menu-item:hover {
    background-color: #f8fafc;
}

.action-menu-item.delete {
    color: #dc2626;
}

.action-menu-item.delete:hover {
    background-color: #fef2f2;
}

/* レスポンシブデザイン */
@media (max-width: 1200px) {
    .report-table-container {
        overflow-x: auto;
    }

    .report-table {
        min-width: 800px;
    }

    .report-table th,
    .report-table td {
        white-space: nowrap;
    }
}

@media (max-width: 1024px) {
    .report-stats {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .controls-section {
        flex-direction: column;
        align-items: stretch;
    }

    .report-search {
        max-width: none;
    }

    .report-stats {
        grid-template-columns: 1fr 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal.large {
        width: 95%;
        margin: 16px;
    }
}

/* レポート作成モーダル専用スタイル */
.form-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #3b82f6;
    display: inline-block;
}

.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
}

#profit,
#profitRate {
    background-color: #f9fafb;
    color: #6b7280;
}

.modal.large {
    max-width: 900px;
    width: 90%;
}

.modal-body {
    max-height: 70vh;
    overflow-y: auto;
    padding: 24px;
}

.modal-footer .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}