/* admin/css/admin_style.css */

:root {
    --wp-admin-bg: #f0f3f5;
    --wp-menu-bg: #1d2327;
    --wp-menu-hover: #101416;
    --wp-menu-active: #2271b1;
    --wp-text-main: #3c434a;
    --wp-text-light: #fff;
    --wp-border: #c3c4c7;
    --wp-accent: #2271b1;
    --wp-accent-hover: #135e96;
    --wp-danger: #b32d2e;
    --wp-danger-hover: #dc3232;
    --wp-notice-success: #46b450;
    --wp-notice-warning: #dba617;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: var(--wp-admin-bg);
    color: var(--wp-text-main);
    font-size: 13px;
    line-height: 1.5;
}

/* ==========================================================================
   Admin レイアウト（ヘッダー・サイドバー・フッター共通構造）
   ========================================================================== */
.wp-admin-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}

.wp-admin-header-bar {
    width: 100%;
    background: #101416;
    color: var(--wp-text-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 50px;
    border-bottom: 1px solid #2c3338;
    z-index: 10000;
}

.brand-area {
    display: flex;
    align-items: center;
    height: 100%;
}

.brand-area > a {
    display: flex;
    align-items: center;
    height: 100%;
}

.admin-logo {
    height: 30px;
    width: auto;
    display: block;
}

.wp-admin-header-bar .brand-title {
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 0.5px;
    margin-left: 10px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: 30px;
    height: 100%;
}

.header-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
}

.dropdown-toggle {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    padding: 0 8px;
    height: 100%;
    display: flex;
    align-items: center;
}

.dropdown-toggle:hover {
    color: #72aee6;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #101416;
    border: 1px solid #2c3338;
    list-style: none;
    padding: 5px 0;
    width: 150px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    z-index: 9999;
}

.header-dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu li a {
    display: block;
    padding: 8px 15px;
    color: #c3c4c7;
    text-decoration: none;
    font-size: 13px;
}

.dropdown-menu li a:hover {
    background: #2c3338;
    color: #fff;
}

.site-preview-btn {
    display: flex;
    align-items: center;
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    height: 100%;
}

.site-preview-btn:hover {
    color: #72aee6;
}

.wp-admin-header-bar .user-info {
    font-size: 13px;
    color: #c3c4c7;
}

.wp-admin-body-container {
    display: flex;
    flex: 1;
    width: 100%;
}

.wp-sidebar {
    width: 160px;
    min-width: 160px;
    background: var(--wp-menu-bg);
    color: var(--wp-text-light);
    display: flex;
    flex-direction: column;
    z-index: 9999;
}

.wp-sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.wp-sidebar-menu li {
    position: relative;
}

.wp-sidebar-menu li a {
    display: block;
    padding: 12px 15px;
    color: #c3c4c7;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.1s ease-in-out;
    border-left: 4px solid transparent;
}

.wp-sidebar-menu li a:hover {
    background: var(--wp-menu-hover);
    color: #00a0d2;
}

.wp-sidebar-menu li a.active {
    background: var(--wp-menu-active);
    color: var(--wp-text-light);
    border-left-color: #72aee6;
}

/* サイドバー・アコーディオン */
.wp-sidebar-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #2c3338;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.has-submenu.open .wp-sidebar-submenu {
    max-height: 300px;
    transition: max-height 0.3s ease-in;
}

.wp-sidebar-submenu li a {
    padding: 8px 15px 8px 25px;
    font-size: 13px;
    color: #c3c4c7;
    border-left: none;
}

.wp-sidebar-submenu li a:hover {
    background: #1d2327;
    color: #00a0d2;
}

.wp-sidebar-submenu li a.active {
    color: #fff;
    font-weight: 600;
    background: var(--wp-menu-active);
}

.wp-sidebar-menu .menu-separator {
    height: 1px;
    background: #2c3338;
    margin: 10px 0;
}

.wp-main-content {
    flex: 1;
    padding: 20px 30px 40px 30px;
    background: var(--wp-admin-bg);
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.wp-content-title-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dcdcde;
}

.wp-content-title-area h2 {
    font-size: 23px;
    font-weight: 400;
    color: #1d2327;
}

.dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.settings-card {
    background: #fff;
    border: 1px solid var(--wp-border);
    padding: 20px;
    border-radius: 4px;
}

.settings-card h3 {
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f1;
}

.settings-card ul {
    list-style: none;
    padding: 0;
    font-size: 14px;
    line-height: 2;
}

