/* ==========================================================================
   Responsive Styles
   ========================================================================== */

/* Tablet (768px - 1199px) */
@media (max-width: 1199px) {
    .companies-grid {
        grid-template-columns: 1fr;
        gap: 80px 30px;
        max-width: 450px;
    }
    
    .company-card {
        width: 100%;
        margin-top: 20px;
    }
    
    .company-tag {
        width: 298.874px;
        height: 36.775px;
        font-size: 17.512px;
        line-height: 36.775px;
    }
    
    .points-grid {
        grid-template-columns: 1fr;
        padding: 20px 15px 0 25px;
    }
    
    .main-navigation ul {
        gap: 15px;
    }
    
    .main-navigation a {
        font-size: 14px;
    }
    
    /* INDEX Section */
    .index-item {
        padding: 25px 15px;
    }
    
    .index-item span {
        font-size: 14px;
    }
    
    .index-title {
        font-size: 24px;
    }
}

/* Tablet Portrait and Below (max-width: 991px) */
@media (max-width: 991px) {
    .header-container {
        flex-wrap: wrap;
    }
    
    .header-right {
        width: 100%;
        justify-content: space-between;
        margin-top: 15px;
    }
    
    .hero-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .hero-item {
        min-height: 180px;
    }
    
    .problems-grid {
        grid-template-columns: 1fr;
    }
    
    .comparison-table {
        font-size: 13px;
    }
    
    .comparison-table thead th,
    .comparison-table tbody td {
        padding: 10px;
    }
}

