/* メインスタイルシート */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ユーザー名検証フィードバック */
.form-feedback {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.4;
    min-height: 1.2rem;
}

.form-feedback.success {
    color: #28a745;
}

.form-feedback.error {
    color: #dc3545;
}

.form-feedback.checking {
    color: #6c757d;
}

.form-feedback i {
    margin-right: 0.5rem;
}

/* お問い合わせフォーム専用スタイル */
.contact-description {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    color: #6c757d;
    border-left: 4px solid #007bff;
}

#contact-message {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

#message-count {
    font-weight: bold;
    color: #007bff;
}

.contact-success {
    text-align: center;
    padding: 2rem;
}

.success-icon {
    font-size: 3rem;
    color: #28a745;
    margin-bottom: 1rem;
}

.contact-success h4 {
    color: #28a745;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.contact-success p {
    color: #6c757d;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.contact-info {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: left;
}

.contact-info p {
    margin-bottom: 0.5rem;
    color: #495057;
}

.contact-info strong {
    color: #2c3e50;
}

#contact-image-preview {
    margin-top: 1rem;
}

#contact-preview-img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 8px;
    border: 2px solid #dee2e6;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Enhanced Dashboard Styles */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

.card-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.2rem;
}

.month-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-month {
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-month:hover {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.transaction-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.filter-btn.active,
.filter-btn:hover {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.enhanced-transactions-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: white;
}

.transaction-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.3s ease;
}

.transaction-item:hover {
    background-color: #f8f9fa;
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.transaction-date-large {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2c3e50;
    min-width: 80px;
    flex-shrink: 0;
    text-align: center;
    padding: 0 0.5rem;
}

.transaction-item.income .transaction-icon {
    background-color: #d4edda;
    color: #155724;
}

.transaction-item.expense .transaction-icon {
    background-color: #f8d7da;
    color: #721c24;
}

.transaction-details {
    flex: 1;
    min-width: 0;
}

.transaction-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.transaction-description {
    font-weight: 600;
    color: #2c3e50;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.transaction-amount {
    font-weight: bold;
    font-size: 1.1rem;
}

.transaction-amount.income {
    color: #28a745;
}

.transaction-amount.expense {
    color: #dc3545;
}

.transaction-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: #6c757d;
}

.transaction-meta i {
    margin-right: 0.25rem;
}

.transaction-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-action {
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    color: #6c757d;
}

.btn-action:hover {
    background-color: #e9ecef;
}

.btn-action.edit:hover {
    color: #007bff;
}

.btn-action.delete:hover {
    color: #dc3545;
}

.transaction-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
}

.summary-item {
    text-align: center;
}

.summary-label {
    display: block;
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.summary-amount {
    font-weight: bold;
    font-size: 1rem;
}

.summary-amount.positive {
    color: #28a745;
}

.summary-amount.negative {
    color: #dc3545;
}

.income-summary .summary-amount {
    color: #28a745;
}

.expense-summary .summary-amount {
    color: #dc3545;
}

.history-controls {
    display: flex;
    gap: 0.5rem;
}

.btn-outline {
    background: white;
    border: 1px solid #dee2e6;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.btn-outline:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
}

.search-filters {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.filter-row {
    display: grid;
    grid-template-columns: 1fr 150px 120px 120px auto auto;
    gap: 0.5rem;
    align-items: center;
}

.filter-row input,
.filter-row select {
    padding: 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.9rem;
}

.pagination-controls {
    margin-top: 1rem;
    text-align: center;
}

.pagination-info {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #6c757d;
}

.loading-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: #6c757d;
    text-align: center;
}

.loading-state i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #3498db;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #dee2e6;
}

.empty-hint {
    font-size: 0.9rem;
    color: #adb5bd;
    margin-top: 0.5rem;
}

