*,
*::before,
*::after {
    box-sizing: border-box;
}

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;700&display=swap');

:root {
    --primary-color: #007BFF; /* A vibrant blue */
    --secondary-color: #6C757D; /* A neutral gray */
    --accent-color: #17A2B8; /* A calming teal */
    --text-color: #343A40; /* A dark gray for text */
    --light-background: #F8F9FA; /* A very light gray for backgrounds */
    --dark-background: #343A40; /* A dark gray for footer */
    --white: #FFFFFF;

    /* New colors for variety */
    --soft-blue: #E3F2FD; /* Lighter shade of primary */
    --soft-green: #E8F5E9; /* Light green */
    --soft-orange: #FFF3E0; /* Light orange */
    --soft-purple: #F3E5F5; /* Light purple */
    --soft-pink: #FCE4EC; /* Light pink */
    --soft-teal: #E0F7FA; /* Lighter shade of accent */
    --light-grey-blue: #CFD8DC; /* For alternating backgrounds */
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    margin: 0;
    background-image: url('IMG/docter4.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text-color);
    line-height: 1.8;
}

main {
    padding-top: 120px; /* Adjust this value based on header height */
}


h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text-color);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--accent-color);
    text-decoration: none;
}

.service-link {
    color: inherit;
    text-decoration: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: var(--white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    transform: translateZ(0);
}

header.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 20px; /* Slimmer header */
}

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

header h1 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.2;
    color: var(--primary-color);
}

.header-contact {
    display: flex;
    flex-direction: column;
}

.header-phone {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
    white-space: nowrap;
}

.header-phone i {
    color: var(--primary-color);
    margin-right: 5px;
}

header h1 a {
    color: inherit;
    text-decoration: none;
    white-space: nowrap; /* Prevent wrapping of text to ensure it stays on one line */
}

nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping if screen is small */
    justify-content: flex-end;
}

nav ul li {
    display: inline-block;
    margin-left: 15px; /* Reduced from 30px to fit more items */
}

nav a {
    font-weight: 700;
    color: var(--text-color);
    font-size: 0.85rem; /* Reduced from 1rem to fit more items */
    position: relative;
    padding-bottom: 5px;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

nav a:hover::after, nav a.active::after {
    width: 100%;
}

/* Reservation Button in Nav */
.nav-reserve-btn {
    background-color: transparent !important;
    color: var(--primary-color) !important;
    padding: 2px 10px !important;
    border: 1px solid var(--primary-color);
    border-radius: 15px;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 0.8rem;
    display: inline-block;
    line-height: 1.2;
    margin-top: -3px;
}

.nav-reserve-btn:hover {
    background-color: var(--primary-color) !important;
    color: white !important;
    box-shadow: 0 2px 5px rgba(0, 123, 255, 0.2);
}

/* Home Medical Application Button in Nav */
.nav-homecare-btn {
    background-color: transparent !important;
    color: var(--accent-color) !important; /* Different color (orange) */
    padding: 2px 10px !important;
    border: 1px solid var(--accent-color);
    border-radius: 15px;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 0.8rem;
    display: inline-block;
    line-height: 1.2;
    margin-top: -3px;
    margin-left: 5px; /* Small gap between buttons */
}

.nav-homecare-btn:hover {
    background-color: var(--accent-color) !important;
    color: white !important;
    box-shadow: 0 2px 5px rgba(255, 140, 0, 0.2);
}

.nav-reserve-btn::after, .nav-homecare-btn::after {
    display: none !important;
}

/* Hero Section */
#hero {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--white);
    position: relative;
    padding: 100px 20px 80px 20px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

#hero .content {
    position: relative;
    z-index: 2;
    animation: fadeIn 1.5s ease-in-out;
    background: rgba(0, 0, 0, 0.4);
    padding: 60px 40px;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    margin: 0 auto;
}

#hero h2 {
    font-size: 3.5rem;
    margin-bottom: 20px;
    color: var(--white);
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
}

#hero p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    color: var(--white);
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8);
}

.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.button {
    display: inline-block;
    background: var(--primary-color);
    color: var(--white);
    padding: 18px 35px;
    border-radius: 50px;
    font-weight: 700;
    transition: all 0.3s ease;
    border: 2px solid var(--primary-color);
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3);
}

