/* Reset and Basic Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3A4965;
    --accent-color: #f9d893;
    --text-light: #ffffff;
    --text-dark: #333333;
    --section-spacing: 100px;
    --border-radius: 15px;
    --shadow-light: 0 5px 15px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-heavy: 0 15px 35px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: #f9f9f9;
    overflow-x: hidden;
}

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

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5em;
    font-weight: 700;
    line-height: 1.2;
}

p {
    margin-bottom: 1.5rem;
}

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

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

/* Header Styles */
header {
    background-color: var(--primary-color);
    padding: 0;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
    box-shadow: var(--shadow-medium);
    height: 100px;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.logo img {
    height: 80px;
}

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin-left: 25px;
}

nav ul li a {
    color: var(--text-light);
    font-weight: 500;
    font-size: 1rem;
    position: relative;
    transition: all 0.3s ease;
}

nav ul li a.active {
    color: var(--accent-color);
}

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

nav ul li a:hover,
nav ul li a.active {
    color: var(--accent-color);
}

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

/* Hero Section Styles */
#hero {
    background: linear-gradient(rgba(58, 73, 101, 0.7), rgba(58, 73, 101, 0.7)), url('/images/Futuristic Medical Robotics_simple_compose.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: var(--text-light);
    padding: 150px 0 100px;
    text-align: center;
}

#hero h1 {
    font-size: 3.5rem;
    margin-top: 50px;
    margin-bottom: 1rem;
    color: var(--accent-color);
    font-weight: 700;
    line-height: 1.2;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.hero-subtitle {
    font-size: 1.3rem;
    color: var(--text-light);
    margin-bottom: 0;
    opacity: 0.9;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
}

/* Common Section Styles */
section {
    padding: var(--section-spacing) 0;
}

section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--primary-color);
    position: relative;
    padding-bottom: 15px;
}

section h2:after {
    content: '';
    position: absolute;
    width: 80px;
    height: 3px;
    background: var(--accent-color);
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

/* Business Overview Section */
#business-overview {
    background-color: #ffffff;
}

.overview-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: stretch;
    min-height: 500px;
}

.text-content {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.business-text {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.business-text.active {
    opacity: 1;
    transform: translateY(0);
    position: relative;
}

.business-text h2 {
    text-align: left;
    font-size: 2.2rem;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

.business-text h2:after {
    width: 60px;
    left: 0;
    transform: none;
}

.business-text p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #555;
    margin-bottom: 1.5rem;
}

/* Image Viewer Styles */
.image-viewer {
    position: relative;
    background: #f8f8f8;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-medium);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.image-container {
    position: relative;
    height: 400px;
    overflow: hidden;
    flex: 1;
}

.image-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.6s ease;
    min-height: 200px; /* 確保容器有最小高度 */
}

.image-slide.active {
    opacity: 1;
}

.image-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block; /* 確保圖片是block */
    min-height: 200px; /* 確保最小高度 */
    background: #eee; /* 沒載入時也能看見底色 */
}

.image-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    flex-shrink: 0;
}

.control-btn {
    background: var(--primary-color);
    color: var(--text-light);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: var(--accent-color);
    color: var(--primary-color);
    transform: scale(1.1);
}

.image-indicators {
    display: flex;
    gap: 10px;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
}

.indicator.active {
    background: var(--primary-color);
    transform: scale(1.3);
}

.indicator:hover {
    background: var(--accent-color);
}

/* Brand Timeline Section */
#brand-timeline {
    background-color: #f8f8f8;
    position: relative;
}

/* Brand portfolio intro and meta */
#brand-timeline .brand-intro {
    max-width: 840px;
    margin: 0 auto 2.5rem;
    text-align: center;
    color: #666;
    font-size: 1.05rem;
    line-height: 1.7;
}

.brand-meta {
    font-size: 0.95rem;
    font-weight: 500;
    color: #444;
    margin-bottom: 1rem;
}

.timeline-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 60px;
    align-items: start;
}

.timeline-sidebar {
    position: sticky;
    top: 120px;
    height: fit-content;
}

.timeline-track {
    position: relative;
    padding: 40px 0;
}

