/* Sleeping Beauty BBS - Main Stylesheet */
/* テーマ: ダークで閉鎖的、退廃的 */

/* ===== リセット ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== カラー定義 ===== */
:root {
    /* 基調色 */
    --abyss: #0a0a0a;
    --dark-gray: #1a1a1a;
    --smoke: #242424;
    --lead: #2a2a2a;

    /* テキスト色 */
    --bone: #d4d4d4;
    --ash: #a0a0a0;
    --mist: #6b6b6b;
    --ink: #4a4a4a;

    /* アクセントカラー */
    --sick-green: #4a7c59;
    --poison-green: #5a9b6e;
    --decay-red: #8b4a4a;
    --blood-red: #a85858;
    --rust: #9d6b53;
    --faded-blue: #4a5a6b;

    /* ステータスカラー */
    --success-bg: #3d5a45;
    --success-text: #7ba888;
    --error-bg: #5a3d3d;
    --error-text: #b87878;
}

/* ===== 基本スタイル ===== */
body {
    background: var(--abyss);
    color: var(--bone);
    font-family: 'Courier New', 'MS Gothic', monospace;
    font-size: 14px;
    font-weight: 300;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 896px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ===== タイポグラフィ ===== */
h1 {
    font-size: 2.25rem;
    font-weight: 400;
    color: var(--bone);
    margin-bottom: 0.5rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

h1 a {
    color: var(--bone);
}

h1 a:hover {
    color: var(--bone);
}

h2 {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--bone);
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--bone);
}

.subtitle {
    color: var(--ash);
    font-size: 14px;
}

/* ===== ヘッダー ===== */
header {
    margin-bottom: 2rem;
}

header h1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header .about {
    font-size: 14px;
    text-decoration: underline;
}

/* ===== メッセージ ===== */
.message {
    padding: 1rem 1.5rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border: 1px solid;
}

.message-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: #2d4535;
}

.message-error {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: #4a2d2d;
}

/* ===== セクション ===== */
.section {
    background: var(--dark-gray);
    border: 1px solid var(--lead);
    padding: 1.5rem;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--bone);
    margin-bottom: 1rem;
}

/* ===== カード ===== */
.card {
    background: var(--dark-gray);
    border: 1px solid var(--lead);
    padding: 1.5rem;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.card-reply {
    background: var(--smoke);
    margin-left: 2rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.card-meta {
    font-size: 0.75rem;
    color: var(--mist);
}

.card-content {
    color: var(--ash);
    white-space: pre-wrap;
    margin-top: 0.75rem;
    line-height: 1.6;
}

/* ===== フォーム ===== */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    color: var(--bone);
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    background: var(--lead);
    color: var(--bone);
    border: 1px solid #3a3a3a;
    padding: 0.75rem 1rem;
    border-radius: 2px;
    font-family: 'Courier New', 'MS Gothic', monospace;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--faded-blue);
    box-shadow: 0 0 0 2px rgba(74, 90, 107, 0.2);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--mist);
}

.form-textarea {
    resize: vertical;
}

.form-select {
    cursor: pointer;
    height: 42px;
}

.form-select option {
    background: var(--lead);
    color: var(--bone);
}

.form-select optgroup {
    background: var(--dark-gray);
    color: var(--ash);
    font-weight: 400;
    font-style: normal;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--mist);
    margin-top: 0.5rem;
}

/* ===== ボタン ===== */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 2px;
    border: none;
    cursor: pointer;
    font-family: 'Courier New', 'MS Gothic', monospace;
    font-size: 14px;
    font-weight: 400;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

.btn-primary {
    background: var(--sick-green);
    color: var(--bone);
    border: 1px solid #3d5a45;
    width: 100%;
}

.btn-primary:hover {
    background: var(--poison-green);
    border-color: var(--sick-green);
}

.btn-secondary {
    background: var(--lead);
    color: var(--ash);
    border: 1px solid #3a3a3a;
}

.btn-secondary:hover {
    background: #343434;
    color: #b0b0b0;
}

.btn-danger {
    background: var(--decay-red);
    color: var(--bone);
    border: 1px solid #6b3a3a;
}

.btn-danger:hover {
    background: var(--blood-red);
    border-color: var(--decay-red);
}

.btn-rust {
    background: var(--rust);
    color: var(--bone);
    border: 1px solid #7d5a43;
}

.btn-rust:hover {
    background: #ad7b63;
    border-color: var(--rust);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-link {
    background: none;
    border: none;
    color: var(--decay-red);
    padding: 0;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 400;
    transition: all 0.3s ease;
}

.btn-link:hover {
    color: var(--blood-red);
}

/* ===== 検索フォーム ===== */
.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    flex: 1;
}

