/* ============================================
   SALLY141 Learning - Prototype CSS
   紙芝居用のスタイルシート

   🎨 カラーパレット
   ─────────────────────────────────
   くすみピンク  : #D8A39D (Primary)
   アイボリー    : #F5F0E6 (Background)
   ベージュ      : #C9B7A7 (Secondary)
   ─────────────────────────────────
   ダークブラウン : #3D3229 (Header/Sidebar/Text)
   ミディアム     : #6B5D52 (Sub Text)
   ライトベージュ : #E8DDD0 (Border/Divider)
   ピンクホバー   : #C8908A (Primary Hover)
   ピンク淡い     : #F0D9D5 (Primary Light)
   ウォーム白     : #FFFDF9 (Card BG)
   ============================================ */

:root {
    --primary: #D8A39D;
    --primary-hover: #C8908A;
    --primary-light: #F0D9D5;
    --primary-pale: #F8EEEC;
    --bg: #F5F0E6;
    --secondary: #C9B7A7;
    --secondary-hover: #B8A494;
    --dark: #3D3229;
    --dark-mid: #4A3F35;
    --dark-light: #5C4F44;
    --text: #3D3229;
    --text-sub: #6B5D52;
    --text-muted: #9B8E82;
    --border: #E8DDD0;
    --border-light: #F0E8DC;
    --card-bg: #FFFDF9;
    --white: #FFFFFF;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: 'Helvetica Neue', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }
button, .btn { cursor: pointer; border: none; font-family: inherit; }

/* --- Prototype Badge --- */
.proto-badge {
    position: fixed; top: 12px; right: 12px;
    background: var(--primary); color: var(--white);
    font-size: 11px; font-weight: 700;
    padding: 4px 12px; border-radius: 20px;
    z-index: 9999; letter-spacing: 0.5px;
}

/* --- Screen Info --- */
.screen-info {
    background: var(--primary-pale);
    border-left: 4px solid var(--primary);
    padding: 12px 16px; margin: 16px;
    border-radius: 4px; font-size: 13px;
}
.screen-info strong { color: var(--primary-hover); }

/* ============================================
   共通ナビゲーション
   ============================================ */

/* --- Front Header --- */
.front-header {
    background: var(--dark);
    color: var(--white);
    padding: 0 20px; height: 60px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 100;
}
.front-header .logo {
    font-size: 20px; font-weight: 800;
    color: var(--primary);
    letter-spacing: 1px;
}
.front-header .logo span {
    color: var(--secondary);
    font-weight: 300; font-size: 14px; margin-left: 6px;
}
.front-header nav { display: flex; gap: 24px; align-items: center; }
.front-header nav a { color: var(--secondary); font-size: 14px; transition: color .2s; }
.front-header nav a:hover, .front-header nav a.active { color: var(--white); }
.front-header .user-menu { display: flex; align-items: center; gap: 12px; }
.front-header .avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    color: var(--white); font-weight: 700; font-size: 14px;
}

/* --- Front Bottom Nav --- */
.bottom-nav {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--dark);
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 100;
}
.bottom-nav ul { display: flex; justify-content: space-around; }
.bottom-nav li a {
    display: flex; flex-direction: column; align-items: center;
    color: var(--text-muted); font-size: 10px; gap: 2px; transition: color .2s;
}
.bottom-nav li a:hover, .bottom-nav li a.active { color: var(--primary); }
.bottom-nav .nav-icon { font-size: 20px; }

