@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

a {
    text-decoration: none !important;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: #E8F0FE;
    color: #333;
    line-height: 1.6;
    font-size: 14px;
}

header {
    background-color: #FFFFFF;
    padding: 15px 20px;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

header .logo {
    font-size: 24px;
    font-weight: 700;
    color: #00BCD4;
    display: flex;
    align-items: center;
}

header .logo .logo-icon {
    width: 1em;
    height: auto;
    margin-right: 8px;
}

.sidebar {
    width: 200px;
    background-color: #FFFFFF;
    position: fixed;
    top: 0;
    height: 100%;
    padding-top: 60px;
    padding-bottom: 20px;
    overflow-y: auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: flex-start;
    padding-top: 20px;
}

.sidebar h2 {
    font-size: 16px;
    padding: 10px 15px;
    color: #00BCD4;
}

.sidebar ul {
    list-style: none;
}

.sidebar ul li {
    margin: 2px 0;
}

.sidebar ul li a {
    display: block;
    padding: 8px 15px;
    color: #333;
    font-size: 14px;
    transition: background-color 0.3s;
}

.sidebar ul li a:hover {
    background-color: #F0F0F0;
}

.sidebar ul li a.active {
    background-color: #00BCD4;
    color: white;
}

.sidebar .logout-btn {
    display: block;
    padding: 8px 15px;
    color: #333;
    text-decoration: none !important;
    font-size: 14px;
    transition: background-color 0.3s;
}

.sidebar .logout-btn:hover {
    background-color: #F0F0F0;
    text-decoration: none !important;
}

.main-content {
    margin-left: 200px;
    padding: 80px 20px 20px;
    width: calc(100% - 200px);
    min-height: 100vh;
    background-color: #F9FAFB;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.main-content h1 {
    color: #00BCD4;
    font-size: 24px;
    font-weight: 700;
    margin-top: 12px;
    margin-bottom: 20px;
    text-align: left;
}

.main-content h2 {
    font-size: 18px;
    font-weight: 500;
    color: #00BCD4;
    margin-top: 20px;
    margin-bottom: 10px;
}

/* テーブル全体のスタイル */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: #FFFFFF;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* テーブルヘッダーとセルのスタイル */
th, td {
    padding: 10px 15px;
    text-align: left;
    border: 1px solid #E0E0E0;
    font-size: 14px;
}

/* ハイライトマーカー */
.highlight {
    background-color: #FFF176;
    padding: 2px 4px;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    color: #333;
    font-weight: 500;
    display: inline;
}

th {
    background-color: #00BCD4;
    color: #FFFFFF;
    font-weight: 500;
}

tr:hover {
    background-color: #F9F9F9;
}

td a.btn {
    width: 100px; /* 横幅を統一 */
    height: 36px; /* 高さを統一 */
    display: inline-flex; /* Flexboxを使用して中央揃え */
    justify-content: center; /* 横中央 */
    align-items: center; /* 縦中央 */
    background-color: #00C4B4;
    color: white;
    font-size: 14px;
    border-radius: 10px;
    transition: background-color 0.3s;
}

td a.btn:hover {
    background-color: #00A799;
    border-radius: 10px;
}

td a.btn.edit-btn {
    background-color: #2196F3;
}

td a.btn.edit-btn:hover {
    background-color: #1976D2;
}

td a.btn.scrape-btn {
    background-color: #4CAF50;
}

td a.btn.scrape-btn:hover {
    background-color: #45a049;
}

td a.title-link {
    color: #00BCD4;
}

td a.title-link:hover {
    text-decoration: underline !important;
}

td a:not(.btn):not(.title-link) {
    color: #2196F3;
}

td a:not(.btn):not(.title-link):hover {
    text-decoration: underline !important;
}

.form-group {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #E0E0E0;
}

.form-group:last-child {
    border-bottom: none;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group select {
    width: 100%;
    max-width: 300px;
    padding: 8px;
    border: 1px solid #E0E0E0;
    border-radius: 5px;
    font-size: 14px;
    outline: none;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus,
.form-group input[type="date"]:focus,
.form-group select:focus {
    border-color: #00BCD4;
    box-shadow: 0 0 5px rgba(0, 188, 212, 0.3);
}

.form-group .btn, .form-group .delete-btn, .form-group .cancel-btn {
    margin-right: 10px;
}

.btn, .export-btn, .delete-btn, .cancel-btn, .reset-btn, .import-btn {
    width: 100px; /* 横幅を統一 */
    height: 36px; /* 高さを統一 */
    display: inline-flex; /* Flexboxを使用して中央揃え */
    justify-content: center; /* 横中央 */
    align-items: center; /* 縦中央 */
    background-color: #00C4B4;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    border-radius: 5px;
    transition: background-color 0.3s;
    text-decoration: none; /* <a>要素の下線を削除 */
}

.btn:hover, .export-btn:hover, .delete-btn:hover, .cancel-btn:hover, .reset-btn:hover, .import-btn:hover {
    background-color: #00A799;
}

.delete-btn, .cancel-btn, .reset-btn {
    background-color: #f44336;
}

.delete-btn:hover, .cancel-btn:hover, .reset-btn:hover {
    background-color: #d32f2f;
}

.export-btn {
    background-color: #00BCD4;
}

.export-btn:hover {
    background-color: #00A4B8;
}

.import-btn {
    background-color: #2196F3;
}

.import-btn:hover {
    background-color: #1976D2;
}

.error {
    color: #f44336;
    margin-bottom: 15px;
    background-color: #ffebee;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
}

.success {
    color: #4CAF50;
    margin-bottom: 15px;
    background-color: #e8f5e9;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
}

.info {
    color: #2196F3;
    margin-bottom: 15px;
    background-color: #e3f2fd;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
}

.search-form {
    margin-bottom: 20px;
}

.search-form input[type="text"] {
    padding: 8px;
    font-size: 14px;
    border: 1px solid #E0E0E0;
    border-radius: 5px;
    margin-right: 10px;
    width: 400px;
}

.search-form input[type="submit"],
.search-form a.btn.reset-btn {
    width: 100px; /* 横幅を統一 */
    height: 36px; /* 高さを統一 */
    font-size: 14px;
    border-radius: 5px;
    display: inline-flex; /* Flexboxを使用して中央揃え */
    justify-content: center; /* 横中央 */
    align-items: center; /* 縦中央 */
    transition: background-color 0.3s;
    border: 1px solid transparent; /* ボーダーを統一 */
    box-sizing: border-box; /* ボックスモデルを統一 */
    vertical-align: middle; /* 縦位置を揃える */
    text-decoration: none; /* リセットボタンの下線を削除 */
}

.search-form input[type="submit"] {
    -webkit-appearance: none; /* ブラウザのデフォルトスタイルをリセット */
    -moz-appearance: none;
    appearance: none;
    background-color: #00C4B4;
    color: white;
    border: 1px solid #00C4B4; /* ボーダーを明示 */
    cursor: pointer;
}

.search-form input[type="submit"]:hover {
    background-color: #00A799;
    border-color: #00A799;
}

.search-form a.btn.reset-btn {
    background-color: #f44336;
    color: white;
    border: 1px solid #f44336; /* ボーダーを明示 */
    margin-right: 10px;
}

.search-form a.btn.reset-btn:hover {
    background-color: #d32f2f;
    border-color: #d32f2f;
}

/* データ件数とボタンのヘッダー */
.data-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    width: 100%;
}

/* データ件数の表示 */
.data-count {
    font-size: 14px;
    color: #666;
}

/* ページネーション */
.pagination {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
}

.pagination a, .pagination span {
    display: inline-block;
    padding: 6px 12px;
    margin: 0 2px;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.pagination a {
    background-color: #00C4B4;
    color: white;
}

.pagination a:hover {
    background-color: #00A799;
}

.pagination .current {
    background-color: #00BCD4;
    color: white;
    font-weight: 500;
}

.pagination .disabled {
    color: #999;
    cursor: not-allowed;
}

.pagination span:not(.current):not(.disabled) {
    color: #333;
}

/* 記事詳細ページのスタイル */
.article-detail {
    margin-top: 20px;
    background-color: #FFFFFF;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.article-detail p {
    margin: 10px 0;
}

.article-detail strong {
    display: inline-block;
    width: 120px;
    font-weight: 500;
}

.article-detail .content {
    white-space: pre-wrap;
    background-color: #F9F9F9;
    padding: 15px;
    border: 1px solid #E0E0E0;
    border-radius: 5px;
    margin-top: 5px;
}

/* コードブロック（pre）のスタイル */
pre {
    background-color: #f0f0f0;
    padding: 10px;
    border-radius: 5px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
}

.all-scrape-btn {
    width: 100px;
    height: 36px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background-color: #f44336;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    border-radius: 5px;
    transition: background-color 0.3s;
    margin-left: 10px; /* CSV入力ボタンとの間隔 */
}

.all-scrape-btn:hover {
    background-color: #d32f2f;
}

.all-scrape-btn.loading {
    position: relative;
    opacity: 0.8;
    pointer-events: none;
}

.all-scrape-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    border: 2px solid #FFFFFF;
    border-top: 2px solid #00BCD4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.search-form {
  margin-bottom: 20px;
}

.search-form input[type="text"] {
  padding: 8px;
  font-size: 14px;
  border: 1px solid #E0E0E0;
  border-radius: 5px;
  margin-right: 10px;
  width: 400px;
}

.search-form input[type="submit"],
.search-form a.btn.reset-btn {
  width: 100px;           /* 横幅を統一 */
  height: 36px;           /* 高さを統一 */
  font-size: 14px;
  border-radius: 5px;
  display: inline-flex;   /* Flexboxを使用して中央揃え */
  justify-content: center;/* 横中央 */
  align-items: center;    /* 縦中央 */
  transition: background-color 0.3s;
  border: 1px solid transparent; /* ボーダーを統一 */
  box-sizing: border-box; /* ボックスモデルを統一 */
  vertical-align: middle; /* 縦位置を揃える */
  text-decoration: none;  /* リセットボタンの下線を削除 */
}

.search-form input[type="submit"] {
  -webkit-appearance: none; /* ブラウザのデフォルトスタイルをリセット */
  -moz-appearance: none;
  appearance: none;
  background-color: #00C4B4;
  color: white;
  border: 1px solid #00C4B4; /* ボーダーを明示 */
  cursor: pointer;
}

.search-form input[type="submit"]:hover {
  background-color: #00A799;
  border-color: #00A799;
}

.search-form a.btn.reset-btn {
  background-color: #f44336;
  color: white;
  border: 1px solid #f44336; /* ボーダーを明示 */
  margin-right: 10px;
}

.search-form a.btn.reset-btn:hover {
  background-color: #d32f2f;
  border-color: #d32f2f;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 5px;
}

.search-field label {
  font-weight: bold;
  white-space: nowrap;
}

.search-field input[type="text"],
.search-field input[type="date"],
.search-actions input[type="submit"],
.search-actions .btn {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  height: 36px; /* 縦幅を統一 */
  box-sizing: border-box;
}

.search-field input[type="text"] {
  width: 400px; /* 検索ボックスの幅を400pxに変更 */
}

.search-field input[type="date"] {
  width: 150px; /* 日付入力欄の幅を調整 */
}

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

.search-actions .btn {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  background-color: #dc3545; /* リセットボタンの色 */
  color: white;
  transition: background-color 0.3s;
}

.search-actions input[type="submit"] {
  background-color: #17a2b8; /* ユーザー一覧と同じ青色 */
  color: white;
  cursor: pointer;
  transition: background-color 0.3s;
}

.search-actions input[type="submit"]:hover {
  background-color: #138496; /* ホバー時の濃い青色 */
}

.search-actions .btn:hover {
  background-color: #c82333;
}

/* スクレイピング結果のカードスタイル */
.scrape-result-card {
    background-color: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 20px;
}

.scrape-result-header {
    margin-bottom: 20px;
    border-bottom: 2px solid #00BCD4;
    padding-bottom: 10px;
}

.scrape-result-header h2 {
    font-size: 20px;
    font-weight: 500;
    color: #00BCD4;
    margin: 0;
}

.scrape-result-header h2 a {
    color: #2196F3;
}

.scrape-result-header h2 a:hover {
    text-decoration: underline !important;
}

.scrape-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat-item {
    background-color: #F0F9FF;
    padding: 10px 15px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-item.inserted {
    border-left: 4px solid #4CAF50;
}

.stat-item.skipped {
    border-left: 4px solid #FFC107;
}

.stat-item.failed {
    border-left: 4px solid #f44336;
}

.stat-label {
    font-weight: 500;
    color: #333;
}

.stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #333;
}

.url-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #FFFFFF;
    margin-bottom: 20px;
}

.url-table th,
.url-table td {
    padding: 10px 15px;
    border: 1px solid #E0E0E0;
    font-size: 14px;
    text-align: left;
}

.url-table th {
    background-color: #F0F9FF;
    color: #333;
    font-weight: 500;
}

.url-table td {
    background-color: #FFFFFF;
    color: #333;
}

.url-table tr:nth-child(even) {
    background-color: #F9F9F9;
}

.url-table tr:hover {
    background-color: #F1F1F1;
}

.url-table td a {
    color: #2196F3;
}

.url-table td a:hover {
    text-decoration: underline !important;
}

.action-buttons {
    margin-top: 20px;
    text-align: right;
}

.action-buttons .btn {
    background-color: #00C4B4;
    color: white;
    padding: 8px 16px;
    border-radius: 5px;
    text-decoration: none;
    transition: background-color 0.3s;
}

.action-buttons .btn:hover {
    background-color: #00A799;
}

#media_name {
    width: 200px;
}

