/* ベーススタイル */
body {
    font-family: 'Noto Sans JP', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f9f9f9;
    color: #333;
    overflow-x: hidden;
}

/* ヘッダー (共通) */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative; /* #customSearchOverlayのposition:absoluteの基準となる */
    top: 0;
    z-index: 1001; /* 検索ボックスより手前に来るように少し高く */
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-area {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.logo {
    height: 30px;
    width: auto;
}

.logo-subtext {
    font-size: 0.8rem;
    color: #777;
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* ヘッダー内のFont Awesomeアイコンのスタイル */
.header-right i,
.header-left .menu-toggle i {
    font-size: 1.2rem;
    color: #555;
    cursor: pointer;
}

.header-right a {
    color: #555;
    text-decoration: none;
}

button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: #555;
}

/* Homeページのハンバーガーメニューアイコンサイズ */
.header .menu-toggle i {
    font-size: 1.5rem;
    color: #333;
}

/* ヒーローセクション */
.hero-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 25px;
    background-color: #f9f9f9;
    min-height: 60vh;
}

@media (min-width: 768px) {
    .hero-section {
        flex-direction: row;
        justify-content: center;
        gap: 50px;
        text-align: left;
    }

    .hero-content {
        flex: 1;
        max-width: 500px;
    }

    .hero-image {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
    }
}

.hero-content h1 {
    font-size: 2.8rem;
    max-width: 450px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #333;
}

.hero-content p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #666;
}

.hero-image img {
    flex: 1;
    max-width: 100%;
    height: auto;
    width: 400px;
}

/* メイン機能セクション */
.features-section {
    padding: 80px 25px;
    background-color: #fff;
    text-align: center;
}

.features-section h2 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 50px;
    color: #333;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.feature-item {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.feature-item img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    margin-bottom: 20px;
}

.feature-item p {
    font-size: 1rem;
    color: #555;
    font-weight: 500;
}

/* フッター (共通) */
.footer {
    padding: 40px 25px;
    text-align: center;
    background-color: #f9f9f9;
    color: #666;
    font-size: 1rem;
}