/* Mobile (max-width: 767px) */
@media (max-width: 767px) {
    /* Top Bar - main.cssで管理 */
    
    /* Header - main.cssで管理 */
    
    /* サイドバーを非表示 */
    .company-intro-sidebar {
        display: none !important;
    }
    
    /* PC用今すぐCHECKインジケーターを非表示 */
    .check-indicator-pc {
        display: none !important;
    }
    
    /* Hero Section - 高さ縮小 */
    .hero-section {
        height: 400px;
        max-height: 400px;
    }
    
    .hero-content {
        height: 400px !important;
        max-height: 400px;
    }
    
    /* Hero Section */
    .hero-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .hero-item {
        min-height: 150px;
    }
    
    /* INDEX Section */
    .content-index {
        padding: 0;
        margin-left: 0;
        margin-right: 0;
        margin-bottom: 0;
    }
    
    .index-container {
        flex-direction: column;
        border: none;
        border-top: 2px solid #000;
        border-bottom: 2px solid #000;
    }
    
    .index-item {
        border-right: none;
        border-bottom: none;
        border-left: none;
        padding: 18px 15px;
        min-height: auto;
        justify-content: flex-start;
        align-items: center;
        gap: 5px;
    }
    
    .index-item:not(.index-title-item) {
        text-align: left;
    }
    
    .index-item:last-child {
        border-bottom: none;
    }
    
    /* INDEXタイトル部分 */
    .index-title-item {
        border-bottom: 1px solid #000;
        padding: 25px 20px;
        justify-content: center;
    }
    
    .index-title {
        font-size: 28px;
    }
    
    /* INDEX装飾バー - スマホ用：上は左寄り、下は右寄り */
    .index-title-item .red-bar-top {
        width: 57px;
        height: 11px;
        top: 15px;
        left: 30%;
        right: auto;
    }
    
    .index-title-item .red-bar-bottom {
        width: 57px;
        height: 11px;
        bottom: 15px;
        left: auto;
        right: 30%;
    }
    
    .index-item span:not(.index-square):not(.index-arrow) {
        font-size: clamp(12px, 3.5vw, 16px);
        font-weight: 700;
        text-align: left;
        line-height: 1.3;
        white-space: nowrap;
    }
    
    /* スマホ用：赤い四角と矢印を表示 */
    .index-item .index-square,
    .index-item .index-arrow {
        display: inline-block;
        color: #FF0000 !important;
        flex-shrink: 0;
    }
    
    .index-item .index-square {
        font-size: 12px;
        width: auto;
        text-align: center;
    }
    
    .index-item .index-arrow {
        font-size: 10px;
        width: auto;
        text-align: center;
    }
    
    /* スマホでは赤バーコーナーを非表示 */
    .red-bar-corner {
        display: none;
    }
    
    /* Recommended Companies */
    .recommended-companies .section-header {
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-bottom: 15px;
    }
    
    .recommended-companies .section-title-jp {
        width: auto;
        max-width: none;
        height: auto;
        font-size: clamp(18px, 5.5vw, 24px);
        line-height: 1.4;
        padding: 6px 10px;
        white-space: nowrap;
        text-align: center;
        margin-bottom: 8px;
    }
    
    .recommended-companies .section-title-en {
        font-size: clamp(16px, 5vw, 22px) !important;
        padding: 0;
        color: #FFF !important;
        text-align: center;
        line-height: 1.3;
        white-space: nowrap;
    }
    
    /* スマホ用改行 - 無効化 */
    .sp-br {
        display: none;
    }
    
    /* おすすめ業者カード - 横スクロール形式 */
    .companies-grid-wrapper {
        width: 100%;
        position: relative;
        overflow: visible;
    }
    
    .companies-grid {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 15px;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding: 20px 0 15px;
        max-width: 100%;
        margin: 0;
        -ms-overflow-style: none;
        scrollbar-width: none;
        justify-content: flex-start;
    }
    
    .companies-grid::-webkit-scrollbar {
        display: none;
    }
    
    .company-wrapper {
        flex: 0 0 calc(100vw - 100px);
        width: calc(100vw - 100px);
        max-width: calc(100vw - 100px);
        min-width: calc(100vw - 100px);
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }
    
    .company-wrapper:first-child {
        margin-left: 20px;
    }
    
    .company-wrapper:last-child {
        margin-right: 20px;
    }
    
    /* スクロールインジケーター */
    .scroll-indicator {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 10px 0 5px;
    }
    
    .scroll-text {
        font-family: "Hiragino Sans", "Noto Sans JP", sans-serif;
        font-size: 14px;
        font-weight: 600;
        color: #FFF;
        letter-spacing: 2px;
    }
    
    .scroll-arrow {
        font-size: 16px;
        color: #FFF;
        animation: scrollArrow 1.5s ease-in-out infinite;
    }
    
    @keyframes scrollArrow {
        0%, 100% {
            transform: translateX(0);
            opacity: 1;
        }
        50% {
            transform: translateX(8px);
            opacity: 0.5;
        }
    }
    
    .company-card {
        width: 100%;
        margin-top: 20px;
    }
    
    .company-tag {
        width: 280px;
        height: 34px;
        font-size: 16px;
        line-height: 34px;
    }
    
    .company-catchcopy {
        font-size: 22px;
        padding: 28px 12px 18px;
        min-height: 90px;
    }
    
    .company-image-wrapper {
        padding: 0;
    }
    
    .company-image {
        height: auto;
    }
    
    .company-info {
        padding: 12px 10px;
    }
    
    .company-name {
        font-size: 20px;
        margin-bottom: 8px;
        min-height: 55px;
        line-height: 1.4;
    }
    
    .company-feature-wrapper {
        gap: 8px;
        margin-bottom: 10px;
        padding: 6px 12px;
        min-height: 110px;
    }
    
    .crown-left {
        width: 70px;
        height: 100px;
    }
    
    .crown-right {
        width: 70px;
        height: 100px;
    }
    
    .company-feature {
        font-size: 17px;
    }
    
    .company-btn {
        width: 100%;
        max-width: 100%;
        height: 55px;
        font-size: 14px;
        gap: 6px;
    }
    
    .company-btn.btn-consult,
    .company-btn.btn-review {
        width: 100%;
        max-width: 100%;
        height: 55px;
        font-size: 14px;
        margin-top: 0;
    }
    
    .arrow-icon {
        width: 8px;
    }
    
    /* Problems Section */
    .problems-title-wrapper {
        gap: 15px;
    }
    
    .alert-message {
        flex-direction: column;
        padding: 20px 15px;
        gap: 15px;
    }
    
    .alert-icon {
        width: 60px;
    }
    
    .alert-title {
        font-size: 20px;
    }
    
    .problems-grid {
        gap: 20px;
        margin-bottom: 30px;
    }
    
    .problem-item {
        padding: 20px 15px;
    }
    
    .problem-number {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .problem-title {
        font-size: 16px;
    }
    
    .problem-description {
        font-size: 13px;
    }
    
    .advice-box {
        width: calc(100% - 20px);
        height: auto;
        min-height: 120px;
        padding: 50px 15px 20px;
        margin: 0 10px 115px;
        box-shadow: 3px 3px 0 0 #000;
        overflow: visible;
    }
    
    .advice-icons {
        top: 0;
        left: 0;
        gap: 0;
    }
    
    .advice-icon-corner {
        width: 50px;
        margin-top: -28px;
        margin-left: -18px;
    }
    
    .advice-icon-main {
        width: 82px;
        height: auto;
        margin-left: -3px;
        margin-top: -12px;
    }
    
    .advice-arrow {
        bottom: -85px;
        width: 168px;
        height: 51px;
    }
    
    .advice-text {
        color: #000;
        font-family: "Hiragino Maru Gothic ProN", "Noto Sans JP", "Hiragino Sans", sans-serif;
        font-size: 12px;
        font-style: normal;
        font-weight: 400;
        line-height: 1.6;
        text-align: center;
    }

    /* 比較セクションの吹き出し下余白を縮める */
    .comparison-section {
        margin-bottom: 20px;
    }

    .comparison-advice {
        margin-bottom: 15px;
    }
    
    /* Comparison Section */
    .section-title-main {
        font-size: 4.8vw;
    }
    
    .section-title-sub {
        font-size: 6.4vw;
        margin-top: 15px;
        margin-bottom: 15px;
    }
    
    .section-title-sub .char-with-dot::before {
        width: 7px;
        height: 7px;
        top: -3px;
    }

    /* 行間詰め・余白削除 */
    .comparison-intro {
        gap: 0;
    }

    .intro-line {
        margin: 0;
    }

    .intro-line-2 {
        margin-top: 5px;
    }

    .intro-line-3 {
        margin-top: 10px;
    }

    .hake-icon {
        margin-right: 3px;
    }
    
    .comparison-table-wrapper {
        overflow-x: scroll;
    }
    
    .comparison-table {
        min-width: 600px;
        font-size: 12px;
    }
    
    .comparison-table thead th {
        padding: 8px;
        font-size: 13px;
    }
    
    .comparison-table tbody td {
        padding: 12px 8px;
    }
    
    .merit-cell li,
    .demerit-cell li {
        margin-bottom: 8px;
        font-size: 12px;
    }
    
    .comparison-note {
        font-size: 10px;
        margin-bottom: 20px;
        white-space: nowrap;
    }
    
    /* Points Section - main.cssで管理 */
    
    .points-grid {
        gap: 30px;
        padding: 20px 15px 0 25px;
    }
    
    .point-item {
        padding: 20px 15px;
        overflow: visible;
    }
    
    .point-badge {
        width: 80px;
        height: 80px;
    }
    
    .point-number .point-label {
        font-size: 14px;
    }
    
    .point-number {
        width: 80px;
        height: 80px;
        font-size: 26px;
    }
    
    .point-title {
        font-size: 16px;
        padding: 10px;
        text-align: center;
    }
    
    .point-description {
        font-size: 13px;
    }
    
    /* 強みセクション - 1カラム表示 */
    .strengths-grid {
        flex-direction: column !important;
        gap: 15px;
    }
    
    .strength-card,
    .strengths-grid .strength-card:nth-child(n+4) {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    
    /* 施工実績セクション - 1カラム表示 */
    .results-grid {
        flex-direction: column !important;
        gap: 15px;
        padding: 0 15px;
    }
    
    .result-card {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    
    /* 会社名セクション - スマホ用左寄せ＋大きめ文字 */
    .company-name-section {
        text-align: left !important;
        width: auto !important;
        padding: 15px !important;
        display: inline-block !important;
        margin-left: 0 !important;
    }

    /* 黄色アンダーラインをタイトルの下端に重ねて表示 */
    .company-name-underline {
        bottom: 20px !important;
        height: 12px !important;
        z-index: 1 !important;
    }

    /* タイトル文字を大きめに設定＋アンダーラインの前面に表示 */
    .company-name-large {
        font-size: 28px !important;
        text-align: left !important;
        display: inline-block !important;
        position: relative !important;
        z-index: 2 !important;
        padding-bottom: 4px !important;
    }

    /* ニッカホーム用 - スマホ用スタイル */
    .company-name-section-nikka {
        text-align: left !important;
        width: auto !important;
        padding: 15px !important;
        display: inline-block !important;
        margin-left: 0 !important;
    }

    /* ニッカホーム用 - PC用のアンダーラインspanをスマホでは非表示 */
    .company-name-section-nikka .company-name-underline {
        display: none !important;
    }

    .company-name-section-nikka .company-name-large {
        font-size: 26px !important;
        white-space: normal !important;
        line-height: 1.8 !important;
        display: block !important;
    }

    /* ニッカホーム用 - 各行を縦並びにしてアンダーライン追加 */
    .nikka-line {
        display: block !important;
        position: relative !important;
        padding-bottom: 0px !important;
    }

    .nikka-line::after {
        content: '' !important;
        position: absolute !important;
        bottom: 4px !important;
        left: 0 !important;
        width: 100% !important;
        height: 12px !important;
        background: #FFF500 !important;
        z-index: -1 !important;
    }
}

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .top-bar-text {
        font-size: 11px;
    }
    
    .site-title-en {
        font-size: 18px;
    }
    
    .header-title {
        font-size: 18px;
    }
    
    .header-title .number {
        font-size: 28px;
    }
    
    /* Hero Section */
    .hero-grid {
        gap: 5px;
    }
    
    .hero-item {
        min-height: 120px;
    }
    
    .index-title {
        font-size: 24px;
    }
    
    .index-item span:not(.index-square):not(.index-arrow) {
        font-size: 15px;
    }
    
    .red-bar-top,
    .red-bar-bottom {
        height: 4px;
    }
    
    .recommended-companies .section-header {
        margin-bottom: 10px;
    }
    
    .recommended-companies .section-title-jp {
        font-size: clamp(16px, 4.5vw, 20px);
        padding: 5px 8px;
        margin-bottom: 6px;
    }
    
    .recommended-companies .section-title-en {
        font-size: clamp(13px, 4.2vw, 18px) !important;
        white-space: nowrap;
    }
    
    .companies-grid {
        gap: 12px;
        padding: 15px 0 20px;
    }
    
    .company-wrapper {
        flex: 0 0 calc(100vw - 90px);
        width: calc(100vw - 90px);
        max-width: calc(100vw - 90px);
        min-width: calc(100vw - 90px);
    }
    
    .company-wrapper:first-child {
        margin-left: 15px;
    }
    
    .company-wrapper:last-child {
        margin-right: 15px;
    }
    
    .company-catchcopy {
        font-size: 20px;
        padding: 25px 10px 15px;
        line-height: 1.4;
        min-height: 80px;
    }
    
    .company-name {
        font-size: 18px;
        min-height: 50px;
        line-height: 1.4;
    }
    
    .company-feature-wrapper {
        min-height: 100px;
    }
    
    .company-tag {
        width: 260px;
        height: 32px;
        font-size: 14px;
        line-height: 32px;
    }
    
    .company-catchcopy {
        font-size: 18px;
        padding: 25px 10px 15px;
        min-height: 80px;
    }
    
    .company-image-wrapper {
        padding: 0;
    }
    
    .company-image {
        height: auto;
    }
    
    .company-info {
        padding: 10px 8px;
    }
    
    .company-name {
        font-size: 18px;
        margin-bottom: 6px;
    }
    
    .company-feature-wrapper {
        gap: 6px;
        margin-bottom: 8px;
        padding: 5px 10px;
    }
    
    .crown-left {
        width: 60px;
        height: 85px;
    }
    
    .crown-right {
        width: 60px;
        height: 85px;
    }
    
    .company-feature {
        font-size: 15px;
    }
    
    .company-btn {
        width: 100%;
        max-width: 100%;
        height: 50px;
        font-size: 13px;
        gap: 5px;
    }
    
    .company-btn.btn-consult,
    .company-btn.btn-review {
        width: 100%;
        max-width: 100%;
        height: 50px;
        font-size: 13px;
        margin-top: 0;
    }
    
    .arrow-icon {
        width: 7px;
    }
    
    .alert-title {
        font-size: 18px;
    }

    /* 比較セクション - 480px以下 */
    .intro-line {
        gap: 3px;
    }

    .text-small-work {
        font-size: 18px;
        padding: 0 3px;
    }

    .text-easy-request {
        font-size: 12px;
    }

    .text-local {
        gap: 1px;
    }

    .text-local .char-bg {
        font-size: 18px;
        padding: 0 4px;
    }

    .question-mark {
        font-size: 18px;
    }

    .hake-icon {
        height: 30px;
    }

    .text-rich-experience {
        font-size: 16px;
    }

    .text-major {
        font-size: 18px;
        padding: 0 3px;
    }

    .comparison-header {
        margin-bottom: 15px;
    }
    
    .section-title-main {
        font-size: 20px;
    }
    
    .section-title-sub {
        font-size: 28px;
        margin-top: 10px;
        margin-bottom: 10px;
    }
    
    .section-title-sub .char-with-dot::before {
        width: 7px;
        height: 7px;
        top: -3px;
    }
    
    /* .points-section - main.cssで管理 */
    
    .point-title {
        font-size: 15px;
        text-align: center;
    }
}

/* Extra Small Mobile (max-width: 360px) */
@media (max-width: 360px) {
    .recommended-companies .section-header {
        margin-bottom: 8px;
    }
    
    .recommended-companies .section-title-jp {
        font-size: 15px;
        padding: 4px 6px;
        margin-bottom: 5px;
    }
    
    .recommended-companies .section-title-en {
        font-size: 13px !important;
        white-space: nowrap;
    }
    
    .companies-grid {
        gap: 10px;
        padding: 12px 0 18px;
    }
    
    .company-wrapper {
        flex: 0 0 calc(100vw - 70px);
        width: calc(100vw - 70px);
        max-width: calc(100vw - 70px);
        min-width: calc(100vw - 70px);
    }
    
    .company-wrapper:first-child {
        margin-left: 12px;
    }
    
    .company-wrapper:last-child {
        margin-right: 12px;
    }

    /* 比較セクション - 360px以下 */
    .intro-line {
        gap: 2px;
    }

    .text-small-work {
        font-size: 16px;
        padding: 1px 3px;
    }

    .text-easy-request {
        font-size: 11px;
    }

    .text-local .char-bg {
        font-size: 16px;
        padding: 1px 3px;
    }

    .question-mark {
        font-size: 16px;
    }

    .hake-icon {
        height: 25px;
    }

    .text-rich-experience {
        font-size: 14px;
    }

    .text-major {
        font-size: 20px;
        padding: 1px 4px;
    }

    .comparison-header {
        margin-bottom: 10px;
    }

    .section-title-main {
        font-size: 18px;
    }

    .section-title-sub {
        font-size: 24px;
    }

    .comparison-note {
        font-size: 9px;
    }
}

/* Print Styles */
@media print {
    .hamburger-btn,
    .mobile-menu,
    .company-buttons {
        display: none !important;
    }
    
    .companies-grid {
        grid-template-columns: 1fr;
    }
    
    a {
        text-decoration: underline;
    }
}
