/**
 * NEXTLIFE.JP - Responsive CSS
 * 
 * モバイル・タブレット・デスクトップ対応のレスポンシブスタイル
 */

/* ===== Extra Small Devices (Mobile) - 320px and up ===== */

@media (max-width: 575.98px) {
    /* Typography */
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    /* Hero Section */
    .hero-section {
        padding: 3rem 1rem;
    }
    
    .hero-section h1 {
        font-size: 1.75rem;
    }
    
    .hero-section p {
        font-size: 1rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .hero-buttons .btn {
        width: 100%;
    }
    
    /* Navigation */
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .nav-link {
        padding: 0.5rem 0 !important;
    }
    
    /* Cards */
    .card {
        margin-bottom: 1rem;
    }
    
    .card-img {
        height: 200px;
    }
    
    /* Grid */
    .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }
    
    .col-12,
    [class*="col-"] {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .btn-lg {
        padding: 0.8rem 1.5rem;
        font-size: 0.95rem;
    }
    
    /* Forms */
    .form-control,
    .form-select {
        padding: 0.6rem 0.8rem;
        font-size: 16px; /* iOS zoom 対策 */
    }
    
    /* Tables */
    .table {
        font-size: 0.85rem;
    }
    
    /* Footer */
    footer .row > div {
        margin-bottom: 1.5rem;
    }
    
    footer h5 {
        font-size: 1rem;
    }
    
    /* Utilities */
    .mt-5 {
        margin-top: 1rem !important;
    }
    
    .mb-5 {
        margin-bottom: 1rem !important;
    }
    
    .px-4 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    /* Text truncation */
    .text-truncate {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Gap utilities */
    .gap-4 {
        gap: 0.5rem !important;
    }
}

/* ===== Small Devices (Landscape Phones) - 576px and up ===== */

@media (min-width: 576px) {
    /* Typography */
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    /* Hero Section */
    .hero-section {
        padding: 4rem 2rem;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    /* Cards */
    .card-img {
        height: 220px;
    }
    
    /* Grid 2 columns */
    .col-sm-6 {
        flex: 0 0 auto;
        width: 50%;
    }
    
    /* Buttons */
    .btn {
        padding: 0.65rem 1.25rem;
    }
}

/* ===== Medium Devices (Tablets) - 768px and up ===== */

@media (min-width: 768px) {
    /* Typography */
    h1 {
        font-size: 2.5rem;
    }
    
    h2 {
        font-size: 2rem;
    }
    
    /* Hero Section */
    .hero-section {
        padding: 5rem 2rem;
    }
    
    .hero-buttons {
        flex-direction: row;
        gap: 1rem;
    }
    
    .hero-buttons .btn {
        width: auto;
    }
    
    /* Navigation */
    .navbar-collapse {
        display: flex !important;
    }
    
    .navbar-toggler {
        display: none;
    }
    
    /* Cards */
    .card-img {
        height: 250px;
    }
    
    /* Grid 3 columns */
    .col-md-3 {
        flex: 0 0 auto;
        width: 25%;
    }
    
    .col-md-4 {
        flex: 0 0 auto;
        width: 33.33%;
    }
    
    .col-md-6 {
        flex: 0 0 auto;
        width: 50%;
    }
    
    .col-md-8 {
        flex: 0 0 auto;
        width: 66.66%;
    }
    
    /* Sidebar layout */
    .sidebar-layout {
        display: grid;
        grid-template-columns: 1fr 300px;
        gap: 2rem;
    }
    
    /* Pagination */
    .pagination {
        justify-content: center;
    }
    
    /* Forms */
    .form-group {
        margin-bottom: 1.5rem;
    }
    
    /* Multi-column layout */
    .col-md-12 {
        width: 100%;
    }
}

/* ===== Large Devices (Desktops) - 992px and up ===== */

@media (min-width: 992px) {
    /* Typography */
    h1 {
        font-size: 3rem;
    }
    
    /* Hero Section */
    .hero-section {
        padding: 6rem 2rem;
    }
    
    .hero-section h1 {
        font-size: 3rem;
    }
    
    /* Navigation */
    .navbar {
        padding: 1rem 0;
    }
    
    /* Cards */
    .card {
        box-shadow: var(--box-shadow);
    }
    
    .card:hover {
        box-shadow: var(--box-shadow-lg);
    }
    
    .card-img {
        height: 300px;
    }
    
    /* Grid 4 columns */
    .col-lg-3 {
        flex: 0 0 auto;
        width: 25%;
    }
    
    .col-lg-4 {
        flex: 0 0 auto;
        width: 33.33%;
    }
    
    .col-lg-6 {
        flex: 0 0 auto;
        width: 50%;
    }
    
    .col-lg-8 {
        flex: 0 0 auto;
        width: 66.66%;
    }
    
    /* Container max-width */
    .container {
        max-width: 1200px;
    }
    
    /* Multi-column text */
    .text-columns {
        column-count: 2;
        column-gap: 2rem;
    }
    
    /* Advanced layouts */
    .grid-3 {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
    
    .grid-4 {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
}

/* ===== Extra Large Devices (Large Desktops) - 1200px and up ===== */

@media (min-width: 1200px) {
    /* Container */
    .container {
        max-width: 1320px;
    }
    
    /* Advanced grid */
    .grid-5 {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 2rem;
    }
    
    /* Maximize content width */
    .container-lg {
        max-width: 1400px;
    }
}

/* ===== XXL Devices (4K and beyond) - 1400px and up ===== */

@media (min-width: 1400px) {
    /* Typography */
    h1 {
        font-size: 3.5rem;
    }
    
    /* Container max-width */
    .container {
        max-width: 1400px;
    }
    
    /* Spacing increase */
    .mt-5 {
        margin-top: 3rem !important;
    }
    
    .mb-5 {
        margin-bottom: 3rem !important;
    }
    
    .py-5 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    
    /* Card spacing */
    .card {
        margin-bottom: 2rem;
    }
}

/* ===== Print Media =====  */

@media print {
    /* Hide non-printable elements */
    .navbar,
    footer,
    .btn,
    .no-print,
    .navbar-toggler {
        display: none !important;
    }
    
    /* Adjust spacing for printing */
    body {
        background-color: white;
        margin: 0;
        padding: 0;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    /* Card styling for print */
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    /* Page break control */
    h1, h2 {
        page-break-after: avoid;
    }
    
    p {
        page-break-inside: avoid;
    }
}

/* ===== Landscape Mode (Tablets & Phones) ===== */

@media (orientation: landscape) and (max-height: 500px) {
    /* Reduce padding for landscape mode */
    .hero-section {
        padding: 2rem 1rem;
    }
    
    .hero-section h1 {
        font-size: 1.5rem;
    }
    
    /* Reduce spacing */
    .py-5 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
}

/* ===== Touch Device Optimizations ===== */

@media (hover: none) and (pointer: coarse) {
    /* Increase tap target size */
    .btn,
    a,
    button {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Remove hover effects on touch devices */
    .card:hover {
        transform: none;
        box-shadow: var(--box-shadow);
    }
    
    /* Larger form inputs */
    .form-control,
    .form-select {
        font-size: 16px;
        min-height: 44px;
    }
}

/* ===== Accessibility: Reduced Motion ===== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .card:hover {
        transform: none;
    }
}

/* ===== Dark Mode (if supported) ===== */

@media (prefers-color-scheme: dark) {
    /* Optional: dark mode styles */
    /* body {
        background-color: #1a1a1a;
        color: #f0f0f0;
    } */
}

/* ===== Custom Media Queries ===== */

/* Between Small and Medium */
@media (min-width: 576px) and (max-width: 767.98px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Between Medium and Large */
@media (min-width: 768px) and (max-width: 991.98px) {
    .sidebar-layout {
        grid-template-columns: 1fr;
    }
}

/* Mobile and Tablet only */
@media (max-width: 991.98px) {
    /* Simplify layouts for smaller screens */
    .hide-mobile {
        display: none;
    }
    
    .show-mobile {
        display: block;
    }
}

/* Desktop only */
@media (min-width: 992px) {
    .hide-desktop {
        display: none;
    }
    
    .show-desktop {
        display: block;
    }
}

/* ===== Viewport Width Breakpoints ===== */

/* Width >= 1920px (FHD) */
@media (min-width: 1920px) {
    .container {
        max-width: 1800px;
    }
}

/* Width >= 2560px (4K) */
@media (min-width: 2560px) {
    h1 {
        font-size: 4rem;
    }
    
    .container {
        max-width: 2000px;
    }
}
