/**
 * メールアドレス編集画面のスタイル
 * 
 * 提供先メールアドレスの管理画面のスタイル定義
 * メールアドレスの追加、編集、削除、通知タイプの設定機能を含む
 */

/* ========================================
   ツールバー
   メールアドレス数の表示と操作ボタン
   ======================================== */

.email-address-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.email-address-status {
    font-size: 0.9rem;
    font-weight: 500;
    color: #495057;
    line-height: 1.4;
}

.email-address-buttons {
    display: flex;
    gap: 10px;
}

.email-address-buttons .btn {
    padding: 8px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.3s ease;
    min-width: 80px;
}

/* ========================================
   メインコンテナ
   ======================================== */

.email-address-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 20px 20px;
}

/* ========================================
   ヘッダーセクション
   画面タイトルと説明、アクションボタン
   ======================================== */

.address-header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.address-header h2 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 24px;
}

.address-header p {
    margin: 0 0 20px 0;
    color: #6c757d;
    font-size: 14px;
}

.address-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ========================================
   アドレスリストコンテナ
   検索フィルターとアドレス一覧を含むメインコンテナ
   ======================================== */

.address-list-container {
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ========================================
   検索・フィルター機能
   キーワード検索と通知タイプフィルター
   ======================================== */

.address-search {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.address-search input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 15px;
}

.address-filters {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.address-filters label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: #495057;
}

.address-filters select {
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

/* ========================================
   アドレス一覧表示
   スクロール可能なアドレスリスト
   ======================================== */

.address-list {
    max-height: 600px;
    overflow-y: auto;
}

.address-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.address-item:hover {
    background-color: #f8f9fa;
}

.address-item:last-child {
    border-bottom: none;
}

/* 非アクティブなアドレス項目 */
.address-item.inactive {
    opacity: 0.6;
}

.address-info {
    flex: 1;
}

.address-email {
    font-weight: 600;
    color: #495057;
    font-size: 16px;
    margin-bottom: 4px;
}

.address-name {
    color: #007cba;
    font-size: 14px;
    margin-bottom: 2px;
}

.address-org {
    color: #6c757d;
    font-size: 12px;
    margin-bottom: 4px;
}

.address-notifications {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

/* ========================================
   通知タイプバッジ
   開始通知、終了通知、変更通知の表示
   ======================================== */

.notification-badge {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

/* 開始通知バッジ（緑系） */
.notification-badge.start {
    background: #d4edda;
    color: #155724;
}

/* 終了通知バッジ（赤系） */
.notification-badge.end {
    background: #f8d7da;
    color: #721c24;
}

/* 変更通知バッジ（黄色系） */
.notification-badge.change {
    background: #fff3cd;
    color: #856404;
}

.address-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ========================================
   ステータスインジケーター
   アクティブ/非アクティブの状態表示
   ======================================== */

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* アクティブ状態（緑） */
.status-indicator.active {
    background: #28a745;
}

/* 非アクティブ状態（赤） */
.status-indicator.inactive {
    background: #dc3545;
}

/* ========================================
   アクションボタン
   編集、削除などの操作ボタン
   ======================================== */

.address-actions-btn {
    display: flex;
    gap: 5px;
}

.action-icon-btn {
    background: none;
    border: none;
    padding: 5px;
    border-radius: 3px;
    cursor: pointer;
    color: #6c757d;
    transition: all 0.2s ease;
}

.action-icon-btn:hover {
    background: #e9ecef;
    color: #495057;
}

/* 編集ボタン */
.action-icon-btn.edit {
    background: #007cba;
    color: white;
    font-size: 12px;
    padding: 4px 8px;
    min-width: 40px;
}

.action-icon-btn.edit:hover {
    background: #0056b3;
}

/* 削除ボタン */
.action-icon-btn.delete {
    background: #dc3545;
    color: white;
    font-size: 12px;
    padding: 4px 8px;
    min-width: 40px;
}

.action-icon-btn.delete:hover {
    background: #c82333;
}

/* ========================================
   モーダルダイアログ
   アドレス追加・編集のモーダルウィンドウ
   ======================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.15s ease-out;
}

.modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h3 {
    margin: 0;
    color: #495057;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f8f9fa;
    color: #495057;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 20px;
    border-top: 1px solid #e9ecef;
}

/* ========================================
   フォームグループ
   入力フィールドとラベルのグループ
   ======================================== */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
    font-size: 14px;
}

/* 必須項目マーク */
.required {
    color: #dc3545;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* フォーカス状態 */
.form-control:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

/* ========================================
   通知タイプ選択
   開始通知、終了通知、変更通知のチェックボックス
   ======================================== */

.notification-types {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.notification-types label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    margin-bottom: 0;
    cursor: pointer;
    padding: 4px 0;
}

.notification-types input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.notification-types label span {
    line-height: 1.4;
    vertical-align: middle;
}

/* アクティブチェックボックスのスタイル改善 */
.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
    font-size: 14px;
    cursor: pointer;
}

.form-group label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

/* ========================================
   ボタンスタイル
   各種操作ボタンの共通スタイルとバリエーション
   ======================================== */

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #007cba;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* ========================================
   空の状態表示
   アドレスが存在しない場合のメッセージ表示
   ======================================== */

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-message {
    font-size: 16px;
    margin-bottom: 8px;
}

.empty-state-description {
    font-size: 14px;
    opacity: 0.8;
}

/* ========================================
   ローディング状態
   データ読み込み中のスピナー表示
   ======================================== */

.loading-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

/* スピナーの回転アニメーション */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   レスポンシブ対応
   タブレット・スマートフォン向けのレイアウト調整
   ======================================== */

/* タブレット向け（768px以下） */
@media (max-width: 768px) {
    .email-address-container {
        padding: 10px;
    }
    
    .address-header {
        padding: 15px;
    }
    
    .address-actions {
        flex-direction: column;
    }
    
    .address-filters {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .address-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .address-status {
        align-self: flex-end;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .notification-types {
        flex-direction: column;
        gap: 8px;
    }
    
    .notification-types label {
        padding: 6px 0;
        font-size: 14px;
    }
    
    .form-group label {
        flex-direction: row;
        align-items: center;
        gap: 6px;
    }
}

/* ========================================
   アニメーション
   アドレス項目のフェードイン効果
   ======================================== */

.address-item {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   フォーカス状態の改善
   アクセシビリティ向上のためのフォーカス表示
   ======================================== */

.form-control:focus,
.btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* ========================================
   エラー状態
   入力エラー時の表示
   ======================================== */

.form-control.error {
    border-color: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
}

.error-message {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
}

/* ========================================
   チェックボックスの配置改善
   ブラウザ標準のチェックボックス表示
   ======================================== */

input[type="checkbox"] {
    appearance: checkbox;
    -webkit-appearance: checkbox;
    -moz-appearance: checkbox;
    width: 16px;
    height: 16px;
    margin: 0;
    vertical-align: middle;
}

/* 通知タイプセクションの改善 */
.notification-types label {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-weight: normal !important;
    margin-bottom: 8px !important;
    cursor: pointer;
    padding: 2px 0;
    line-height: 1.5;
}

.notification-types input[type="checkbox"] {
    flex-shrink: 0;
    margin-right: 0 !important;
}

/* アクティブチェックボックスの改善 */
.form-group > label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
    font-size: 14px;
}

.form-group > label input[type="checkbox"] {
    margin-right: 8px;
    vertical-align: middle;
}

/* ========================================
   警告・情報ボタンのスタイル
   ======================================== */

/* 警告ボタン */
.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
    color: #212529;
}

/* 情報ボタン */
.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
    color: white;
}

/* ========================================
   ヘッダーボタンのレスポンシブ対応
   スマートフォンでの配置調整
   ======================================== */

/* スマートフォン向け（768px以下） */
@media (max-width: 768px) {
    /* スマホでのヘッダーボタン配置調整 */
    .email-address-header-buttons {
        position: absolute;
        top: 15px;
        right: 15px;
        z-index: 100;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .email-address-header-buttons .btn {
        padding: 6px 12px;
        font-size: 0.8rem;
        border-radius: 5px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        font-weight: 500;
        min-width: 70px;
        max-width: 80px;
        white-space: nowrap;
    }
    
    .email-address-container {
        margin-top: 70px;
        padding: 15px;
    }
}

/* 小さいスマートフォン向け（480px以下） */
@media (max-width: 480px) {
    /* 小さいスマホでのヘッダーボタン配置調整 */
    .email-address-header-buttons {
        position: absolute;
        top: 12px;
        right: 10px;
        z-index: 100;
        display: flex;
        flex-direction: column;
        gap: 5px;
        align-items: flex-end;
    }
    
    .email-address-header-buttons .btn {
        padding: 5px 8px;
        font-size: 0.75rem;
        min-width: 60px;
        max-width: 70px;
        border-radius: 4px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    }
    
    .email-address-container {
        margin-top: 80px;
        padding: 10px;
    }
}

/* ========================================
   ヘッダーボタンのホバー・アクティブ効果
   ======================================== */

.email-address-header-buttons .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.email-address-header-buttons .btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ========================================
   タッチデバイス対応
   スマートフォン・タブレットでのタッチ操作最適化
   ======================================== */

@media (hover: none) and (pointer: coarse) {
    .email-address-header-buttons .btn:hover {
        transform: none;
    }
    
    .email-address-header-buttons .btn:active {
        transform: scale(0.98);
    }
    
    .email-address-header-buttons .btn-primary:active {
        background: #0056b3;
    }
    
    .email-address-header-buttons .btn-secondary:active {
        background: #5a6268;
    }
}

/* ========================================
   ツールバーのレスポンシブ対応
   スマートフォンでの縦並び表示
   ======================================== */

/* スマートフォン向け（768px以下） */
@media (max-width: 768px) {
    .email-address-toolbar {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
        padding: 15px;
    }
    
    .email-address-status {
        text-align: center;
        font-size: 0.85rem;
    }
    
    .email-address-buttons {
        justify-content: center;
    }
    
    .email-address-buttons .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
        min-width: 100px;
    }
}

@media (max-width: 480px) {
    .email-address-toolbar {
        padding: 12px;
        gap: 12px;
    }
    
    .email-address-status {
        font-size: 0.8rem;
    }
    
    .email-address-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .email-address-buttons .btn {
        padding: 8px 16px;
        font-size: 0.85rem;
        min-width: auto;
        width: 100%;
    }
}