/* 顧客管理画面専用スタイル */

/* 顧客管理コンテナ */
.customer-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-customer-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-customer-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;
}

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

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

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

.customer-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;
}

/* テーブルコンテナ */
.customer-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;
}

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

.customer-table th:nth-child(1) {
    width: 80px;
}

/* 顧客ID */
.customer-table th:nth-child(2) {
    width: 180px;
}

/* 会社名 */
.customer-table th:nth-child(3) {
    width: 120px;
}

/* 代表者 */
.customer-table th:nth-child(4) {
    width: 200px;
}

/* 連絡先 */
.customer-table th:nth-child(5) {
    width: 100px;
}

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

/* 最終請求 */
.customer-table th:nth-child(7) {
    width: 120px;
}

/* 累計売上 */
.customer-table th:nth-child(8) {
    width: 60px;
}

/* 操作 */

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

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

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

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

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

.customer-table td {
    padding: 16px 12px;
    vertical-align: top;
}

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

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

.representative {
    color: #374151;
}

.contact-info .email {
    color: #3b82f6;
    margin-bottom: 2px;
}

.contact-info .phone {
    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.active {
    background-color: #dbeafe;
    color: #1d4ed8;
}

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

.last-invoice {
    color: #6b7280;
}

.total-sales {
    font-weight: 600;
    color: #059669;
}

/* アクションボタン */
.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: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    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-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;
}

.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 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 textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.form-group textarea {
    resize: vertical;
}

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

.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: 150px;
}

.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) {
    .customer-table-container {
        overflow-x: auto;
    }

    .customer-table {
        min-width: 1000px;
    }

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

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

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

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

    .customer-table {
        min-width: 600px;
    }

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