/* モバイルファースト レスポンシブ対応 */
@media (max-width: 768px) {
    .card-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .month-selector {
        justify-content: center;
    }
    
    .transaction-filters {
        justify-content: center;
    }
    
    .filter-btn {
        flex: 1;
        text-align: center;
        min-width: 70px;
    }
    
    .transaction-item {
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    .transaction-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .transaction-date-large {
        font-size: 1rem;
        min-width: 60px;
        padding: 0 0.25rem;
    }
    
    .transaction-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .transaction-amount {
        font-size: 1rem;
    }
    
    .transaction-meta {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .transaction-actions {
        flex-direction: column;
    }
    
    .transaction-summary {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .history-controls {
        flex-direction: column;
    }
    
    .filter-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .pagination-controls {
        padding: 0 1rem;
    }
}

@media (max-width: 480px) {
    .enhanced-transactions-list {
        max-height: 300px;
    }
    
    .transaction-item {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .transaction-date-large {
        font-size: 0.9rem;
        min-width: 50px;
        padding: 0 0.125rem;
    }
    
    .transaction-description {
        font-size: 0.9rem;
    }
    
    .transaction-amount {
        font-size: 0.95rem;
    }
    
    .transaction-meta {
        font-size: 0.75rem;
    }
    
    .btn-action {
        padding: 0.375rem;
        font-size: 0.8rem;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ヘッダー */
.header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.logo i {
    margin-right: 0.5rem;
    color: #3498db;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* メインコンテンツ */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 80px);
}

/* お問い合わせページ表示時はメインの余白を削除 */
body.contact-active .main {
    padding: 0;
}

/* カード */
.card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

/* 認証セクション */
.auth-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    width: 100%;
    margin: 0 auto;
}

.auth-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.auth-description {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #6c757d;
    font-size: 0.9rem;
}

.username-status {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.username-status.success {
    color: #28a745;
}

.username-status.error {
    color: #dc3545;
}

.username-status.neutral {
    color: #6c757d;
}

.auth-link {
    text-align: center;
    margin-top: 1rem;
    color: #666;
}

.auth-link a {
    color: #3498db;
    text-decoration: none;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* フォーム */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.required {
    color: #dc3545;
    font-weight: bold;
}

.form-hint {
    display: block;
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.25rem;
    font-style: italic;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.transaction-form {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

/* ボタン */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-full {
    width: 100%;
}

/* サマリーカード */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    border-radius: 10px;
    color: white;
    position: relative;
    overflow: hidden;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    transform: translate(50%, -50%);
}

.income-card {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.expense-card {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.balance-card {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.card-icon {
    font-size: 2rem;
    margin-right: 1rem;
    opacity: 0.8;
}

.card-content h3 {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.amount {
    font-size: 1.8rem;
    font-weight: bold;
    margin: 0;
}

/* 取引リスト */
.transactions-list {
    max-height: 500px;
    overflow-y: auto;
}

.transaction-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.3s;
}

.transaction-item:hover {
    background-color: #f8f9fa;
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    color: white;
}

.transaction-icon.income {
    background-color: #27ae60;
}

.transaction-icon.expense {
    background-color: #e74c3c;
}

.transaction-details {
    flex: 1;
}

.transaction-description {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.transaction-category {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.25rem;
}


.transaction-amount {
    font-size: 1.1rem;
    font-weight: bold;
}

.transaction-amount.income {
    color: #27ae60;
}

.transaction-amount.expense {
    color: #e74c3c;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

/* メッセージモーダルは最前面に表示 */
#message-modal {
    z-index: 2000;
    background-color: rgba(0,0,0,0.7); /* より濃い背景で目立つように */
}

/* メッセージモーダルの内容を中央に配置し、より目立つスタイル */
#message-modal .modal-content {
    margin: 20% auto;
    max-width: 500px;
    border: 2px solid #dee2e6;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 2rem;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: slideIn 0.3s;
}

/* 支払い方法管理モーダルの特別なスタイル */
#payment-method-modal .modal-content {
    width: 1200px !important;
    max-width: 90% !important;
    max-height: 90vh !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: white !important;
    display: flex !important;
    flex-direction: column !important;
}

#payment-method-modal .modal-body {
    padding: 1.5rem !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: white !important;
    flex: 1 !important;
}

#payment-method-modal .payment-method-list-section {
    background: white !important;
    padding: 0 !important;
    margin: 0 !important;
}

#payment-method-modal .payment-method-list-section h4 {
    color: #374151 !important;
    margin-bottom: 1rem !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
}

#payment-method-modal #payment-methods-list {
    width: 100% !important;
    box-sizing: border-box !important;
    display: grid !important;
    gap: 0.75rem !important;
    max-height: 400px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-right: 0.5rem !important;
}

/* 支払い方法カードのスタイル */
.payment-method-card {
    background: white !important;
    border: 2px solid #e5e7eb !important;
    border-left: 4px solid #667eea !important;
    border-radius: 8px !important;
    padding: 0.75rem !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
    box-sizing: border-box !important;
    width: 100% !important;
    overflow: hidden !important;
}

.payment-method-card:hover {
    box-shadow: 0 4px 12px rgba(102,126,234,0.2) !important;
    transform: translateY(-2px) !important;
}

.payment-method-card-content {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    width: 100% !important;
    overflow: hidden !important;
}

.payment-method-icon {
    width: 40px !important;
    height: 40px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.25rem !important;
    box-shadow: 0 2px 8px rgba(102,126,234,0.3) !important;
    flex-shrink: 0 !important;
}

.payment-method-info {
    flex: 1 !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

.payment-method-name {
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    color: #1f2937 !important;
    margin-bottom: 0.25rem !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.payment-method-badge {
    display: inline-block !important;
    padding: 0.2rem 0.6rem !important;
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
    font-size: 0.7rem !important;
    border-radius: 10px !important;
    font-weight: 500 !important;
    box-shadow: 0 2px 4px rgba(16,185,129,0.3) !important;
}

.payment-method-delete-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    border: none !important;
    padding: 0.4rem 0.6rem !important;
    border-radius: 6px !important;
    font-weight: 500 !important;
    font-size: 0.85rem !important;
    box-shadow: 0 2px 4px rgba(239,68,68,0.3) !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    min-width: 0 !important;
}

.payment-method-delete-btn:hover {
    transform: scale(1.05) !important;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    color: #aaa;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #333;
}

/* メッセージスタイル */
.message-success {
    color: #27ae60;
    padding: 1rem;
    border-left: 4px solid #27ae60;
    background-color: #d5f4e6;
}

.message-error {
    color: #e74c3c;
    padding: 1rem;
    border-left: 4px solid #e74c3c;
    background-color: #ffeaea;
}

.message-info {
    color: #3498db;
    padding: 1rem;
    border-left: 4px solid #3498db;
    background-color: #e3f2fd;
}

/* アニメーション */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .user-info {
        justify-content: center;
    }
    
    .transaction-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .transaction-amount {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .auth-card {
        margin: 1rem;
        padding: 1.5rem;
    }

    .card {
        padding: 1rem;
    }

    .summary-card {
        padding: 1rem;
    }

    .amount {
        font-size: 1.4rem;
    }

    /* WCAG 2.1 AA準拠: 全ボタンを44x44px以上に */
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .btn-month {
        min-width: 44px;
        min-height: 44px;
    }

    .filter-btn {
        min-height: 44px;
        padding: 0.6rem 1rem;
    }

    .btn-outline {
        min-height: 44px;
        min-width: 44px;
    }

    .btn-action {
        min-width: 44px;
        min-height: 44px;
    }

    .btn-sm {
        min-height: 44px;
        padding: 0.6rem 0.75rem;
    }

    .type-btn {
        min-height: 44px;
        padding: 0.6rem 0.75rem;
    }

    .btn-delete-category {
        min-height: 44px;
        min-width: 44px;
    }

    .btn-remove-image {
        min-width: 44px;
        min-height: 44px;
    }
}

/* 編集ダイアログのスタイル */
.edit-dialog-content {
    max-width: 600px;
    width: 90%;
    margin: 5% auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 10px 10px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.3rem;
}

.close {
    font-size: 2rem;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

.edit-dialog-content form {
    padding: 1.5rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.form-actions .btn {
    min-width: 100px;
}

/* トランザクションアクションボタンのスタイル改善 */
.transaction-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.btn-action {
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #6c757d;
}

.btn-action:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
}

.btn-action.edit:hover {
    color: #007bff;
    border-color: #007bff;
}

.btn-action.delete:hover {
    color: #dc3545;
    border-color: #dc3545;
}

/* カテゴリ管理ダイアログのスタイル */
#category-modal .modal-content {
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    margin: 5% auto;
}

.modal-body {
    max-height: 65vh;
    overflow-y: auto;
    padding: 0 1.5rem 1.5rem;
}

.category-add-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.category-add-section h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-add-section h4::before {
    content: "➕";
    font-size: 1rem;
}

.category-list-section h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-list-section h4::before {
    content: "📋";
    font-size: 1rem;
}

.category-type-section {
    margin-bottom: 25px;
}

.category-type-section h5 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 2px solid #e9ecef;
}

.category-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 10px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 25px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    cursor: default;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.category-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

.category-name {
    font-weight: 500;
    color: #495057;
}

.category-badge {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-badge {
    background: #17a2b8;
    color: white;
}

.category-badge.default {
    background: #6c757d;
    color: white;
}

/* 検索フィルターの強化 */
.search-filters {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.search-filters h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-filters h4::before {
    content: "🔍";
    font-size: 1rem;
}

.filter-row {
    display: grid;
    grid-template-columns: 2fr 1fr 120px 120px auto auto;
    gap: 15px;
    align-items: end;
}

.filter-row .form-group {
    margin-bottom: 0;
}

.filter-row .form-group label {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 5px;
    font-weight: 600;
}

.filter-row input,
.filter-row select {
    border-radius: 6px;
    border: 1px solid #ced4da;
    transition: all 0.2s ease;
}

.filter-row input:focus,
.filter-row select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* 取引アクションボタンの改善 */
.transaction-actions {
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.3s ease;
    margin-left: auto;
}

.transaction-item:hover .transaction-actions {
    opacity: 1;
}

.btn-action {
    padding: 6px 8px;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    background: white;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    color: #6c757d;
    min-width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-action.edit:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.btn-action.delete:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* ページネーションの改善 */
.pagination-controls {
    text-align: center;
    margin-top: 20px;
}

.pagination-controls .btn {
    margin: 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.pagination-info {
    margin-top: 10px;
    font-size: 0.85rem;
    color: #6c757d;
    font-style: italic;
}

/* ローディング・空状態の改善 */
.loading-state {
    padding: 50px 20px;
    text-align: center;
    color: #6c757d;
}

.loading-state i {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: #007bff;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.empty-state {
    padding: 50px 20px;
    text-align: center;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #dee2e6;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.empty-hint {
    font-size: 0.9rem;
    color: #adb5bd;
    font-style: italic;
}

/* モバイル対応の改善 */
@media (max-width: 768px) {
    .edit-dialog-content {
        margin: 2% auto;
        width: 95%;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    #category-modal .modal-content {
        width: 95%;
        margin: 3% auto;
        max-height: 90vh;
    }
    
    .category-add-section {
        padding: 15px;
    }
    
    .category-items {
        justify-content: center;
    }
    
    .filter-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .transaction-actions {
        opacity: 1;
        position: static;
        margin-top: 10px;
        justify-content: center;
    }
    
    .transaction-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .transaction-main {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .category-item {
        font-size: 0.8rem;
        padding: 8px 12px;
    }
    
    .btn-action {
        min-width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
}

/* カテゴリ削除ボタン */
.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    margin-bottom: 8px;
    background-color: #fafafa;
}

.category-item:hover {
    background-color: #f0f0f0;
}

.category-name {
    flex: 1;
    font-weight: 500;
}

.category-badge {
    margin-left: 10px;
    margin-right: 10px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: #3498db;
    color: white;
}

.category-badge.default {
    background-color: #95a5a6;
}

.btn-delete-category {
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.2s ease;
}

.btn-delete-category:hover {
    background-color: #c0392b;
}

.btn-delete-category:active {
    transform: scale(0.95);
}

.btn-delete-category:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-delete-category:disabled:hover {
    background-color: #95a5a6;
    transform: none;
}

.category-type-section {
    margin-bottom: 20px;
}

.category-type-section h5 {
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid #e0e0e0;
}

/* 画像プレビューコンテナ */
.image-preview-container {
    margin-top: 15px;
    padding: 15px;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    background-color: #f8f9fa;
    text-align: center;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 600;
    color: #495057;
}

.btn-remove-image {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.3s ease;
}

.btn-remove-image:hover {
    background: #c82333;
}

.preview-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    object-fit: contain;
}

.image-info {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #6c757d;
    font-style: italic;
}

/* ファイル入力のスタイル改善 */
input[type="file"] {
    padding: 8px;
    border: 2px dashed #dee2e6;
    border-radius: 6px;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="file"]:hover {
    border-color: #adb5bd;
    background-color: #e9ecef;
}

input[type="file"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* グループ管理UI */
.group-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.group-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.group-info {
    flex: 1;
    min-width: 0; /* 長いテキストの折り返しを許可 */
    margin-right: 20px;
}

.group-info h6 {
    margin: 0 0 8px 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    word-wrap: break-word;
}

.group-info p {
    margin: 0 0 10px 0;
    color: #6c757d;
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.group-info small {
    color: #adb5bd;
    font-size: 0.85rem;
    line-height: 1.5;
    display: block;
    margin-top: 5px;
}

.group-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 180px;
    align-items: stretch;
}

.group-actions .btn {
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
    white-space: nowrap;
    border: 1px solid;
}

.group-actions .btn i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

.group-actions .btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
}

/* 取引の画像・グループ表示 */
.transaction-group {
    font-size: 0.8rem;
    color: #007bff;
    margin-bottom: 0.25rem;
}

.transaction-group i {
    margin-right: 0.25rem;
}

.transaction-image-indicator {
    margin-top: 0.5rem;
}

.btn-view-image {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-view-image:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
}

.btn-view-image i {
    margin-right: 0.25rem;
}

/* 取引タイプのfieldsetスタイルをリセット */
.type-group fieldset {
    border: none;
    padding: 0;
    margin: 0;
    min-width: 0;
}

.type-group legend {
    padding: 0;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

/* 取引タイプ選択ボタン */
.transaction-type-selector {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

/* フォームレイアウトの調整 */
.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: flex-start;
}

.form-row .form-group {
    flex: 1;
}

/* 取引追加フォームの改善 */
.transaction-form {
    background: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.type-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.type-btn:hover {
    border-color: #adb5bd;
    background: #e9ecef;
}

.type-btn.active {
    border-color: #007bff;
    background: #007bff;
    color: white;
}

.type-btn[data-type="income"].active {
    border-color: #28a745;
    background: #28a745;
}

.type-btn[data-type="expense"].active {
    border-color: #dc3545;
    background: #dc3545;
}

.type-btn i {
    font-size: 1rem;
}

/* フォーム要素のスタイル統一 */
.form-group select,
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="file"] {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* 取引タイプ、グループ、カテゴリが同じ行にある際のバランス調整 */
.form-group.type-group {
    flex: 1.3; /* 取引タイプボタンは少し広く */
}

.form-row .form-group:not(.type-group) {
    flex: 1; /* グループとカテゴリは同じ幅 */
}

/* レスポンシブ対応 */
@media (max-width: 992px) {
    /* タブレット：取引タイプを上の行、グループとカテゴリを下の行に */
    .form-row.three-items-row {
        flex-wrap: wrap;
    }
    
    .three-items-row .form-group.type-group {
        flex: 1 1 100%;
        margin-bottom: 0.5rem;
    }
    
    .three-items-row .form-group:not(.type-group) {
        flex: 1 1 calc(50% - 0.5rem);
    }
}

@media (max-width: 768px) {
    .transaction-type-selector {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .type-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .form-group.type-group,
    .form-row .form-group:not(.type-group) {
        flex: 1;
    }
}

/* 画像プレビューモーダルの改善 */
.image-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

.image-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* モバイル対応の改善 */
@media (max-width: 768px) {
    .group-item {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        padding: 16px;
    }
    
    .group-info {
        margin-right: 0;
    }
    
    .group-actions {
        flex-direction: column;
        justify-content: center;
        min-width: auto;
        gap: 6px;
    }
    
    .group-actions .btn {
        width: 100%;
        min-width: 0;
        font-size: 0.8rem;
        padding: 6px 10px;
    }
    
    .group-actions .btn i {
        margin-right: 4px;
        width: 14px;
    }
    
    .image-actions {
        flex-direction: column;
    }
    
    .image-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* グループダッシュボード */
.group-summary {
    margin-bottom: 2rem;
}

.members-summary {
    margin-bottom: 2rem;
}

.members-summary h4,
.group-transactions h4 {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.member-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.member-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.member-info h6 {
    margin: 0 0 0.75rem 0;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.member-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
}

.stat-item {
    text-align: center;
    padding: 0.5rem;
    border-radius: 4px;
    background: #f8f9fa;
}

.stat-item.income {
    background: #d4edda;
}

.stat-item.expense {
    background: #f8d7da;
}

.stat-item.balance.positive {
    background: #d1ecf1;
}

.stat-item.balance.negative {
    background: #f5c6cb;
}

.stat-item .label {
    display: block;
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.stat-item .value {
    display: block;
    font-weight: bold;
    font-size: 0.9rem;
}

.stat-item.income .value {
    color: #155724;
}

.stat-item.expense .value {
    color: #721c24;
}

.stat-item.balance.positive .value {
    color: #0c5460;
}

.stat-item.balance.negative .value {
    color: #721c24;
}

.group-transactions {
    margin-top: 2rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* メンバー管理モーダル */
.current-members-section,
.invite-member-section {
    margin-bottom: 2rem;
}

.current-members-section h4,
.invite-member-section h4 {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.member-management-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: white;
    transition: box-shadow 0.2s ease;
}

.member-management-item:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.member-basic-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #3498db;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.member-details h6 {
    margin: 0 0 0.25rem 0;
    color: #2c3e50;
}

.member-role {
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.member-role.owner {
    background: #ffeeba;
    color: #856404;
}

.member-role.admin {
    background: #bee5eb;
    color: #0c5460;
}

.member-role.member {
    background: #d1ecf1;
    color: #0c5460;
}

.join-date {
    display: block;
    color: #6c757d;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.member-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-remove-member {
    background: #dc3545;
    border: 1px solid #dc3545;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.btn-remove-member:hover {
    background: #c82333;
    border-color: #bd2130;
}

.invite-code-display {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.invite-code-display input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #f8f9fa;
    font-family: monospace;
    font-size: 1rem;
    text-align: center;
    letter-spacing: 2px;
    font-weight: bold;
}

.invite-info {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.invite-info p {
    margin: 0 0 0.5rem 0;
    color: #495057;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .members-grid {
        grid-template-columns: 1fr;
    }
    
    .member-stats {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
    
    .group-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .group-actions .btn {
        width: 100%;
    }
}

/* グループ作成成功モーダル */
.group-created-success {
    text-align: center;
    padding: 2rem;
    max-width: 500px;
    margin: 0 auto;
}

.group-created-success h3 {
    color: #28a745;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.group-created-success h3 i {
    margin-right: 0.5rem;
    font-size: 1.8rem;
}

.invite-code-section {
    background: #f8f9fa;
    border: 2px solid #28a745;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    max-width: 100%;
    overflow: hidden;
}

.invite-code-section h4 {
    color: #495057;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.invite-code-section h4 i {
    margin-right: 0.5rem;
    color: #28a745;
}

.invite-code-display {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
    width: 100%;
}

.invite-code-display .btn {
    white-space: nowrap;
    min-width: auto;
    flex-shrink: 0;
    align-self: center;
}

.invite-code-display input {
    flex: 1;
    min-width: 0;
    padding: 1rem;
    border: 2px solid #28a745;
    border-radius: 6px;
    background: white;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: bold;
    text-align: center;
    letter-spacing: 2px;
    color: #28a745;
    overflow: hidden;
    text-overflow: ellipsis;
}

.share-section {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #fff3cd;
    border-radius: 6px;
    border-left: 4px solid #ffc107;
}

.share-section h4 {
    color: #856404;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.share-section h4 i {
    margin-right: 0.5rem;
    color: #ffc107;
}

.share-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-line {
    background: #00c300;
    border: 1px solid #00c300;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-line:hover {
    background: #00a300;
    border-color: #00a300;
    transform: translateY(-1px);
}

.btn-line i {
    font-size: 1.2rem;
}

.invite-note {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1.5rem;
    color: #0c5460;
    font-size: 0.9rem;
}

.invite-note i {
    margin-right: 0.5rem;
    color: #17a2b8;
}

/* Line共有ボタンアイコン */
.btn-line i {
    color: white;
}

/* グループ役割バッジ */
.role-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-owner {
    background: #dc3545;
    color: white;
}

.role-admin {
    background: #fd7e14;
    color: white;
}

.role-member {
    background: #6c757d;
    color: white;
}

/* 削除ボタンのスタイル調整 */
.btn-danger {
    background: #dc3545;
    border-color: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
    border-color: #bd2130;
    transform: translateY(-1px);
}

.btn-warning {
    background: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
    border-color: #d39e00;
    transform: translateY(-1px);
}

/* 共有ボタンスタイル */
.btn-share {
    background: #17a2b8;
    border-color: #17a2b8;
    color: white;
}

.btn-share:hover {
    background: #138496;
    border-color: #117a8b;
    transform: translateY(-1px);
}

/* グループ一覧の縦並びボタン調整 */
.group-actions {
    min-width: 200px;
}

/* Lineボタンのサイズ統一 */
.btn-line.btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
}

/* LINE共有オプションモーダル */
.line-share-options {
    text-align: center;
    padding: 2rem;
    max-width: 500px;
    margin: 0 auto;
}

.line-share-options h3 {
    color: #00c300;
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.line-share-options p {
    color: #6c757d;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.share-option-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.btn-large {
    padding: 1rem 1.5rem;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.btn-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-large i {
    font-size: 1.5rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.btn-large div {
    flex: 1;
}

.btn-large strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.btn-large small {
    display: block;
    font-size: 0.85rem;
    opacity: 0.8;
    font-weight: normal;
}

/* 大きなボタンの色別スタイル */
.btn-line.btn-large {
    background: #00c300;
    border-color: #00c300;
    color: white;
}

.btn-line.btn-large:hover {
    background: #00a300;
    border-color: #00a300;
}

.btn-primary.btn-large {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.btn-primary.btn-large:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.btn-outline.btn-large {
    background: white;
    border-color: #6c757d;
    color: #6c757d;
}

.btn-outline.btn-large:hover {
    background: #6c757d;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    border-color: #6c757d;
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    border: 1px solid;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #5a6268;
    border-color: #545b62;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .group-created-success {
        padding: 1rem;
    }
    
    .invite-code-display {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .invite-code-display input {
        font-size: 1.1rem;
        letter-spacing: 2px;
    }
    
    .share-buttons {
        flex-direction: column;
    }
    
    .btn-line,
    .btn-outline {
        width: 100%;
        justify-content: center;
    }
}


.transaction-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.transaction-item:hover {
    background-color: #f8f9fa;
}

/* バルクシェアモーダル */
.bulk-share-modal {
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.bulk-share-modal h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.group-selection {
    text-align: left;
    margin: 1.5rem 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    background-color: #f8f9fa;
}

.group-option {
    display: flex;
    align-items: center;
    margin-bottom: 0.8rem;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.group-option:hover {
    background-color: #e9ecef;
}

.group-option:last-child {
    margin-bottom: 0;
}

.group-option input[type="radio"] {
    margin-right: 0.75rem;
    width: 1.2rem;
    height: 1.2rem;
    accent-color: #3498db;
}

.group-option label {
    cursor: pointer;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.group-option label strong {
    color: #2c3e50;
}

.group-option label small {
    color: #7f8c8d;
    font-size: 0.85rem;
}

.bulk-share-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.bulk-share-actions .btn {
    flex: 1;
    min-width: 120px;
}

/* 履歴コントロールのレスポンシブ対応 */
.history-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

#bulk-group-share-btn {
    order: -1; /* 一番左に表示 */
    font-weight: 500;
}

@media (max-width: 768px) {
    .history-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .history-controls .btn {
        width: 100%;
        justify-content: center;
    }
    
    .bulk-share-actions {
        flex-direction: column;
    }
    
    .group-selection {
        padding: 0.75rem;
    }
}

/* 自動グループ共有設定 */
.auto-share-setting {
    margin: 1.5rem 0;
    padding: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background-color: #f8f9fa;
}

.toggle-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 1rem;
}

.toggle-switch input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    background-color: #ccc;
    border-radius: 24px;
    transition: background-color 0.3s;
    margin-right: 0.75rem;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider {
    background-color: #3498db;
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-label {
    font-weight: 500;
    color: #2c3e50;
}

.auto-share-group {
    margin-top: 0.75rem;
    padding-left: 0.5rem;
}

.auto-share-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.auto-share-confirmation {
    text-align: center;
    max-width: 450px;
    margin: 0 auto;
}

.auto-share-confirmation h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.auto-share-hint {
    background-color: #e8f4fd;
    border: 1px solid #bee5eb;
    border-radius: 6px;
    padding: 0.75rem;
    margin: 1rem 0;
    font-size: 0.9rem;
    color: #0c5460;
}

.auto-share-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.auto-share-actions .btn {
    flex: 1;
    min-width: 140px;
}

/* 自動共有有効化確認ダイアログ */
.auto-share-enable-confirmation {
    text-align: center;
    max-width: 550px;
    margin: 0 auto;
}

.auto-share-enable-confirmation h3 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.confirmation-content {
    text-align: left;
    margin: 1.5rem 0;
}

.confirmation-content p {
    margin-bottom: 1rem;
    font-size: 1rem;
    line-height: 1.5;
}

.info-box {
    display: flex;
    gap: 0.75rem;
    background-color: #e8f4fd;
    border: 1px solid #bee5eb;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.info-box i {
    color: #0c5460;
    font-size: 1.2rem;
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.info-box div {
    flex: 1;
}

.info-box strong {
    color: #0c5460;
    display: block;
    margin-bottom: 0.5rem;
}

.info-box ul {
    margin: 0;
    padding-left: 1.2rem;
    color: #0c5460;
}

.info-box li {
    margin-bottom: 0.3rem;
    line-height: 1.4;
}

.confirmation-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.confirmation-actions .btn {
    flex: 1;
    min-width: 140px;
}

@media (max-width: 768px) {
    .auto-share-actions {
        flex-direction: column;
    }
    
    .toggle-switch {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .toggle-slider {
        margin-right: 0;
    }
}

/* グループダッシュボード内取引追加フォーム */
.group-add-transaction {
    margin: 2rem 0;
    border-top: 1px solid #eee;
    padding-top: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h4 {
    margin: 0;
    color: #2c3e50;
}

.group-form-container {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
    animation: slideIn 0.3s ease-out;
}

.compact-transaction-form .form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.compact-transaction-form .form-group {
    flex: 1;
    min-width: 0;
}

.compact-transaction-form .form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: #495057;
    font-size: 0.9rem;
}

.compact-transaction-form .form-group input,
.compact-transaction-form .form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.compact-transaction-form .form-group input:focus,
.compact-transaction-form .form-group select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
    outline: 0;
}

.compact-transaction-form .form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

.compact-transaction-form .form-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .section-header .btn {
        width: 100%;
        text-align: center;
    }
    
    .compact-transaction-form .form-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .compact-transaction-form .form-actions {
        flex-direction: column;
    }
    
    .group-form-container {
        padding: 1rem;
    }
}

/* 繰り返し設定スタイル */
.repeat-setting {
    margin: 1rem 0;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    border: 1px solid #e9ecef;
}

.repeat-options {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #ffffff;
    border-radius: 0.5rem;
    border: 1px solid #dee2e6;
}

.repeat-preview {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #e8f4fd;
    border-radius: 0.5rem;
    border: 1px solid #b3d9ff;
}

.repeat-preview h5 {
    margin: 0 0 1rem 0;
    color: #0066cc;
    font-size: 1rem;
}

.repeat-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.repeat-date-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background-color: #ffffff;
    border-radius: 0.375rem;
    border: 1px solid #dee2e6;
    font-size: 0.9rem;
}

.repeat-date-item.today {
    background-color: #fff3cd;
    border-color: #ffeaa7;
}

.repeat-date-item.future {
    background-color: #d1ecf1;
    border-color: #b8daff;
}

.date-number {
    background-color: #6c757d;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

.date-text {
    font-weight: 500;
}

.date-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-weight: bold;
}

.date-badge.today {
    background-color: #ffc107;
    color: #212529;
}

.date-badge.future {
    background-color: #17a2b8;
    color: white;
}

/* 確認ダイアログ追加スタイル */
.auto-share-enable-confirmation .info-box {
    margin: 1rem 0;
    padding: 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid;
    background-color: #f8f9fa;
    border-left-color: #17a2b8;
    background-color: #d1ecf1;
}

.info-box i {
    color: #0c5460;
    margin-right: 0.5rem;
}

.confirmation-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* ===== お問い合わせセクション（未認証ユーザー向け） ===== */
.contact-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 0;
    min-height: 100vh;
    display: none; /* デフォルトは非表示 */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
}

.contact-section.active {
    display: block;
}

.contact-section .container {
    padding: 1rem 20px;
}

.contact-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    max-width: 800px;
    margin: 80px auto 2rem auto; /* 上部にヘッダー分のマージンを追加 */
    overflow: hidden;
}

.contact-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.contact-header h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.contact-header i {
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

.contact-description {
    font-size: 1.1rem;
    opacity: 0.9;
    line-height: 1.6;
}

.contact-form {
    padding: 2rem;
}

.contact-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.contact-form .form-group {
    margin-bottom: 1.5rem;
}

.contact-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #495057;
}

.contact-form .required {
    color: #dc3545;
}

.contact-form input,
.contact-form select,
.contact-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.contact-form textarea {
    resize: vertical;
    min-height: 150px;
}

.contact-form .form-hint {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.5rem;
    display: block;
}

.contact-form .form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
}

/* 送信完了メッセージ */
.contact-success {
    padding: 3rem 2rem;
    text-align: center;
}

.contact-success .success-icon {
    font-size: 4rem;
    color: #28a745;
    margin-bottom: 1.5rem;
}

.contact-success h3 {
    font-size: 1.8rem;
    color: #495057;
    margin-bottom: 1rem;
}

.contact-success p {
    font-size: 1.1rem;
    color: #6c757d;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.contact-success .ticket-info {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    font-size: 1rem;
}

.contact-success .ticket-info strong {
    color: #495057;
}

.contact-success #contact-ticket-id {
    color: #007bff;
    font-weight: 600;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .contact-section {
        padding: 1rem;
    }
    
    .contact-header {
        padding: 1.5rem;
    }
    
    .contact-header h2 {
        font-size: 1.5rem;
    }
    
    .contact-form {
        padding: 1.5rem;
    }
    
    .contact-form .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .contact-form .form-actions {
        flex-direction: column;
    }
    
    .contact-success {
        padding: 2rem 1.5rem;
    }
}

/* ローディング状態 */
.contact-form.loading {
    pointer-events: none;
    opacity: 0.7;
}

.contact-form.loading button[type="submit"] {
    position: relative;
}

.contact-form.loading button[type="submit"]::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
}