/* リセット＆基本スタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    line-height: 1.6;
    color: #333;
    display: flex;
}

/* サイドバー */
.sidebar {
    width: 250px;
    background: #1f2937;
    color: white;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
}

.sidebar-header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .logo {
    font-size: 48px;
    margin-bottom: 10px;
    filter: brightness(0) invert(1);
}

.sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
}

.sidebar-menu li {
    margin: 5px 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: #d1d5db;
    text-decoration: none;
    transition: all 0.3s;
    gap: 12px;
}

.sidebar-menu a:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-menu li.active a {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
}

.sidebar-menu a i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar-menu a span {
    font-size: 15px;
}

/* メインコンテンツ */
.main-content {
    margin-left: 250px;
    flex: 1;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* ヘッダー */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 40px;
    text-align: center;
}

.header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.header h1::before {
    content: '🐾';
    font-size: 3rem;
    filter: brightness(0) invert(1);
    display: inline-block;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.95;
    font-weight: 300;
}

/* セクション共通スタイル */
section {
    padding: 20px 30px;
    border-bottom: 1px solid #e5e7eb;
}

section:last-child {
    border-bottom: none;
}

section h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #374151;
    font-weight: 600;
    display: flex;
    align-items: center;
}

section h2 i {
    margin-right: 10px;
    color: #667eea;
}

/* 月別サマリー */
.monthly-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 10px;
}

.month-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.month-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.month-card .month-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 8px;
}

.month-card .month-amount {
    font-size: 1.5rem;
    font-weight: 700;
}

.month-card .month-count {
    font-size: 0.85rem;
    opacity: 0.85;
    margin-top: 6px;
}

/* CSVインポートセクション */
.import-area {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.file-input {
    flex: 1;
    min-width: 250px;
    padding: 10px;
    border: 2px dashed #d1d5db;
    border-radius: 6px;
    background: #f9fafb;
    cursor: pointer;
    transition: border-color 0.2s;
}

.file-input:hover {
    border-color: #667eea;
}

.import-status {
    color: #16a34a;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.import-help {
    background: #f0f9ff;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #0284c7;
}

.import-help p {
    font-size: 0.9rem;
    color: #0c4a6e;
    margin-bottom: 5px;
}

.import-help p:last-child {
    margin-bottom: 0;
}

.import-help i {
    margin-right: 6px;
}

.import-help .note {
    font-size: 0.85rem;
    color: #047857;
    font-weight: 500;
    margin-top: 8px;
}

/* フィルターセクション */
.filter-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: #4b5563;
}

.filter-group label i {
    margin-right: 6px;
    color: #667eea;
}

.filter-group input,
.filter-group select {
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ボタン */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

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

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-success {
    background: #16a34a;
    color: white;
}

.btn-success:hover {
    background: #15803d;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* リストセクション */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.list-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    max-width: 100%;
}

.payment-table {
    width: 100%;
    min-width: 1600px;
    border-collapse: collapse;
    background: white;
    table-layout: fixed;
}

.payment-table thead {
    background: #f9fafb;
    position: sticky;
    top: 0;
    z-index: 10;
}

.payment-table th {
    padding: 8px 6px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    font-size: 0.8rem;
    white-space: nowrap;
    vertical-align: middle;
    box-sizing: border-box;
}

.payment-table td {
    padding: 8px 6px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.8rem;
    vertical-align: middle;
    box-sizing: border-box;
}

.payment-table tbody tr {
    transition: background-color 0.2s;
}

.payment-table tbody tr:hover {
    background-color: #f9fafb;
}

.payment-table tbody tr.paid-row {
    opacity: 0.6;
    background-color: #f0fdf4;
}

/* テーブルカラム幅 - 固定幅で完全に揃える */
.col-checkbox {
    width: 50px;
    text-align: center;
}

.col-status {
    width: 90px;
}

.col-ringi-id {
    width: 130px;
}

.col-ringi-id strong {
    color: #667eea;
    font-weight: 600;
}

.col-payment-date {
    width: 110px;
}

.col-paid-date {
    width: 130px;
}

.col-title {
    width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-payee {
    width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-amount {
    width: 120px;
    text-align: right;
}

.col-applicant {
    width: 90px;
}

.col-type {
    width: 100px;
}

.col-actions {
    width: 240px;
}

.col-actions .btn {
    margin: 2px 1px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    padding: 5px 8px;
}

/* ステータスバッジ */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

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

.status-paid {
    background: #d1fae5;
    color: #065f46;
}

/* 金額表示 */
.amount-display {
    font-weight: 600;
    color: #374151;
}

/* データなしメッセージ */
.no-data-message {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.no-data-message i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.4;
}

.no-data-message p {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.no-data-message .hint {
    font-size: 0.9rem;
    color: #9ca3af;
}

/* ページネーション */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.page-info {
    font-weight: 500;
    color: #4b5563;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.4rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.2s;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #374151;
}

.modal-body {
    padding: 30px;
}

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

.detail-group:last-child {
    margin-bottom: 0;
}

.detail-label {
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.detail-value {
    color: #1f2937;
    font-size: 1rem;
    padding: 10px;
    background: #f9fafb;
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

.detail-value.large {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

/* レスポンシブデザイン */
@media (max-width: 1024px) {
    .container {
        margin: 0;
        border-radius: 0;
    }

    section {
        padding: 20px 25px;
    }

    .header {
        padding: 25px 25px;
    }

    .monthly-summary {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }

    .filter-controls {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    section {
        padding: 20px 15px;
    }

    .header {
        padding: 20px 15px;
    }

    section h2 {
        font-size: 1.2rem;
    }

    .list-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .list-actions {
        width: 100%;
        flex-direction: column;
    }

    .list-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .table-container {
        font-size: 0.85rem;
    }

    .payment-table th,
    .payment-table td {
        padding: 10px 8px;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-body {
        padding: 20px;
    }

    .import-area {
        flex-direction: column;
        align-items: stretch;
    }

    .file-input {
        width: 100%;
    }
    
    .monthly-summary {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* チェックボックスカスタマイズ */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

/* 日付入力フィールド */
.paid-date-input {
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.85rem;
    width: 120px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.paid-date-input:hover {
    border-color: #667eea;
}

.paid-date-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* スクロールバーカスタマイズ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* トースト通知アニメーション */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}