.timeline-track::before {
    content: '';
    position: absolute;
    left: 40px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--primary-color), var(--accent-color));
    border-radius: 2px;
}

.brand-node {
    position: relative;
    display: flex;
    align-items: center;
    margin: 40px 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.brand-node:hover {
    transform: scale(1.02);
}

.brand-node.active {
    transform: scale(1.05);
}

.node-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #ffffff;
    border: 4px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-medium);
    transition: all 0.3s ease;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.brand-node.active .node-circle {
    transform: scale(1.1);
}

.node-circle img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.node-label {
    margin-left: 20px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.brand-node.active .node-label {
    color: var(--accent-color);
    font-size: 1.1rem;
    font-weight: 700;
}

/* Brand Content */
.brand-content {
    position: relative;
    min-height: 500px;
}

.brand-detail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.6s ease;
    background: #ffffff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    overflow: hidden;
}

.brand-detail.active {
    opacity: 1;
    transform: translateX(0);
    position: relative;
}

.brand-detail .brand-image {
    height: 250px;
    overflow: hidden;
}

.brand-detail .brand-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.brand-detail:hover .brand-image img {
    transform: scale(1.05);
}

.brand-info {
    padding: 30px;
}

.brand-info h3 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 15px;
    position: relative;
    padding-bottom: 10px;
}

.brand-info h3:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: var(--accent-color);
}

.brand-info p {
    color: #666;
    line-height: 1.7;
    margin-bottom: 15px;
}

.brand-features {
    list-style: none;
    margin-top: 20px;
}

.brand-features li {
    position: relative;
    padding: 8px 0 8px 25px;
    color: #555;
    font-weight: 500;
}

.brand-features li:before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1.1rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #ffffff;
    margin: 5% auto;
    padding: 0;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    right: 20px;
    top: 15px;
    z-index: 2001;
    cursor: pointer;
    transition: color 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close:hover,
.close:focus {
    color: var(--primary-color);
}

.modal-body {
    padding: 30px;
}

#modal-brand-image {
    margin-bottom: 20px;
}

#modal-brand-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--border-radius);
}

#modal-brand-info h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 15px;
}

#modal-brand-description {
    color: #666;
    line-height: 1.6;
}