.button:hover {
    background: var(--accent-color);
    color: var(--white);
    border-color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(23, 162, 184, 0.4);
}

/* Sections */
section {
    padding: 100px 0;
}

section h2.section-title {
    text-align: center;
    margin-bottom: 70px;
    font-size: 3rem;
    color: var(--text-color);
    position: relative;
    padding-bottom: 20px;
}

section h2.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 2px;
}

/* Services */
#services-overview {
    background: var(--light-background);
}
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
}

.service {
    background: var(--white);
    padding: 40px;
    text-align: center;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    transform: translateY(0);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer; /* Clickable */
}

.service p {
    color: var(--text-color) !important; /* Ensure visibility */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, margin-top 0.5s ease;
    margin-top: 0;
}

.service.active p {
    max-height: 1000px;
    margin-top: 15px;
    overflow: auto;
}

.service:hover {
    transform: translateY(-15px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.12);
}

.service .icon {
    font-size: 3.8rem; /* Slightly larger icons */
    margin-bottom: 25px;
    color: var(--primary-color); /* Default icon color */
    transition: color 0.3s ease;
}

/* Specific icon colors */
.service:nth-child(1) .icon { color: #FF6347; } /* Tomato - Home */
.service:nth-child(2) .icon { color: #4682B4; } /* SteelBlue - Stethoscope */
.service:nth-child(3) .icon { color: #32CD32; } /* LimeGreen - User Friends (Rehab) */
.service:nth-child(4) .icon { color: #FFD700; } /* Gold - Utensils (Nutrition) */
.service:nth-child(5) .icon { color: #6f42c1; } /* Indigo - Procedures (Inpatient) */


.service h4 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

/* Service item backgrounds for variation */
.service-bg-soft-blue { background-color: var(--soft-blue); }
.service-bg-soft-green { background-color: var(--soft-green); }
.service-bg-soft-orange { background-color: var(--soft-orange); }
.service-bg-soft-purple { background-color: var(--soft-purple); }
.service-bg-soft-teal { background-color: var(--soft-teal); }

/* Stats Section */
#stats {
    background: var(--accent-color);
    color: var(--white);
    padding: 80px 0;
    text-align: center;
}

#stats .container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
}

.stat {
    margin: 20px;
    min-width: 200px;
}

.stat h3 {
    font-size: 3.5rem;
    margin: 0 0 10px;
    color: var(--white);
}

.stat p {
    font-size: 1.1rem;
    margin: 0;
    font-weight: 300;
}

/* Service Details */
#service-details .service-item {
    background: var(--white);
    padding: 50px;
    margin-bottom: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

#service-details .service-item h3 {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: var(--primary-color);
}

#service-details .service-item i {
    margin-right: 15px;
    color: var(--accent-color);
}

#service-details .service-item ul {
    list-style: none;
    padding: 0;
    margin-top: 25px;
}

#service-details .service-item ul li {
    margin-bottom: 15px;
    position: relative;
    padding-left: 30px;
    font-size: 1.1rem;
}

#service-details .service-item ul li::before {
    content: '\f058';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--primary-color);
    position: absolute;
    left: 0;
    top: 0;
}

/* About Details */
#about-details .about-item {
    background: var(--white);
    padding: 50px;
    margin-bottom: 30px; /* Reduced margin for tighter look */
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08); /* Stronger shadow */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#about-details .about-item:hover {
    transform: translateY(-5px); /* Lift effect on hover */
    box-shadow: 0 12px 35px rgba(0,0,0,0.15); /* Stronger shadow on hover */
}

/* Alternating background colors for about items */
#about-details .about-item:nth-child(odd) {
    background-color: var(--soft-blue);
}

#about-details .about-item:nth-child(even) {
    background-color: var(--white);
}

#about-details .about-item h3 {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: var(--primary-color);
}

#about-details .about-item i {
    margin-right: 15px;
    color: var(--accent-color);
}

/* Contact Details */
#contact-details .contact-info {
    background: var(--white);
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

#contact-details .contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
}

#contact-details .contact-info h3 {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: var(--primary-color);
}

#contact-details .contact-info i {
    margin-right: 15px;
    color: var(--accent-color);
}

#contact-details .map {
    margin-top: 30px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

#contact-details .contact-form h3 {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: var(--primary-color);
}