.welcome-panel {
    background: #fff;
    border: 1px solid var(--wp-border);
    padding: 23px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.welcome-panel h3 {
    font-size: 21px;
    font-weight: 400;
    margin-bottom: 10px;
}

.wp-admin-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #dcdcde;
    font-size: 12px;
    color: #646970;
    display: flex;
    justify-content: space-between;
}

/* ==========================================================================
   共通UIコンポーネント（ボタン・テーブル・バッジ等）
   ========================================================================== */
input[type="text"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--wp-border);
    border-radius: 4px;
    background: #fff;
    font-size: 13px;
    color: var(--wp-text-main);
    font-family: inherit;
    transition: border-color 0.1s ease-in-out;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    border-color: var(--wp-accent);
    outline: none;
    box-shadow: 0 0 0 1px var(--wp-accent);
}

.button {
    display: inline-block;
    text-decoration: none;
    padding: 6px 14px;
    font-size: 13px;
    line-height: 1.5;
    border-radius: 3px;
    border: 1px solid;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.1s ease-in-out;
    text-align: center;
}

.button-primary {
    background: var(--wp-accent);
    border-color: var(--wp-accent);
    color: #fff;
}

.button-primary:hover {
    background: var(--wp-accent-hover);
    border-color: var(--wp-accent-hover);
}

.button-secondary {
    background: #f6f7f7;
    border-color: #3c434a;
    color: #3c434a;
}

.button-secondary:hover {
    background: #f0f0f1;
    border-color: #1d2327;
    color: #1d2327;
}

.button-link-delete {
    background: none;
    border: none;
    color: var(--wp-danger);
    cursor: pointer;
    text-decoration: underline;
    font-size: 13px;
    padding: 0;
    font-family: inherit;
}

.button-link-delete:hover {
    color: var(--wp-danger-hover);
}

.wp-list-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 1px 1px rgba(0,0,0,0.05);
    border: 1px solid var(--wp-border);
    margin-top: 10px;
    margin-bottom: 20px;
}

.wp-list-table th,
.wp-list-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #f0f0f1;
    vertical-align: middle;
}

.wp-list-table th {
    background: #fafafa;
    font-weight: 600;
    color: #1d2327;
    border-bottom: 2px solid #dcdcde;
}

.wp-list-table tbody tr:hover {
    background: #f6f7f7;
}

code {
    padding: 2px 6px;
    background: #eaeaea;
    border-radius: 3px;
    font-family: monospace;
    font-size: 12px;
    color: #c9382b;
}

.wp-badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
    text-align: center;
}

.badge-public {
    background: #ecf7ed;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.badge-draft {
    background: #fff8e1;
    color: #b78103;
    border: 1px solid #ffe082;
}

/* --- テーマ管理専用レイアウト --- */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding-top: 10px;
}

.theme-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    position: relative;
    transition: box-shadow 0.1s;
    display: flex;
    flex-direction: column;
}

.theme-card.is-active {
    border: 2px solid #2271b1;
}

.theme-screenshot {
    position: relative;
    height: 180px;
    background: #f6f7f7;
    overflow: hidden;
}

.theme-screenshot img { width: 100%; height: 100%; object-fit: cover; }

/* ホバー時に表示する詳細ボタン */
.theme-actions {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
}
.theme-card:hover .theme-actions { display: flex; }