.search-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.search-actions {
    display: flex;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .search-grid {
        grid-template-columns: 2fr 1fr 1fr;
    }
}

/* ===== 削除フォーム ===== */
.delete-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--ink);
}

.delete-form-inner {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.delete-form-label {
    font-size: 0.875rem;
    color: var(--ash);
    white-space: nowrap;
}

.delete-form-input {
    width: 80px;
}

/* ===== ユーティリティ ===== */
.hidden {
    display: none;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--mist);
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

/* ===== リンク ===== */
a,
.link {
    color: var(--sick-green);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover,
.link:hover {
    color: var(--poison-green);
    text-decoration: underline;
    text-decoration-style: dashed;
}

/* ===== パンくずリスト ===== */
.breadcrumb {
    margin-bottom: 1rem;
}

/* ===== 役割タグ ===== */
.role-tags {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.role-label {
    font-size: 0.75rem;
    color: var(--ash);
    font-weight: 400;
}

.role-tag {
    display: inline-block;
    padding: 0.15rem 0.75rem;
    padding-top: 0.35rem;
    font-size: 0.75rem;
    font-weight: 400;
    border-radius: 2px;
    border: 1px solid;
}

.role-my {
    background: var(--sick-green);
    color: var(--bone);
    border-color: var(--poison-green);
}

.role-desired {
    background: var(--rust);
    color: var(--bone);
    border-color: #ad7b63;
}

.role-separator {
    color: var(--mist);
    font-size: 0.875rem;
}

/* ===== 空状態 ===== */
.empty-state {
    background: var(--dark-gray);
    border: 1px solid var(--lead);
    padding: 2rem;
    border-radius: 4px;
    text-align: center;
    color: var(--mist);
}

/* ===== ページネーション ===== */
.pagination {
    margin-bottom: 2rem;
}

.pagination-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    background: var(--lead);
    color: var(--ash);
    border: 1px solid var(--ink);
    border-radius: 2px;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.pagination-btn:hover {
    background: var(--smoke);
    color: var(--bone);
}

.pagination-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-numbers {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pagination-number {
    padding: 0.5rem 0.75rem;
    background: var(--dark-gray);
    color: var(--ash);
    border: 1px solid var(--ink);
    border-radius: 2px;
    text-decoration: none;
    font-size: 0.875rem;
    min-width: 2.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.pagination-number:hover {
    background: var(--smoke);
    color: var(--bone);
    border-color: var(--mist);
}

.pagination-current {
    background: var(--sick-green);
    color: var(--bone);
    border-color: var(--poison-green);
    font-weight: 400;
}

.pagination-ellipsis {
    padding: 0.5rem 0.25rem;
    color: var(--mist);
    font-size: 0.875rem;
}

.pagination-info {
    text-align: center;
    color: var(--mist);
    font-size: 0.75rem;
}

/* ===== ヘルプアイコン ===== */
.form-label-with-help {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--lead);
    color: var(--ash);
    border: 1px solid var(--ink);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.help-icon:hover {
    background: var(--smoke);
    color: var(--bone);
    border-color: var(--faded-blue);
}

/* ===== モーダルダイアログ ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: var(--dark-gray);
    border: 1px solid var(--lead);
    border-radius: 4px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--ink);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--bone);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--ash);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    color: var(--bone);
}

.modal-body {
    padding: 1.5rem;
}

.role-explanation {
    margin-bottom: 1.5rem;
}

.role-explanation:last-child {
    margin-bottom: 0;
}

.role-explanation:has(.role-explanation-image) {
    display: flex;
}

.role-explanation-image img {
    width: 120px;
}

.role-explanation-title {
    font-weight: 400;
    color: var(--bone);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.role-explanation-text {
    color: var(--ash);
    font-size: 0.875rem;
    line-height: 1.6;
}

.rule-book a {
    display: block;
    text-align: center;
    margin: 1rem 0;
    color: var(--bone);
    text-decoration: underline;
}

.rule-book-detail > div h2 {
    font-size: 1.2rem;
}

.rule-book-detail p {
    margin-bottom: 1rem;
}

/* ===== レスポンシブ ===== */
@media (max-width: 768px) {
    .container {
        padding: 1rem 0.5rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .card-reply {
        margin-left: 1rem;
    }

    .delete-form-inner {
        flex-wrap: wrap;
    }

    .search-form {
        flex-direction: column;
    }

    .pagination-container {
        flex-wrap: wrap;
    }

    .pagination-btn,
    .pagination-number {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
        min-width: 2rem;
    }

    .pagination-info {
        font-size: 0.7rem;
    }
}