#contact-details .contact-form input,
#contact-details .contact-form textarea {
    width: 100%;
    padding: 18px;
    margin-bottom: 25px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    transition: border-color 0.3s ease;
}

#contact-details .contact-form input:focus,
#contact-details .contact-form textarea:focus {
    border-color: var(--primary-color);
    outline: none;
}

#contact-details .contact-form button {
    width: 100%;
}

#contact-details .contact-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#form-status {
    margin-top: 20px;
    padding: 16px 20px;
    border-radius: 8px;
    font-size: 1rem;
    display: none;
}

#form-status.sending {
    display: block;
    background-color: #e9ecef;
    color: #495057;
}

#form-status.success {
    display: block;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#form-status.error {
    display: block;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Outpatient Cards */
#outpatient-section .outpatient-card {
    padding: 40px;
    border-radius: 15px;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: var(--text-color); /* Changed to text-color for better contrast on light backgrounds */
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); /* Added subtle shadow */
}

#outpatient-section .outpatient-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1); /* Enhanced shadow on hover */
}

#outpatient-section .outpatient-card:nth-child(1) { background: var(--soft-teal); } /* 大腸内視鏡検査 */
#outpatient-section .outpatient-card:nth-child(2) { background: var(--soft-green); } /* 胃内視鏡検査 */
#outpatient-section .outpatient-card:nth-child(3) { background: var(--soft-orange); } /* 巻き爪治療 */
#outpatient-section .outpatient-card:nth-child(4) { background: var(--soft-blue); } /* 腹部超音波検査 */
#outpatient-section .outpatient-card:nth-child(5) { background: var(--soft-purple); } /* 各種予防接種 */

#outpatient-section .outpatient-card h4 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: var(--primary-color); /* Changed to primary-color for consistency */
}

#outpatient-section .outpatient-card h4 a {
    color: var(--primary-color);
}

#outpatient-section .outpatient-card:nth-child(3) h4 { /* For 巻き爪治療, if its background is yellow */
    color: var(--text-color);
}
#outpatient-section .outpatient-card:nth-child(3) h4 a { /* For 巻き爪治療, if its background is yellow */
    color: var(--text-color);
}

#outpatient-section .outpatient-card i {
    margin-right: 15px;
    color: var(--accent-color); /* Consistent icon color */
}

/* Inpatient Details */
#inpatient-details .inpatient-item {
    background: var(--white);
    padding: 50px;
    margin-bottom: 30px; /* Reduced margin for tighter look */
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08); /* Stronger shadow */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#inpatient-details .inpatient-item:hover {
    transform: translateY(-5px); /* Lift effect on hover */
    box-shadow: 0 12px 35px rgba(0,0,0,0.15); /* Stronger shadow on hover */
}

/* Alternating background colors for inpatient items */
#inpatient-details .inpatient-item:nth-child(odd) {
    background-color: var(--soft-blue);
}

#inpatient-details .inpatient-item:nth-child(even) {
    background-color: var(--white);
}

#inpatient-details .inpatient-item h3 {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: var(--primary-color);
}

#inpatient-details .inpatient-item i {
    margin-right: 15px;
    color: var(--accent-color);
}

/* Nutrition Details */
#nutrition-details .nutrition-item {
    background: var(--white);
    padding: 50px;
    margin-bottom: 30px; /* Reduced margin for tighter look */
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08); /* Stronger shadow */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#nutrition-details .nutrition-item:hover {
    transform: translateY(-5px); /* Lift effect on hover */
    box-shadow: 0 12px 35px rgba(0,0,0,0.15); /* Stronger shadow on hover */
}

/* Alternating background colors for nutrition items */
#nutrition-details .nutrition-item:nth-child(odd) {
    background-color: var(--soft-blue);
}

#nutrition-details .nutrition-item:nth-child(even) {
    background-color: var(--white);
}

#nutrition-details .nutrition-item h3 {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: var(--primary-color);
}

#nutrition-details .nutrition-item i {
    margin-right: 15px;
    color: var(--accent-color);
}

/* Outpatient Page Specifics */
.outpatient-tab-section {
    padding: 80px 0;
}

.tab-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 40px;
}

.tab-link {
    padding: 1rem 1.5rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--secondary-color);
    position: relative;
    transition: color 0.3s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px; /* Align with parent border */
}