/* モーダル表示用 */
.theme-modal-overlay {
    display: none; position: fixed; inset: 0; z-index: 99999;
    background: rgba(0,0,0,0.6); align-items: center; justify-content: center;
}
.theme-modal {
    background: #fff; width: 800px; max-width: 90%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: flex; flex-direction: column;
}
.modal-header { padding: 15px 20px; border-bottom: 1px solid #dcdcde; font-size: 16px; font-weight: 600; }
.modal-body { display: flex; padding: 20px; gap: 20px; }
.modal-info { flex: 1; }
.modal-footer { 
    padding: 15px 20px; border-top: 1px solid #dcdcde; background: #f6f7f7; 
    display: flex; justify-content: space-between; align-items: center; 
}

/* ==========================================================================
   tablenav（一括操作バー・フィルター・ページネーション）
   ========================================================================== */
.tablenav {
    margin: 10px 0 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: nowrap;
}
.tablenav-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.tablenav-right {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}
.tablenav select {
    width: auto !important;
    height: 30px;
    padding: 0 6px;
    border: 1px solid #8c8f94;
    border-radius: 3px;
    font-size: 13px;
    background: #fff;
    color: #2c3338;
}
.tablenav .button,
.tablenav button.button {
    height: 30px;
    padding: 0 10px;
    font-size: 13px;
    background: #f6f7f7;
    border: 1px solid #8c8f94;
    border-radius: 3px;
    color: #2c3338;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    white-space: nowrap;
}
.tablenav .button:hover,
.tablenav button.button:hover { background: #f0f0f1; border-color: #1d2327; color: #1d2327; }
.tablenav .button.disabled,
.tablenav a.button.disabled { color: #a7aaad; pointer-events: none; }

/* ページネーション */
.displaying-num { font-size: 13px; color: #646970; margin-right: 4px; }
.pagination-links { display: flex; align-items: center; gap: 4px; }
.paging-input { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: #646970; }
.current-page {
    width: 46px !important;
    height: 28px;
    text-align: center;
    border: 1px solid #8c8f94 !important;
    border-radius: 3px;
    font-size: 13px;
    padding: 0 4px !important;
}

/* ==========================================================================
   subsubsub（ステータスフィルターリンク）
   ========================================================================== */
.subsubsub {
    list-style: none;
    margin: 8px 0 12px;
    padding: 0;
    font-size: 13px;
    color: #646970;
    line-height: 1.8;
}
.subsubsub li { display: inline-block; }
.subsubsub li a { text-decoration: none; color: #2271b1; }
.subsubsub li a:hover { color: #135e96; }
.subsubsub li a.current { color: #000; font-weight: 600; }
.subsubsub .separator { color: #c3c4c7; margin: 0 4px; }

/* ==========================================================================
   wp-content-title-area 拡張（検索フォーム付き）
   ========================================================================== */
.wp-content-title-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.wp-content-title-area h2 {
    font-size: 23px;
    font-weight: 400;
    color: #1d2327;
    white-space: nowrap;
}
.wp-content-title-area .button-primary {
    padding: 4px 8px;
    font-size: 12px;
    background: #f6f7f7;
    border: 1px solid #2271b1;
    border-radius: 3px;
    color: #2271b1;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.wp-content-title-area .button-primary:hover { background: #2271b1; color: #fff; }
.wp-content-title-area .toggle-btn {
    padding: 4px 10px;
    font-size: 12px;
    background: #f6f7f7;
    border: 1px solid #8c8f94;
    border-radius: 3px;
    color: #2c3338;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.wp-content-title-area .toggle-btn:hover { background: #f0f0f1; border-color: #1d2327; }
.search-form { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.search-form .search-input {
    width: 200px !important;
    height: 30px;
    padding: 4px 8px !important;
    font-size: 13px;
    border: 1px solid #8c8f94 !important;
    border-radius: 3px;
}
.search-form .button {
    height: 30px;
    padding: 0 12px;
    font-size: 13px;
    background: #f6f7f7;
    border: 1px solid #8c8f94;
    border-radius: 3px;
    color: #2c3338;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}
.search-form .button:hover { background: #f0f0f1; border-color: #1d2327; }

/* ==========================================================================
   投稿一覧（edit-posts）固有スタイル
   ========================================================================== */
.wp-list-table-container {
    background: #fff;
    border: 1px solid #c3c4c7;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
    margin-top: 5px;
}
.post-title-link {
    font-size: 14px;
    font-weight: 600;
    color: #2271b1;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 2px;
}
.post-title-link:hover { color: #135e96; }
.row-actions {
    font-size: 12px;
    color: #a7aaad;
    padding: 2px 0 0;
    opacity: 0;
    transition: opacity 0.1s;
}
.wp-list-table tbody tr:hover .row-actions { opacity: 1; }
.row-actions a,
.row-actions button {
    background: none; border: none; padding: 0; margin: 0;
    font-size: 12px; color: #2271b1; text-decoration: none; cursor: pointer;
}
.row-actions a:hover, .row-actions button:hover { color: #135e96; }
.row-actions .trash-action { color: #b32d2e; }
.row-actions .trash-action:hover { color: #dc3232; }
.wp-badge-inline { font-weight: 400; color: #646970; font-size: 12px; margin-left: 4px; }
.slug-code {
    font-family: Consolas, Monaco, monospace;
    background: #f6f7f7;
    padding: 2px 5px;
    border-radius: 3px;
    color: #50575e;
    border: 1px solid #dcdcde;
    font-size: 12px;
}

/* ==========================================================================
   サイドバー開閉用スタイル
   ========================================================================== */

/* 親メニューの見た目 */
.wp-sidebar-menu .has-submenu > a {
    cursor: pointer;
    display: block;
    text-decoration: none;
    position: relative;
}

/* サブメニューの基本構造（初期状態） */
.wp-sidebar-menu .wp-sidebar-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out; /* ヌルヌル動かす設定 */
    list-style: none;
    padding-left: 20px;
    margin: 0;
}

/* openクラスがある場合に高さを展開 */
.wp-sidebar-menu .has-submenu.open .wp-sidebar-submenu {
    max-height: 500px; /* 十分な高さを確保（子メニューの数に合わせて調整） */
    transition: max-height 0.3s ease-in;
}
/* ==========================================================================
   プラグイン一覧（plugins）固有スタイル
   ========================================================================== */
.plugin-title { font-weight: 600; font-size: 14px; color: #1d2327; }
.status-badge { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 11px; font-weight: bold; }
.status-active  { background: #ecf7ed; color: #2e7d32; border: 1px solid #c8e6c9; }
.status-inactive{ background: #e2e3e5; color: #383d41; border: 1px solid #d6d8db; }
.action-btn { background: none; border: none; padding: 0; cursor: pointer; font-size: 12px; font-weight: 600; text-decoration: underline; }
.btn-stop     { color: #d63638; }
.btn-activate { color: #2271b1; }
.plugin-upload-card {
    background: #fff;
    padding: 20px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    display: none;
    margin-bottom: 20px;
}
.plugin-upload-card form { display: flex; align-items: center; gap: 10px; }
.filter-links { margin: 8px 0 12px; font-size: 13px; }
.filter-links a { text-decoration: none; color: #2271b1; padding: 0 4px; }
.filter-links a.current { color: #000; font-weight: 600; pointer-events: none; }
.filter-links .count { color: #646970; }
.bulk-actions { display: flex; align-items: center; gap: 6px; }
.search-box   { display: flex; align-items: center; }
.search-box input[type="text"] {
    height: 30px;
    width: 200px !important;
    padding: 0 8px !important;
    border: 1px solid #8c8f94;
    border-radius: 3px;
    font-size: 13px;
}

/* ==========================================================================
   設定系ページ（site-settings, categories）固有スタイル
   ========================================================================== */
.settings-container { max-width: 600px; }
.settings-section { margin-top: 20px; }
.form-table { width: 100%; border-collapse: collapse; }
.form-table th {
    width: 200px;
    text-align: left;
    padding: 15px 10px 15px 0;
    vertical-align: top;
    font-weight: 600;
    font-size: 13px;
    color: #1d2327;
}
.form-table td { padding: 10px 0; vertical-align: top; }
.form-table td input[type="text"],
.form-table td textarea { width: 100%; max-width: 400px; }
.description { font-size: 12px; color: #646970; margin-top: 5px; }

/* ==========================================================================
   メニュー管理（site-menu）
   ========================================================================== */
.menu-manager-layout { display: flex; gap: 20px; align-items: flex-start; margin-top: 20px; }
.menu-list-panel {
    width: 250px;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #c3c4c7;
    padding: 15px;
}
.menu-list-panel h3 { margin-bottom: 15px; font-size: 14px; font-weight: 600; }
.menu-list-panel ul { list-style: none; }
.menu-list-panel li { margin-bottom: 8px; }
.menu-list-panel li a {
    display: block;
    padding: 8px 12px;
    border: 1px solid #c3c4c7;
    background: #f6f7f7;
    color: #3c434a;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}
.menu-list-panel li a.active,
.menu-list-panel li a:hover { background: #2271b1; color: #fff; border-color: #2271b1; }
.menu-edit-panel { flex: 1; background: #fff; border: 1px solid #c3c4c7; padding: 20px; }
.menu-item-row { display: flex; gap: 10px; margin-bottom: 8px; align-items: center; }
.menu-item-row input { flex: 1; padding: 6px 8px; }
.menu-item-row button { height: 32px; padding: 0 10px; }
.menu-locations-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.menu-location-label {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; border: 1px solid #f0f0f1;
    cursor: pointer; font-size: 13px; border-radius: 3px;
}
.menu-location-label:hover { background: #f6f7f7; }

/* ==========================================================================
   テーマ管理（themes）— theme-grid は admin_style.css に既存
   ========================================================================== */
.theme-active-badge {
    color: #2271b1;
    font-size: 11px;
    font-weight: 700;
}