/* Set consistent box-sizing within plugin container - preserve content padding */
.ts-container, .ts-container * {
    box-sizing: border-box;
}

/* Main container settings */
.ts-container {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
}

/* Tab bar styles */
.ts-container #tab-bar {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    border-bottom: thin solid #f4f4f4;
    background: #fff;
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    padding: 8px 20px;
    align-items: center;
    z-index: 99;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    scrollbar-width: none; /* Firefox */
}

.ts-container #tab-bar::-webkit-scrollbar {
    display: none;
}

/* Tab button styles */
.ts-container button.tab-button {
    all: unset;
    margin-right: 45px;
    font-weight: 600;
    color: #aaa;
    cursor: pointer;
    font-size: 14px;
    transition: color 0.2s ease;
    position: relative;
    padding: 5px 0;
}

.ts-container button.tab-button:last-child {
    margin-right: 0;
}

.ts-container button.tab-button.active {
    color: #333;
}

.ts-container button.tab-button:hover {
    color: #666;
}

.ts-container button.tab-button:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Underline animation */
.ts-container .tab-bar-underline {
    position: absolute;
    bottom: 0;
    height: 2px;
    background-color: #333;
    width: 0;
    transition: left 0.3s ease, width 0.3s ease;
    border-radius: 100vh;
}

/* Page container styles */
.ts-container .container {
    display: flex;
    overflow-x: scroll;
    overflow-y: visible;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none; /* Firefox */
    
    /* Fixed width to 100% */
    width: 100% !important;
    max-width: 100% !important;
}

.ts-container .container::-webkit-scrollbar {
    display: none;
}

/* Individual page styles */
.ts-container .page {
    flex: 0 0 100%;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    min-height: calc(100vh - 80px);
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
}

.ts-container .side-page,
.ts-container .main-page {
    background: #fff;
}

/* Content width adjustment within pages */
.ts-container .page > * {
    width: auto !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .ts-container button.tab-button {
        margin-right: 30px;
        font-size: 13px;
    }
}

@media (max-width: 600px) {
    .ts-container button.tab-button {
        margin-right: 20px;
        font-size: 12px;
    }
}

/* Theme conflict resolution - only target our container */
@media (max-width: 959px) {
    .ts-container .container {
        max-width: 100% !important;
        width: 100% !important;
    }
}

/* WordPress admin bar interference prevention */
body.admin-bar .ts-container #tab-bar {
    top: 32px; /* PC admin bar height */
}

@media (max-width: 782px) {
    body.admin-bar .ts-container #tab-bar {
        top: 46px; /* Mobile admin bar height */
    }
}

/* Smooth transitions for better UX */
.ts-container .page {
    transition: opacity 0.2s ease;
}

/* Loading state (optional) */
.ts-container.loading .page {
    opacity: 0.7;
}