/* リセット */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基本スタイル */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #e0e0e0;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    min-height: 100vh;
    padding: 20px;
}

/* コンテナ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* 送信フォーム用コンテナ（幅を狭く） */
.container.form-container {
    max-width: 900px;
}

/* ヘッダー */
header {
    background: linear-gradient(135deg, #1a252f 0%, #2c3e50 100%);
    color: #ecf0f1;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

header nav {
    margin-top: 15px;
}

header nav a {
    color: white;
    text-decoration: none;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    transition: background 0.3s;
}

header nav a:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* セクション */
.form-section,
.admin-section,
.info-section,
.result-section {
    padding: 30px;
}

.admin-section {
    border-top: 1px solid #e0e0e0;
}

.info-section {
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

h2 {
    font-size: 22px;
    margin-bottom: 20px;
    color: #000;
    border-bottom: 2px solid #000;
    padding-bottom: 10px;
}

/* フォーム */
.mail-form,
.admin-form {
    margin-top: 20px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #000;
}

.required {
    color: #e74c3c;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 14px;
    transition: all 0.3s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #34495e;
    box-shadow: 0 0 0 3px rgba(52, 73, 94, 0.1);
    transform: translateY(-1px);
}

textarea {
    resize: vertical;
    font-family: inherit;
}

.help-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #888;
}

/* ボタン */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(44, 62, 80, 0.5);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #e74c3c;
    color: white;
    padding: 8px 15px;
    font-size: 14px;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-status {
    padding: 5px 15px;
    font-size: 13px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
}

.btn-status.active {
    background: #27ae60;
    color: white;
}

.btn-status.inactive {
    background: #95a5a6;
    color: white;
}

.form-actions {
    margin-top: 30px;
    display: flex;
    gap: 10px;
}

/* テーブル */
.recipients-table,
.send-logs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.recipients-table th,
.recipients-table td,
.send-logs-table th,
.send-logs-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    color: #000;
}

.recipients-table th,
.send-logs-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #000;
}

.recipients-table tr:hover,
.send-logs-table tr:hover {
    background: #f8f9fa;
}

/* 送信履歴テーブル用のスタイル */
.send-logs-table {
    font-size: 13px;
}

.send-logs-table td {
    vertical-align: top;
}

.message-cell {
    max-width: 300px;
}

.message-preview {
    white-space: pre-wrap;
    word-break: break-word;
}

.message-full {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    white-space: pre-wrap;
    word-break: break-word;
}

details summary {
    cursor: pointer;
    color: #2c3e50;
    font-size: 12px;
    margin-top: 5px;
    user-select: none;
}

details summary:hover {
    color: #1a252f;
    text-decoration: underline;
}

/* 送信履歴セクションの強調 */
.send-history-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid #000;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.send-history-section h2 {
    color: #000;
    font-size: 24px;
    border-bottom: 3px solid #000;
}

/* 送信履歴テーブル用の新しいセル */
.ip-cell, .hostname-cell {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #000;
    font-weight: 600;
}

.user-agent-cell {
    max-width: 200px;
    font-size: 11px;
}

.user-agent-preview {
    color: #000;
    word-break: break-word;
}

.user-agent-full {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    word-break: break-word;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: #000;
}

/* アラート */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.alert h2 {
    margin-bottom: 10px;
    border: none;
    padding: 0;
    color: inherit;
}

/* その他 */
.no-data {
    padding: 20px;
    text-align: center;
    color: #000;
    background: #f8f9fa;
    border-radius: 5px;
}

.info-section ul {
    list-style-position: inside;
    color: #000;
}

.info-section ul li {
    margin-bottom: 8px;
    color: #000;
}

/* ドラッグ＆ドロップゾーン */
.file-drop-zone {
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background: linear-gradient(145deg, #fafafa, #ffffff);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.file-drop-zone:hover {
    border-color: #34495e;
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.file-drop-zone.drag-over {
    border-color: #2c3e50;
    background: linear-gradient(145deg, #e8f4f8, #f0f8ff);
    box-shadow: 0 0 20px rgba(44, 62, 80, 0.2);
    transform: scale(1.02);
}
/* カスタムバリデーションスタイル */
.input-error {
    border: 2px solid #e74c3c !important;
    background-color: #ffe6e6 !important;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.error-message {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.error-message.show {
    opacity: 1;
    transform: translateY(0);
}

.error-icon {
    font-size: 20px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.input-error:focus {
    outline: none;
    border-color: #c0392b !important;
    box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.2) !important;
}

/* 成功時のスタイル */
.input-success {
    border: 2px solid #27ae60 !important;
    background-color: #e8f8f0 !important;
}
.file-drop-zone.has-file {
    border-color: #27ae60;
    background: linear-gradient(145deg, #e8f8f0, #f0fff8);
}

.drop-zone-content {
    pointer-events: none;
}

.drop-zone-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.6;
}

.drop-zone-text {
    font-size: 16px;
    color: #555;
    margin: 0;
    line-height: 1.5;
}

.drop-zone-file-name {
    margin-top: 15px;
    font-size: 14px;
    color: #27ae60;
    font-weight: 600;
    word-break: break-all;
}

.file-drop-zone.has-file .drop-zone-icon {
    opacity: 0.3;
}

.file-drop-zone.has-file .drop-zone-text {
    opacity: 0.5;
    font-size: 14px;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .container {
        margin: 0;
        border-radius: 0;
    }
    
    header h1 {
        font-size: 22px;
    }
    
    .form-section,
    .admin-section,
    .result-section {
        padding: 20px;
    }
    
    .recipients-table,
    .send-logs-table {
        font-size: 14px;
    }
    
    .recipients-table th,
    .recipients-table td,
    .send-logs-table th,
    .send-logs-table td {
        padding: 8px;
    }
    
    .send-logs-table {
        font-size: 11px;
    }
    
    .message-cell {
        max-width: 200px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .search-grid {
        grid-template-columns: 1fr;
    }
}

/* 検索・フィルターフォーム */
.search-filter-form {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.search-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-actions .btn {
    flex: 0 0 auto;
}

/* 結果情報 */
.result-info {
    margin: 15px 0;
    padding: 10px 15px;
    background: #e8f4f8;
    border-left: 4px solid #2c3e50;
    border-radius: 4px;
}

.result-info p {
    margin: 0;
    color: #000;
    font-weight: 600;
}

.result-info strong {
    color: #2c3e50;
}

/* テーブルレスポンシブラッパー */
.table-responsive {
    overflow-x: auto;
    margin-top: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
}

.table-responsive::-webkit-scrollbar {
    height: 10px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ダウンロードリンク */
.download-link {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
    display: inline-block;
}

.download-link:hover {
    color: #1a252f;
    text-decoration: underline;
}

/* ページネーション */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 20px;
    padding: 20px 0;
    flex-wrap: wrap;
}

.page-link {
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    color: #2c3e50;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

.page-link:hover {
    background: #f8f9fa;
    border-color: #2c3e50;
}

.page-link.current {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
    cursor: default;}

/* 一括削除フォーム */
.bulk-delete-form {
    margin-bottom: 20px;
}

.bulk-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 5px;
}

.bulk-actions .btn {
    flex: 0 0 auto;
}

/* 小さい削除ボタン */
.btn-small {
    padding: 5px 10px;
    font-size: 14px;
    min-width: auto;
}

/* チェックボックスのスタイル */
input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

input[type="checkbox"]:hover {
    transform: scale(1.1);
}