/* --- Admin/Shop Sidebar --- */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 260px; background: var(--dark); color: var(--white);
    padding: 20px 0; flex-shrink: 0;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .sidebar-logo {
    padding: 0 20px 20px; font-size: 18px; font-weight: 800;
    color: var(--primary);
    border-bottom: 1px solid var(--dark-light);
}
.sidebar .sidebar-logo small {
    display: block; font-size: 11px;
    color: var(--secondary); font-weight: 400; margin-top: 2px;
}
.sidebar nav { padding: 12px 0; }
.sidebar nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px; color: var(--secondary);
    font-size: 14px; transition: all .2s;
}
.sidebar nav a:hover { background: var(--dark-mid); color: var(--white); }
.sidebar nav a.active { background: var(--primary); color: var(--white); border-radius: 0; }
.sidebar .sidebar-section {
    font-size: 11px; color: var(--text-muted);
    padding: 16px 20px 6px; text-transform: uppercase; letter-spacing: 1px;
}
.admin-main { flex: 1; padding: 24px 32px; overflow-x: hidden; }

/* --- Admin Header --- */
.admin-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 24px; padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.admin-header h1 { font-size: 24px; font-weight: 700; }

/* ============================================
   共通コンポーネント
   ============================================ */

/* --- Buttons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 24px; border-radius: 8px;
    font-size: 14px; font-weight: 600; transition: all .2s;
}
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--card-bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--secondary); }
.btn-line { background: #06c755; color: #fff; font-size: 16px; padding: 14px 32px; }
.btn-line:hover { background: #05b04c; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 36px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: var(--white); }

/* --- Cards --- */
.card {
    background: var(--card-bg);
    border-radius: 12px; overflow: hidden;
    box-shadow: 0 2px 8px rgba(61,50,41,.06);
    transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(61,50,41,.1); }
.card-body { padding: 16px; }
.card-img {
    width: 100%; aspect-ratio: 16/9;
    background: var(--border);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 13px; position: relative;
}
.card-img .duration {
    position: absolute; bottom: 8px; right: 8px;
    background: rgba(61,50,41,.75); color: var(--white);
    font-size: 11px; padding: 2px 8px; border-radius: 4px;
}
.card-img .progress-overlay {
    position: absolute; bottom: 0; left: 0; height: 3px;
    background: var(--primary);
}

/* --- Grid --- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* --- Hero Section --- */
.hero {
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-mid) 50%, var(--dark-light) 100%);
    color: var(--white); padding: 60px 40px; text-align: center;
}
.hero h1 { font-size: 36px; font-weight: 800; margin-bottom: 16px; }
.hero p { font-size: 18px; color: var(--secondary); max-width: 600px; margin: 0 auto 32px; }

/* --- Section --- */
.section { padding: 32px 20px; max-width: 1200px; margin: 0 auto; }
.section-title {
    font-size: 20px; font-weight: 700; margin-bottom: 20px;
    display: flex; align-items: center; justify-content: space-between;
}
.section-title .more { font-size: 13px; color: var(--primary); font-weight: 500; }

/* --- Carousel Row --- */
.carousel-row {
    display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px;
    scroll-snap-type: x mandatory;
}
.carousel-row > * { scroll-snap-align: start; flex-shrink: 0; width: 260px; }

/* --- Progress Bar --- */
.progress-bar {
    height: 8px; background: var(--border);
    border-radius: 4px; overflow: hidden;
}
.progress-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 4px; transition: width .3s;
}