/* Footer Styles */
footer {
    background-color: var(--primary-color);
    color: var(--text-light);
    padding: 60px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h3 {
    color: var(--accent-color);
    font-size: 1.3rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section ul li a {
    color: var(--text-light);
    font-size: 0.95rem;
    transition: color 0.3s ease;
    opacity: 0.8;
}

.footer-section ul li a:hover {
    color: var(--accent-color);
    opacity: 1;
}

/* Contact Information Styles */
.footer-contact .contact-details {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.contact-icon {
    font-size: 1.2rem;
    margin-top: 2px;
    flex-shrink: 0;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.contact-label {
    font-size: 0.85rem;
    color: var(--accent-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.contact-value {
    font-size: 0.95rem;
    color: var(--text-light);
    opacity: 0.9;
    line-height: 1.4;
}

.contact-link {
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.3s ease;
    opacity: 0.9;
}

.contact-link:hover {
    color: var(--accent-color);
    opacity: 1;
    text-decoration: underline;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 20px;
    text-align: center;
}

.footer-bottom p {
    margin: 0;
    opacity: 0.8;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .overview-content {
        gap: 40px;
    }
    
    .timeline-content {
        grid-template-columns: 250px 1fr;
        gap: 40px;
    }
    
    .timeline-sidebar {
        top: 110px;
    }
    
    .timeline-track::before {
        left: 30px;
    }
    
    .node-circle {
        width: 70px;
        height: 70px;
    }
    
    .node-circle img {
        width: 50px;
        height: 50px;
    }
    
    .node-label {
        font-size: 0.9rem;
    }

    /* Contact Information Tablet Styles */
    .footer-contact .contact-details {
        gap: 18px;
    }

    .contact-item {
        gap: 11px;
    }

    .contact-label {
        font-size: 0.82rem;
    }

    .contact-value {
        font-size: 0.92rem;
    }
}

@media (max-width: 768px) {
    /* Header */
    nav ul {
        display: none;
    }
    
    header .container {
        padding: 0 10px 0 0;
    }
    
    .logo {
        margin-left: -10px;
    }
    
    /* Hero */
    #hero h1 {
        font-size: 2.8rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    /* Sections */
    section h2 {
        font-size: 2rem;
    }
    
    /* Business Overview */
    .overview-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 30px;
        min-height: auto;
    }
    
    .image-viewer {
        order: 1;
        width: 100%;
        height: auto;
    }
    
    .text-content {
        order: 3; /* 圖片在上，文字在下 */
        width: 100%;
        padding: 0 15px;
    }
    
    .business-text {
        display: none;
        opacity: 0;
        transform: translateY(20px);
        transition: all 0.5s ease;
        position: relative;
        height: auto;
    }
    
    .business-text.active {
        display: block;
        opacity: 1;
        transform: translateY(0);
        padding: 20px;
        background: #fff;
        border-radius: var(--border-radius);
        box-shadow: var(--shadow-light);
        margin-top: 20px;
    }
    
    .business-text h2 {
        font-size: 1.8rem;
    }
    
    .image-container {
        height: 200px;
        min-height: 200px; /* 確保最小高度 */
        background: #f5f5f5; /* 背景色用於調試 */
    }
    
    .image-controls {
        order: 2;
        justify-content: center;
        padding: 15px;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 10px;
    }
    
    .image-indicators {
        margin-top: 10px;
    }
    
    .control-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    /* Timeline */
    .timeline-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .timeline-sidebar {
        position: relative;
        top: auto;
        order: 1;
    }
    
    .timeline-track {
        display: flex;
        overflow-x: auto;
        padding: 20px 0;
        gap: 20px;
    }
    
    .timeline-track::before {
        display: none;
    }
    
    .brand-node {
        flex-shrink: 0;
        margin: 0;
        min-width: 120px;
        flex-direction: column;
        align-items: center;
    }
    
    .node-circle {
        width: 60px;
        height: 60px;
    }
    
    .node-circle img {
        width: 40px;
        height: 40px;
    }
    
    .node-label {
        margin-left: 0;
        margin-top: 8px;
        font-size: 0.8rem;
        text-align: center;
    }
    
    .brand-content {
        order: 2;
        min-height: auto;
    }
    
    .brand-detail .brand-image {
        height: 200px;
    }
    
    .brand-info {
        padding: 20px;
    }
    
    .brand-info h3 {
        font-size: 1.5rem;
    }
    
    /* Modal */
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    #modal-brand-image img {
        height: 150px;
    }
    
    #modal-brand-info h3 {
        font-size: 1.3rem;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 25px;
    }
    
    .footer-section h3 {
        font-size: 1.1rem;
    }
    
    .footer-section ul li a {
        font-size: 0.9rem;
    }

    /* Contact Information Mobile Styles */
    .footer-contact .contact-details {
        gap: 15px;
    }

    .contact-item {
        gap: 10px;
    }

    .contact-icon {
        font-size: 1rem;
    }

    .contact-label {
        font-size: 0.8rem;
    }

    .contact-value {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    #hero h1 {
        font-size: 2.2rem;
    }
    
    .business-text h2 {
        font-size: 1.6rem;
    }
    
    .image-container {
        height: 200px;
        min-height: 200px; /* 確保最小高度 */
        background: #f5f5f5; /* 背景色用於調試 */
    }
    
    .brand-info {
        padding: 15px;
    }
    
    .brand-info h3 {
        font-size: 1.3rem;
    }
    
    .modal-body {
        padding: 15px;
    }
}

/* Image Loading Debug Styles */
.image-slide img[src=""] {
    opacity: 0;
    background: #ffdddd;
}

.image-slide img:not([src]) {
    background: #ffdddd;
}

/* Animation Classes */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.fade-in.animate {
    opacity: 1;
    transform: translateY(0);
}

/* Loading Animation */
body {
    opacity: 0;
    transition: opacity 0.5s ease;
}

body.loaded {
    opacity: 1;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}