.footer a {
    color: #007bff;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* サイドバー (共通) */
.sidebar {
    position: fixed;
    top: 0;
    left: -220px;
    width: 200px;
    height: 100%;
    background-color: #f8f8f8;
    box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    transition: left 0.3s ease-in-out;
    z-index: 2000;
    padding-top: 60px;
}

.sidebar.active {
    left: 0;
}

.close-sidebar {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2em;
    color: #333;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

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

.sidebar ul li {
    margin-bottom: 0;
}

/* サイドバーのリンクのフォントサイズとホバー効果をHomeページに合わせる */
.sidebar ul li a {
    text-decoration: none;
    color: #333;
    font-size: 1rem;
    font-weight: 400;
    font-family: 'Noto Sans JP', sans-serif;
    display: block;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar ul li a:hover {
    color: #007bff;
    background-color: #e0e0e0;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1900;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* サイドバーが開いているときにスクロールを禁止する */
body.sidebar-open {
    overflow: hidden;
}

/* Kartee Helpページ固有のスタイルを統合 */
.kartee-help-main {
    max-width: 800px;
    margin: 30px auto;
    padding: 0 20px;
}

.help-section {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.help-details {
    border-bottom: 1px solid #eee;
}

.help-details:last-child {
    border-bottom: none;
}

.help-summary {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    list-style: none;
    position: relative;
    justify-content: space-between;
}

/* Chromeなどのブラウザでdetailsのデフォルトマーカーを消す */
details > summary::-webkit-details-marker {
    display: none;
}
details > summary::marker {
    display: none;
}

.summary-icon {
    width: 30px;
    height: 30px;
    margin-right: 15px;
    flex-shrink: 0;
}

/* テキスト部分がアイコンと矢印の間のスペースを占めるように調整 */
.help-summary > span:first-of-type {
    flex-grow: 1;
    margin-right: auto;
}

.arrow {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #333;
    margin-left: 15px;
    transition: transform 0.2s ease-in-out;
    flex-shrink: 0;
}

.help-details[open] .arrow {
    transform: rotate(180deg);
}

.details-content {
    padding: 10px 20px 20px 65px;
    font-size: 0.95em;
    color: #555;
    line-height: 1.8;
}

.details-content p {
    margin-bottom: 10px;
}

.details-content ul {
    list-style-type: disc;
    margin-left: 20px;
    padding-left: 0;
}

.details-content ul li {
    margin-bottom: 5px;
}

/* Privacy Policyページ固有のスタイルを統合 */
.privacy-policy-content {
    margin: 20px;
    padding: 20px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    color: #333;
    background-color: #f4f4f4;
    padding-top: 20px;
}

.privacy-policy-content h1 {
    text-align: center;
    margin-bottom: 30px;
}
.privacy-policy-content h2 {
    margin-top: 25px;
    margin-bottom: 15px;
    color: #555;
}
.privacy-policy-content p {
    margin-bottom: 10px;
}
.privacy-policy-content ul {
    list-style-type: disc;
    margin-left: 20px;
    margin-bottom: 10px;
}
.privacy-policy-content ul li {
    margin-bottom: 5px;
}
.privacy-policy-content a {
    color: #007bff;
    text-decoration: none;
}
.privacy-policy-content a:hover {
    text-decoration: underline;
}

/* レスポンシブ調整 */
@media (max-width: 768px) {
    .header {
        padding: 10px 15px;
    }
    
    .logo-area {
        flex-direction: row;
        align-items: center;
        gap: 5px;
    }
    .logo {
        height: 25px;
    }
    .logo-subtext {
        font-size: 0.7rem;
    }

    .header-right i,
    .header-left .menu-toggle i {
        font-size: 1.3rem;
    }
    .header-right {
        gap: 15px;
    }

    .hero-section {
        padding: 40px 15px;
        text-align: center;
    }
    .hero-content h1 {
        font-size: 2rem;
        margin-bottom: 15px;
    }
    .hero-content p {
        font-size: 1rem;
    }
    .hero-image img {
        width: 300px;
    }

    .features-section {
        padding: 50px 15px;
    }
    .features-section h2 {
        font-size: 1.8rem;
        margin-bottom: 30px;
    }
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    .feature-item img {
        margin-bottom: 15px;
    }
    .feature-item p {
        font-size: 0.95rem;
    }

    .footer {
        padding: 30px 15px;
        font-size: 0.9rem;
    }

    .sidebar {
        width: 180px;
        padding-top: 50px;
        left: -190px;
    }
    .close-sidebar {
        font-size: 1.8em;
    }
    .sidebar ul li a {
        font-size: 0.95rem;
        padding: 12px 15px;
    }

    .kartee-help-main {
        font-size: 1.1em;
        padding: 12px 15px;
    }
    .summary-icon {
        width: 25px;
        height: 25px;
        margin-right: 10px;
    }
    .details-content {
        padding: 10px 15px 15px 50px;
    }

    .privacy-policy-content {
        margin: 15px;
        padding: 15px;
        padding-top: 15px;
    }
}

/* 新しい検索オーバーレイのスタイル */
#customSearchOverlay {
    position: absolute;
    /* top: calc(100% + 10px); はヘッダーの高さに依存するので、具体的な値に調整することも検討 */
    top: 100px; /* ヘッダーの高さに応じて調整してください */
    right: 25px; /* 右端からの距離（header-rightのパディングに合わせる） */
    width: 350px; /* 検索バーの幅を調整 */
    max-width: calc(100% - 50px); /* 左右25pxのパディングを考慮 */
    background-color: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000; /* ヘッダーより低く、しかしコンテンツより高く */
    padding: 15px;
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out, transform 0.3s ease-out;
}

#customSearchOverlay.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Google CSE 検索ボックスの内部要素のスタイル調整 */
/* ここは特に重要です。gcse-searchbox-onlyがないので、gcse-searchresults-onlyが生成する要素にスタイルを適用します */
#customSearchOverlay .gsc-control-cse {
    padding: 0;
}

#customSearchOverlay .gsc-search-box {
    margin: 0;
    padding: 0;
    width: 100%;
    border: none;
    box-shadow: none;
}

#customSearchOverlay .gsc-input {
    width: 100% !important;
    box-sizing: border-box;
    /* その他の入力フィールドのスタイル調整 */
}

#customSearchOverlay input.gsc-search-button {
    display: none;
}

/* Google CSE 検索結果のスタイル調整 */
#customSearchOverlay .gsc-results-wrapper-overlay {
    /* 「結果のみ」レイアウトではこのクラスは使われないかもしれません */
    /* 代わりにgcse-searchresults-onlyの子要素を確認する */
}

#customSearchOverlay .gsc-webResult {
    /* 個々の検索結果のスタイル */
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

#customSearchOverlay .gsc-result-info {
    /* 検索結果のメタ情報 */
    font-size: 0.9em;
    color: #666;
}

#customSearchOverlay .gs-title {
    /* 検索結果のタイトル */
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 5px;
}

#customSearchOverlay .gs-snippet {
    /* 検索結果のスニペット */
    font-size: 0.9em;
    color: #444;
}

/* スマホでの位置調整 */
@media (max-width: 768px) {
    #customSearchOverlay {
        top: 80px; /* ヘッダーのモバイル時の高さに合わせて調整 */
        right: 15px; /* 右端からの距離（header-rightのモバイル時のパディングに合わせる） */
        max-width: calc(100% - 30px); /* 左右15pxのパディングを考慮 */
    }
}