/* --- Badge --- */
.badge {
    display: inline-block; padding: 3px 10px;
    border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-beginner { background: #e8f5e9; color: #2e7d32; }
.badge-intermediate { background: #fff3e0; color: #e65100; }
.badge-advanced { background: var(--primary-pale); color: var(--primary-hover); }
.badge-completed { background: var(--primary-pale); color: var(--primary-hover); }
.badge-status { background: #f3e5f5; color: #7b1fa2; }

/* --- Level Badge --- */
.level-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 6px;
    font-size: 12px; font-weight: 600;
}
.level-beginner { background: #c8e6c9; color: #1b5e20; }
.level-intermediate { background: #ffe0b2; color: #e65100; }
.level-advanced { background: var(--primary-light); color: #8B4A42; }

/* --- Stats Card --- */
.stat-card {
    background: var(--card-bg); border-radius: 12px;
    padding: 20px; text-align: center;
    box-shadow: 0 2px 8px rgba(61,50,41,.06);
}
.stat-card .stat-number { font-size: 32px; font-weight: 800; color: var(--primary); }
.stat-card .stat-label { font-size: 13px; color: var(--text-sub); margin-top: 4px; }

/* --- Table --- */
.data-table {
    width: 100%; border-collapse: collapse;
    background: var(--card-bg); border-radius: 12px; overflow: hidden;
    box-shadow: 0 2px 8px rgba(61,50,41,.06);
}
.data-table th {
    background: var(--border-light);
    text-align: left; padding: 12px 16px;
    font-size: 13px; font-weight: 600;
    color: var(--text-sub); border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 12px 16px; font-size: 14px;
    border-bottom: 1px solid var(--border-light);
}
.data-table tr:hover { background: var(--primary-pale); }

/* --- Form Elements --- */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-sub); margin-bottom: 6px; }
.form-input {
    width: 100%; padding: 10px 14px;
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 14px; transition: border-color .2s;
    background: var(--card-bg);
}
.form-input:focus { outline: none; border-color: var(--primary); }

/* --- Video Player Placeholder --- */
.video-player {
    width: 100%; aspect-ratio: 16/9;
    background: var(--dark); border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: var(--white); position: relative;
}
.video-player .play-btn {
    width: 80px; height: 80px;
    background: rgba(216,163,157,.9);
    border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-size: 32px;
}

/* --- Chapter List --- */
.chapter-list {
    background: var(--card-bg); border-radius: 12px; overflow: hidden;
    box-shadow: 0 2px 8px rgba(61,50,41,.06);
}
.chapter-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; border-bottom: 1px solid var(--border-light);
    transition: background .2s; cursor: pointer;
}
.chapter-item:hover { background: var(--primary-pale); }
.chapter-item.completed { background: #f1f8e9; }
.chapter-item.current { background: var(--primary-pale); border-left: 3px solid var(--primary); }
.chapter-num {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--border); display: flex;
    align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    color: var(--text-sub); flex-shrink: 0;
}
.chapter-item.completed .chapter-num { background: #4caf50; color: #fff; }
.chapter-title { flex: 1; font-size: 14px; }
.chapter-duration { font-size: 12px; color: var(--text-muted); }

/* --- Event Card --- */
.event-card {
    background: var(--card-bg); border-radius: 12px; overflow: hidden;
    box-shadow: 0 2px 8px rgba(61,50,41,.06);
}
.event-card .event-date-badge {
    background: var(--primary); color: var(--white);
    padding: 8px 16px; text-align: center;
}
.event-card .event-date-badge .month { font-size: 12px; }
.event-card .event-date-badge .day { font-size: 28px; font-weight: 800; line-height: 1; }

/* --- Tab Navigation --- */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab {
    padding: 10px 20px; font-size: 14px; font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px; transition: all .2s; cursor: pointer;
}
.tab:hover { color: var(--text-sub); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* --- Filter Bar --- */
.filter-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; flex-wrap: wrap; }
.filter-bar select, .filter-bar input[type="text"] {
    padding: 8px 14px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 13px; background: var(--card-bg);
}

/* --- Search Bar --- */
.search-bar {
    display: flex; align-items: center;
    background: var(--card-bg); border-radius: 8px;
    border: 1px solid var(--border);
    padding: 8px 14px; gap: 8px; max-width: 400px;
}
.search-bar input { border: none; outline: none; flex: 1; font-size: 14px; background: transparent; }

/* --- Empty State --- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }

/* --- Tag list --- */
.tag-list { display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
    padding: 4px 12px; background: var(--border-light);
    border-radius: 20px; font-size: 12px; color: var(--text-sub);
    cursor: pointer; transition: all .2s;
}
.tag:hover { background: var(--primary-light); color: var(--primary-hover); }
.tag.active { background: var(--primary); color: var(--white); }

/* --- Category Card --- */
.category-card {
    background: var(--card-bg); border-radius: 16px;
    padding: 32px 20px; text-align: center;
    box-shadow: 0 2px 8px rgba(61,50,41,.06);
    transition: transform .2s;
}
.category-card:hover { transform: translateY(-4px); }
.category-icon { font-size: 48px; margin-bottom: 12px; }
.category-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.category-count { font-size: 13px; color: var(--text-muted); }

/* --- Invite Screen --- */
.invite-screen { max-width: 480px; margin: 60px auto; text-align: center; padding: 40px 20px; }
.invite-screen .org-name { font-size: 24px; font-weight: 800; margin: 16px 0 8px; }

/* --- Completion Screen --- */
.completion-screen { max-width: 480px; margin: 60px auto; text-align: center; padding: 40px 20px; }
.completion-icon { font-size: 64px; margin-bottom: 16px; }

/* --- Dashboard Stats Row --- */
.stats-row {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px; margin-bottom: 24px;
}

/* --- Link List --- */
.link-list {
    background: var(--card-bg); border-radius: 12px; overflow: hidden;
    box-shadow: 0 2px 8px rgba(61,50,41,.06);
}
.link-list-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid var(--border-light);
    cursor: pointer; transition: background .2s;
}
.link-list-item:hover { background: var(--primary-pale); }
.link-list-item .arrow { color: var(--secondary); }

/* --- Avatar (general) --- */
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary); color: var(--white);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
}

/* --- FAB --- */
.fab {
    position: fixed; bottom: 80px; right: 20px;
    width: 56px; height: 56px;
    background: var(--primary); color: var(--white);
    border-radius: 50%; display: flex;
    align-items: center; justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(216,163,157,.4);
    z-index: 50;
}

/* --- Page Navigation --- */
.page-nav {
    background: var(--primary-pale);
    border: 1px solid var(--primary-light);
    border-radius: 8px; padding: 12px 16px;
    margin: 16px; font-size: 13px;
}
.page-nav strong { color: var(--primary-hover); }
.page-nav a { color: var(--primary); font-weight: 600; text-decoration: underline; }

/* --- Alert / Info Boxes --- */
.alert-warning {
    background: #fff3e0; border-left: 4px solid #e65100;
    padding: 12px 16px; border-radius: 4px;
    font-size: 13px; color: #e65100; margin-bottom: 16px;
}
.alert-info {
    background: var(--primary-pale); border-left: 4px solid var(--primary);
    padding: 12px 16px; border-radius: 4px;
    font-size: 13px; color: var(--text-sub); margin-bottom: 16px;
}

/* ============================================
   スタイルギャラリー（完成写真から学ぶ）
   ============================================ */

/* --- Masonry-like Grid (CSS columns) --- */
.style-gallery {
    columns: 3;
    column-gap: 16px;
}
.style-gallery .style-card {
    break-inside: avoid;
    margin-bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--card-bg);
    box-shadow: 0 2px 8px rgba(61,50,41,.06);
    transition: transform .2s, box-shadow .2s;
    cursor: pointer;
    position: relative;
}
.style-gallery .style-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(61,50,41,.12);
}
.style-card .style-photo {
    width: 100%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 13px;
    position: relative;
    background: var(--border);
}
/* 様々なアスペクト比でPinterest風に */
.style-card.tall .style-photo { aspect-ratio: 3/4; }
.style-card.wide .style-photo { aspect-ratio: 4/3; }
.style-card.square .style-photo { aspect-ratio: 1/1; }

