/* 
==============================================
CSS学習用共通スタイルシート
==============================================
このファイルは画面学習とCSS設計の理解を目的としています。
Bootstrapと組み合わせて使用し、カスタムスタイルを提供します。
*/

/* ==============================================
   1. 基本設定とリセット
============================================== */
:root {
    /* カラーパレット - CSS変数を使用してテーマ管理 */
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    
    /* グレースケール */
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    
    /* レイアウト用変数 */
    --sidebar-width: 250px;
    --header-height: 60px;
    --border-radius: 0.375rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    
    /* フォント設定 */
    --font-family-base: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    --font-size-base: 1rem;
    --line-height-base: 1.5;
}

/* 基本的なボックスサイジング設定 */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* bodyの基本スタイル */
body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--gray-900);
    background-color: var(--gray-100);
    margin: 0;
    padding: 0;
}

/* ==============================================
   2. ヘッダー（Header）スタイル
============================================== */
.site-header {
    background: #000000 !important;
    background-color: #000000 !important;
    background-image: none !important;
    color: white;
    height: var(--header-height);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    box-shadow: var(--box-shadow-lg);
}

.site-header .navbar {
    background: #000000 !important;
    background-color: #000000 !important;
}

.site-header .navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: white !important;
}

.site-header .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.site-header .navbar-nav .nav-link:hover {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
}

/* デスクトップ用サイドバートグルボタン */
.sidebar-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    margin-right: 1rem;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.sidebar-toggle:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
    outline: none;
}