/* データ件数とカウントアイテムのスタイル */
.data-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.data-count {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.count-item {
    background-color: #FFFFFF;
    padding: 8px 12px 8px 20px; /* 左側に余白を追加 */
    border-radius: 5px;
    font-size: 14px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: inline-block; /* 幅を自然に調整 */
    text-align: left; /* 左寄せ */
    white-space: nowrap; /* 改行を防ぐ */
}

.count-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.total-count {
    color: #666;
    border-left: 3px solid #00BCD4;
}

.inserted-count {
    color: #4CAF50;
    border-left: 3px solid #4CAF50;
}

.skipped-count {
    color: #FFC107;
    border-left: 3px solid #FFC107;
}

.failed-count {
    color: #f44336;
    border-left: 3px solid #f44336;
}

.media-count {
    color: #666;
    border-left: 3px solid #00BCD4;
}

.back-button {
    margin-top: 20px;
    text-align: left;
}

.back-btn {
    background-color: #666;
    color: #fff;
}

.back-btn:hover {
    background-color: #555;
}

.expired {
    background-color: #ffe4cc;
}

/* サブメニューのスタイル */
.sidebar ul.submenu {
    list-style: none;
    padding-left: 20px; /* インデント */
}

.sidebar ul.submenu li {
    margin: 2px 0;
}

.sidebar ul.submenu li a {
    display: block;
    padding: 6px 15px; /* サブメニューは少し小さめに */
    color: #333;
    font-size: 13px; /* フォントサイズを少し小さく */
    transition: background-color 0.3s;
}

.sidebar ul.submenu li a:hover {
    background-color: #F0F0F0;
}

.sidebar ul.submenu li a.active {
    background-color: #00BCD4;
    color: white;
}

/* 親メニューのスタイル */
.sidebar ul li a.parent-menu {
    display: block;
    padding: 8px 15px;
    color: #333;
    font-size: 14px;
    font-weight: 500; /* 親メニューを少し太字に */
    transition: background-color 0.3s;
}

.sidebar ul li a.parent-menu:hover {
    background-color: #F0F0F0;
}

/* 検索ボックスとボタンを一体化 */
.search-field.integrated {
    position: relative;
    display: inline-block;
}

.search-field.integrated input[type="text"] {
    padding-right: 50px; /* ボタンの幅分を確保 */
    width: 200px; /* メディア名検索ボックスの幅 */
}

.search-field.integrated .toggle-search-mode {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 40px; /* ボタンの幅を広げる */
    padding: 0 8px; /* 文字の左右に余白を追加 */
    border: 1px solid #ccc; /* 検索ボックスの枠線色に合わせる */
    background-color: #fff; /* 検索ボックスと同じ背景色 */
    color: #333;
    font-size: 12px;
    cursor: pointer;
    border-radius: 0 4px 4px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.search-field.integrated .toggle-search-mode:hover {
    background-color: #f5f5f5; /* ホバー時に薄いグレー */
}

/* 選択中のフィルタのスタイル */
.filter-active {
    color: #66b0ff !important; /* 淡い青（フォーカス中の色と同じ）、優先順位を強化 */
}

.lock-warning-message {
    margin-top: 10px;
    padding: 10px;
    color: #d32f2f; /* 警告色（既存の.warningと同じ） */
    font-size: 14px;
    font-weight: normal;
    background-color: #ffe6e6; /* 背景色（既存の.warningと同じ） */
    border-radius: 4px;
}

.free-trial-banner {
    background: linear-gradient(90deg, #ffca28, #ffd54f);
    color: #333;
    padding: 10px 20px;
    border-radius: 25px;
    margin-bottom: 20px;
    font-size: 25px;
    font-weight: bold;
    display: inline-block;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@media (max-width: 768px) {
    .free-trial-banner {
        font-size: 16px;
        padding: 8px 15px;
    }
}

.free-trial-badge {
    background-color: #ffca28;
    color: #333;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: bold;
    margin-right: 10px;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.free-trial-badge:hover {
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .free-trial-badge {
        font-size: 12px;
        padding: 4px 10px;
    }
}