.style-card .style-info {
    padding: 12px;
}
.style-card .style-name {
    font-size: 14px; font-weight: 600;
    margin-bottom: 4px;
}
.style-card .style-meta {
    font-size: 12px; color: var(--text-muted);
    display: flex; align-items: center; gap: 8px;
}

/* ロックオーバーレイ（スタイルカード用） */
.style-card .lock-overlay {
    position: absolute; inset: 0;
    background: rgba(61,50,41,.5);
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 4px;
    color: var(--white); font-size: 24px;
    z-index: 1;
}

/* ランキング番号 */
.style-rank {
    position: absolute; top: 8px; left: 8px;
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--primary); color: var(--white);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800; z-index: 2;
}

@media (max-width: 768px) {
    .style-gallery { columns: 2; }
}
@media (max-width: 480px) {
    .style-gallery { columns: 2; column-gap: 10px; }
}

/* ============================================
   無料 / 有料（ロック）表示
   ============================================ */

/* --- 無料バッジ --- */
.badge-free {
    background: #e8f5e9; color: #2e7d32;
}
.badge-premium {
    background: var(--dark); color: var(--white);
}

/* --- カード上の鍵オーバーレイ --- */
.card-img .lock-overlay {
    position: absolute; inset: 0;
    background: rgba(61,50,41,.55);
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 4px;
    color: var(--white); font-size: 28px;
    border-radius: 0;
    z-index: 1;
}
.card-img .lock-overlay .lock-text {
    font-size: 11px; font-weight: 600;
    background: rgba(0,0,0,.5); padding: 2px 10px;
    border-radius: 10px;
}