.sidebar-toggle i {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.sidebar-toggle.active i {
    transform: rotate(90deg);
}

/* ハンバーガーメニューボタンのカスタマイズ（モバイル用） */
.navbar-toggler {
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.25rem 0.5rem;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 30 30'%3E%3Cpath stroke='rgba%28255,255,255,1%29' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

/* ==============================================
   3. サイドバー（Sidebar）スタイル
============================================== */
.sidebar-wrapper {
    position: fixed;
    top: var(--header-height);
    left: 0;
    height: calc(100vh - var(--header-height));
    width: var(--sidebar-width);
    z-index: 1020;
    overflow-y: auto;
    background-color: white;
    border-right: 1px solid var(--gray-300);
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease;
}

/* サイドバーが閉じられた状態 */
.sidebar-wrapper.collapsed {
    transform: translateX(-100%);
}

/* サイドバーが開いている状態 */
.sidebar-wrapper.expanded {
    transform: translateX(0);
}

.sidebar {
    padding: 1rem 0;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav-item {
    margin: 0.25rem 0;
}

.sidebar-nav-link {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav-link:hover {
    color: var(--primary-color);
    background-color: var(--gray-100);
    border-left-color: var(--primary-color);
}

.sidebar-nav-link.active {
    color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.1);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.sidebar-nav-link i {
    margin-right: 0.75rem;
    width: 1.25rem;
    text-align: center;
}

/* ==============================================
   4. メインコンテンツエリア
============================================== */
.main-content {
    margin-top: var(--header-height);
    margin-left: var(--sidebar-width);
    min-height: calc(100vh - var(--header-height));
    background-color: var(--gray-100);
    transition: margin-left 0.3s ease;
}

/* サイドバーが閉じられた時のメインコンテンツ */
.main-content.sidebar-collapsed {
    margin-left: 0;
}

/* サイドバーが開いている時のメインコンテンツ */
.main-content.sidebar-expanded {
    margin-left: var(--sidebar-width);
}

.content-wrapper {
    padding: 2rem;
    background-color: white;
    margin: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

/* ブレッドクラム */
.breadcrumb-custom {
    background-color: transparent;
    padding: 1rem 1rem 0 1rem;
    margin: 0;
}

/* メッセージコンテナ */
.messages-container {
    margin: 1rem;
}

/* ==============================================
   5. カード要素
============================================== */
.card-custom {
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: all 0.3s ease;
}

.card-custom:hover {
    box-shadow: var(--box-shadow-lg);
    transform: translateY(-2px);
}

.card-header-custom {
    background: linear-gradient(135deg, var(--gray-100) 0%, white 100%);
    border-bottom: 1px solid var(--gray-300);
    font-weight: 600;
    color: var(--gray-800);
}

/* ==============================================
   6. ボタン要素
============================================== */
.btn-custom-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    border: none;
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
}

.btn-custom-primary:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    transform: translateY(-1px);
    box-shadow: var(--box-shadow-lg);
    color: white;
}

/* ==============================================
   7. フォーム要素
============================================== */
.form-control-custom {
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    transition: all 0.3s ease;
}

.form-control-custom:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

.form-label-custom {
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

/* ==============================================
   8. ハンバーガーメニュー（モバイル用）
============================================== */
.hamburger-menu {
    position: fixed;
    top: var(--header-height);
    left: -100%;
    width: 100%;
    height: calc(100vh - var(--header-height));
    background-color: white;
    z-index: 1025;
    transition: left 0.3s ease;
    overflow-y: auto;
}

.hamburger-menu.show {
    left: 0;
}

.hamburger-menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1024;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.hamburger-menu-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* ==============================================
   9. フッター
============================================== */
.site-footer {
    background-color: var(--gray-800);
    color: white;
    padding: 2rem 0;
    margin-top: auto;
}

/* ==============================================
   10. レスポンシブデザイン
============================================== */

/* タブレット用 (768px以下) */
@media (max-width: 991.98px) {
    .sidebar-wrapper {
        transform: translateX(-100%);
    }
    
    .sidebar-wrapper.collapsed {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .main-content.sidebar-collapsed {
        margin-left: 0;
    }
    
    .main-content.sidebar-expanded {
        margin-left: 0;
    }
    
    .content-wrapper {
        margin: 0.5rem;
        padding: 1rem;
    }
    
    /* デスクトップ用サイドバートグルボタンを非表示 */
    .sidebar-toggle {
        display: none !important;
    }
    
    :root {
        --sidebar-width: 280px;
    }
}

/* スマートフォン用 (576px以下) */
@media (max-width: 576px) {
    .site-header .navbar-brand {
        font-size: 1.25rem;
    }
    
    .content-wrapper {
        margin: 0.25rem;
        padding: 0.75rem;
    }
    
    .btn-custom-primary {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* ==============================================
   11. コードブロック表示
============================================== */
.code-example {
    background-color: var(--gray-50);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin: 1rem 0;
}

.code-example h5 {
    color: var(--gray-700);
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
}

.code-example pre {
    background-color: #2d3748;
    color: #e2e8f0;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

.code-example code {
    color: inherit;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
}

/* シンタックスハイライト風の色分け */
.language-css .token-property { color: #81c784; }
.language-css .token-value { color: #ffb74d; }
.language-html .token-tag { color: #f06292; }
.language-html .token-attr { color: #42a5f5; }
.language-js .token-keyword { color: #ab47bc; }
.language-js .token-function { color: #66bb6a; }

/* コードのコピーボタン */
.code-example {
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* ==============================================
   12. ユーティリティクラス
============================================== */

/* マージン・パディングヘルパー */
.mt-custom { margin-top: 2rem; }
.mb-custom { margin-bottom: 2rem; }
.ml-custom { margin-left: 2rem; }
.mr-custom { margin-right: 2rem; }
.pt-custom { padding-top: 2rem; }
.pb-custom { padding-bottom: 2rem; }
.pl-custom { padding-left: 2rem; }
.pr-custom { padding-right: 2rem; }

/* テキストヘルパー */
.text-primary-custom { color: var(--primary-color); }
.text-secondary-custom { color: var(--secondary-color); }
.font-weight-custom { font-weight: 600; }

/* 背景色ヘルパー */
.bg-light-custom { background-color: var(--gray-100); }
.bg-dark-custom { background-color: var(--gray-800); }

/* ボーダーヘルパー */
.border-custom { border: 1px solid var(--gray-300); }
.border-radius-custom { border-radius: var(--border-radius); }

/* シャドウヘルパー */
.shadow-custom { box-shadow: var(--box-shadow); }
.shadow-lg-custom { box-shadow: var(--box-shadow-lg); }

/* ==============================================
   12. アニメーション
============================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

.slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

/* ==============================================
   13. プリント用スタイル
============================================== */
@media print {
    .site-header,
    .sidebar-wrapper,
    .hamburger-menu,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
    }
    
    .content-wrapper {
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* ==============================================
   14. アクセシビリティ対応
============================================== */

/* フォーカス表示の改善 */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 高コントラストモード対応 */
@media (prefers-contrast: high) {
    :root {
        --gray-300: #000;
        --gray-700: #000;
    }
}

/* 動作軽減モード対応 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}