.tab-link:hover {
    color: var(--primary-color);
}

.tab-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-link i {
    margin-right: 8px;
}

.tab-content-area {
    padding-top: 20px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s;
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.tab-content.active {
    display: block;
}

.tab-content h3 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.tab-content p {
    font-size: 1.1rem;
    line-height: 1.8;
}

.service-detail-section {
    padding: 60px 0;
    border-bottom: 1px solid #eee;
}

.service-detail-section:nth-of-type(odd) {
    background-color: var(--soft-blue);
}

.service-detail-section:nth-of-type(even) {
    background-color: var(--white);
}

.service-detail-section h3 {
    text-align: center;
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 30px;
}

.service-detail-section p {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    font-size: 1.1rem;
}


#inpatient-details .inpatient-item ol {
    list-style: none;
    padding: 0;
    margin-top: 25px;
}

#inpatient-details .inpatient-item ol li {
    margin-bottom: 15px;
    position: relative;
    padding-left: 40px;
    font-size: 1.1rem;
}

#inpatient-details .inpatient-item ol li::before {
    content: counter(step-counter);
    background: var(--primary-color);
    color: var(--white);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    left: 0;
    top: 0;
    font-weight: 700;
}

/* Footer */
footer {
    background: var(--dark-background);
    color: var(--light-background);
    padding: 60px 0;
    text-align: center;
    font-size: 1rem;
}

footer p {
    margin: 0;
}

/* Back to top button */
#back-to-top {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: var(--primary-color);
    color: #fff;
    width: 45px;
    height: 45px;
    text-align: center;
    line-height: 45px;
    border-radius: 50%;
    display: none;
    z-index: 999;
    transition: all 0.3s ease;
    box-shadow: 0 5px 10px rgba(0, 123, 255, 0.3);
}

#back-to-top:hover {
    background: var(--accent-color);
    transform: scale(1.1);
}

/* --- Mobile Responsiveness --- */

/* Hamburger Menu Icon */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: var(--primary-color);
    border-radius: 3px;
    transition: all 0.3s ease;
}

@media (max-width: 1024px) {
    header .container {
        padding: 0.4rem 15px;
    }

    .header-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }

    header h1 {
        font-size: 0.9rem;
    }

    header h1 br {
        display: none; /* Keep clinic name on one line if possible */
    }

    .header-phone {
        font-size: 0.85rem;
    }

    .menu-toggle {
        display: flex;
    }

    nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 75%;
        height: 100vh;
        background: white;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        padding: 60px 30px;
        transition: right 0.4s ease;
        overflow-y: auto;
    }

    nav.active {
        right: 0;
    }

    nav ul {
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
    }

    nav ul li {
        margin: 10px 0;
        width: 100%;
        border-bottom: 1px solid #f0f0f0;
        padding-bottom: 8px;
    }

    nav a {
        font-size: 1rem;
        display: block;
        width: 100%;
    }

    .nav-reserve-btn, .nav-homecare-btn {
        margin-left: 0 !important;
        margin-top: 5px !important;
        display: block !important;
        width: 100% !important;
        padding: 10px !important;
        font-size: 0.95rem !important;
        text-align: center;
        border-radius: 5px !important;
    }

    /* Menu Open Animation */
    .menu-toggle.active span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }
    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.active span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }
}

@media (max-width: 768px) {
    section {
        padding: 60px 0;
    }

    section h2.section-title {
        font-size: 2rem;
        margin-bottom: 40px;
    }

    #hero {
        padding: 80px 15px 60px 15px;
        min-height: 60vh;
    }

    #hero .content {
        padding: 40px 20px;
    }

    #hero h2 {
        font-size: 1.8rem;
    }

    #hero p {
        font-size: 1rem;
    }

    .button {
        padding: 12px 25px;
        width: 100%;
        margin-bottom: 10px;
        margin-right: 0 !important;
    }

    .services-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .news-list li {
        flex-direction: column;
    }

    .news-date {
        margin-bottom: 5px;
    }

    /* Clinic Hours Table Mobile */
    .hours-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    #stats .container {
        flex-direction: column;
    }

    .stat {
        margin: 10px 0;
    }

    .stat h3 {
        font-size: 2.5rem;
    }

    /* Contact Grid */
    #contact-details .contact-grid {
        grid-template-columns: 1fr;
    }
}

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