/* --- チャプター行のロック --- */
.chapter-item.locked { opacity: .6; }
.chapter-item.locked .chapter-num {
    background: var(--dark); color: var(--white); font-size: 11px;
}

/* --- ビデオプレーヤーのロック状態 --- */
.video-player.locked .play-btn {
    background: rgba(61,50,41,.85);
}
.video-player .lock-message {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(61,50,41,.95));
    padding: 40px 24px 24px; text-align: center;
    color: var(--white);
}
.video-player .lock-message p {
    font-size: 14px; margin-bottom: 12px; color: var(--secondary);
}

/* ============================================
   課金誘導モーダル
   ============================================ */
.modal-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(61,50,41,.6);
    z-index: 1000;
    align-items: center; justify-content: center;
    animation: fadeIn .2s;
}
.modal-backdrop.show { display: flex; }

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    max-width: 440px; width: 90%;
    box-shadow: 0 16px 48px rgba(61,50,41,.25);
    overflow: hidden;
    animation: slideUp .3s ease;
}
.modal-header {
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-mid) 100%);
    color: var(--white); padding: 28px 24px; text-align: center;
}
.modal-header .modal-icon { font-size: 48px; margin-bottom: 8px; }
.modal-header h2 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.modal-header p { font-size: 13px; color: var(--secondary); }
.modal-body { padding: 24px; }
.modal-body .price-display {
    text-align: center; margin-bottom: 20px;
}
.modal-body .price-display .price {
    font-size: 40px; font-weight: 800; color: var(--primary);
}
.modal-body .price-display .price span {
    font-size: 14px; font-weight: 400; color: var(--text-muted);
}
.modal-body .feature-list {
    list-style: none; margin-bottom: 20px;
}
.modal-body .feature-list li {
    padding: 8px 0; font-size: 14px;
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; gap: 8px;
}
.modal-body .feature-list li::before {
    content: "✓"; color: #4caf50; font-weight: 700;
}
.modal-footer {
    padding: 0 24px 24px;
    display: flex; flex-direction: column; gap: 8px;
}
.modal-close {
    background: none; border: none; color: var(--text-muted);
    font-size: 13px; padding: 8px; cursor: pointer;
}
.modal-close:hover { color: var(--text); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .front-header nav { display: none; }
    .bottom-nav { display: block; }
    .hero { padding: 40px 20px; }
    .hero h1 { font-size: 24px; }
    .sidebar { display: none; }
    .admin-main { padding: 16px; }
    .section { padding: 20px 16px; }
}

@media (max-width: 480px) {
    .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
