/*
Theme Name: HPS Theme for Training Platform
Theme URI: https://hp-shop.co.jp/
Author: HomePageShop Inc.
Description: A custom theme for the HPS SOP Training Platform.
Version: 1.0.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background: #f0f0f1;
    color: #333;
}

.site-header {
    background: #fff;
    padding: 10px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-branding {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.site-branding .custom-logo-link img {
    max-width: 260px;
    height: auto;
}

.site-title-small {
    font-size: 14px;
    margin: 0;
    line-height: 1.2;
    font-weight: normal;
}

.site-title-small a {
    text-decoration: none;
    color: #333;
}

.site-main {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Sidebar Layout */
.site-content {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px;
    padding: 20px;
}

.hps-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: #fff;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.site-main {
    flex-grow: 1;
    margin: 0;
    /* Reset margin */
    max-width: none;
    /* Let it grow */
}

@media (max-width: 768px) {
    .site-content {
        flex-direction: column;
    }

    .hps-sidebar {
        width: 100%;
        box-sizing: border-box;
    }
}

.hps-sidebar-menu,
.hps-course-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.hps-sidebar-menu li,
.hps-course-list li {
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.sidebar-widget h3 {
    margin-top: 0;
    font-size: 1.1rem;
    /* Border handled by global rule at bottom */
    padding-bottom: 10px;
    margin-bottom: 15px;
}

a {
    color: #0073aa;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* HPS specific */
.hps-video-player {
    background: #000;
    margin-bottom: 20px;
}

.hps-video-player video {
    display: block;
    width: 100%;
}

/* Course Page */
.hps-course-header {
    margin-bottom: 40px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.hps-chapter-section {
    margin-bottom: 50px;
}

.hps-chapter-title {
    font-size: 1.5rem;
    border-left: 5px solid #0073aa;
    padding-left: 15px;
    margin-bottom: 20px;
    background: #f9f9f9;
    padding: 10px 15px;
}

.hps-lesson-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 900px) {
    .hps-lesson-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .hps-lesson-grid {
        grid-template-columns: 1fr;
    }
}

.hps-lesson-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.hps-lesson-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.hps-lesson-thumb {
    height: 0;
    padding-bottom: 56.25%;
    /* 16:9 */
    background-size: cover;
    background-position: center;
    position: relative;
    cursor: pointer;
    background-color: #000;
}

.hps-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 30px;
    /* Dashicons size is controlled by font-size */
}

.hps-play-icon .dashicons {
    font-size: 40px;
    width: 40px;
    height: 40px;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.hps-completed-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: #46b450;
    color: #fff;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: bold;
}

.hps-rewatch-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: #d63638;
    color: #fff;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: bold;
}

.hps-lesson-title {
    padding: 10px;
    margin: 0;
    font-size: 1rem;
    line-height: 1.4;
    font-weight: 500;
}

/* Lightbox */
.hps-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hps-lightbox-content {
    width: 90%;
    max-width: 900px;
    position: relative;
    background: #000;
}

.hps-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    line-height: 1;
}

.hps-video-wrapper video,
.hps-video-wrapper iframe {
    width: 100%;
    display: block;
    aspect-ratio: 16/9;
}

/* Front Page */
html.hps-front-html,
body.hps-front-page {
    height: 100%;
    margin: 0;
}

body.hps-front-page {
    background: #f0f0f1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.hps-front-container {
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
}

.hps-front-content {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    /* Login box width */
    text-align: center;
}

.hps-front-logo {
    margin-bottom: 20px;
}

.hps-logo-img {
    max-width: 240px;
    height: auto;
}

.site-title-large {
    font-size: 2rem;
    margin: 0;
    color: #333;
}

.site-title-text {
    font-size: 1.2rem;
    margin: 10px 0 30px;
    color: #666;
    font-weight: normal;
}

.hps-login-form-wrapper {
    text-align: left;
}

.hps-login-form-wrapper form {
    margin: 0;
}

.hps-login-form-wrapper label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.hps-login-form-wrapper input[type="text"],
.hps-login-form-wrapper input[type="password"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.hps-login-form-wrapper input[type="submit"] {
    width: 100%;
    padding: 10px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.hps-login-form-wrapper input[type="submit"]:hover {
    background: #005177;
}

.hps-welcome-msg {
    margin-bottom: 20px;
}

.hps-btn-large {
    display: inline-block;
    padding: 12px 24px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 1.1rem;
}

/* My Account */
.hps-page-header {
    margin-bottom: 30px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.hps-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
    height: 100%;
}

.hps-card-link:hover .hps-lesson-thumb {
    opacity: 0.9;
}

.hps-card-body {
    padding: 0;
}

.hps-card-desc {
    padding: 0 10px 15px;
    font-size: 0.9rem;
    color: #666;
}

/* Chapter Progress */
.hps-chapter-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.hps-chapter-title {
    margin-bottom: 0;
}

.hps-chapter-progress {
    font-weight: bold;
    color: #46b450;
    font-size: 1.1rem;
}

.hps-chapter-completed-banner {
    background: #46b450;
    color: #fff;
    text-align: center;
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-weight: bold;
}

.hps-chapter-footer {
    text-align: center;
    margin-top: 30px;
}

.hps-btn-test {
    background-color: #e65100;
    /* Orange/Alert color */
    color: #fff;
    font-size: 1.2rem;
    padding: 15px 40px;
    border-radius: 30px;
    text-transform: uppercase;
    font-weight: bold;
    display: inline-block;
    color: #fff;
    text-decoration: none;
    transition: background-color 0.2s;
}

.hps-btn-test:hover {
    background-color: #ff6d00;
}

.hps-btn-request-retake {
    background: #FF9800;
    /* Orange */
    color: #fff;
    padding: 15px 40px;
    text-decoration: none;
    border-radius: 30px;
    font-weight: bold;
    display: inline-block;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    text-transform: uppercase;
    transition: background-color 0.2s;
}

.hps-btn-request-retake:hover {
    background: #F57C00;
    color: #fff;
}

.hps-btn-request-retake.disabled,
.hps-btn-request-retake.processing {
    background: #ccc;
    cursor: not-allowed;
    pointer-events: none;
}

.hps-lightbox-description {
    color: #fff;
    padding: 15px;
    margin-top: 10px;
    background: #222;
    border-radius: 4px;
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ==========================================================================
   Mobile Header & Hamburger Menu
   ========================================================================== */

/* Default Desktop Styles for New Elements */
.hps-hamburger-btn {
    display: none;
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    z-index: 10001;
    /* Above menu overlay */
}

.hps-hamburger-btn span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #333;
    margin: 5px 0;
    transition: 0.3s;
}

#hps-mobile-menu,
#hps-mobile-menu-overlay {
    display: none;
    /* Hidden on desktop */
}

/* Mobile Layout (Max-Width: 768px) */
@media (max-width: 768px) {

    /* Header Layout */
    .site-header {
        flex-wrap: wrap;
        padding: 10px 16px;
        /* 16px spacing */
    }

    .site-branding {
        order: 1;
        flex: 0 0 auto;
    }

    .site-branding .custom-logo-link img {
        max-width: 180px;
        /* Resize logo for mobile */
    }

    .hps-hamburger-btn {
        display: block;
        order: 2;
        margin-left: auto;
    }

    .user-nav {
        order: 3;
        width: 100%;
        text-align: right;
        margin-top: 10px;
        font-size: 0.9rem;
        border-top: 1px solid #eee;
        padding-top: 10px;
    }

    /* Hide Default Sidebar in Content */
    .site-content .hps-sidebar {
        display: none !important;
    }

    .site-content {
        padding: 20px 16px;
        /* 16px spacing */
        margin-top: 0;
    }

    .site-main {
        margin-top: 0;
    }

    /* Hamburger Menu Styles */
    #hps-mobile-menu {
        display: block;
        /* But positioned off-canvas */
        position: fixed;
        top: 0;
        right: -90%;
        /* Hidden */
        width: 90%;
        height: 100vh;
        background: #fff;
        z-index: 999999;
        transition: right 0.3s ease-in-out;
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
    }

    #hps-mobile-menu.open {
        right: 0;
    }

    #hps-mobile-menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 10001;
    }

    #hps-mobile-menu-overlay.open {
        display: block;
    }

    .hps-mobile-menu-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px;
        background: #f9f9f9;
        border-bottom: 1px solid #eee;
    }

    .hps-mobile-menu-title {
        font-weight: bold;
        font-size: 1.1rem;
    }

    .hps-mobile-menu-close {
        background: none;
        border: none;
        font-size: 32px !important;
        line-height: 1 !important;
        cursor: pointer;
        color: #333 !important;
        padding: 5px;
        /* Flexbox handled by parent */
    }

    .hps-mobile-menu-content {
        padding: 20px;
        /* No margin-top needed if header is flex */
    }

    .hps-mobile-menu-content .hps-sidebar {
        width: 100%;
        padding: 0;
        box-shadow: none;
        display: block !important;
        /* Force show in menu */
    }
}

/* Notification Badge */
.hps-notification-badge {
    background-color: #d63638;
    color: #fff;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    vertical-align: middle;
    margin-left: 5px;
    display: inline-block;
    min-width: 10px;
    text-align: center;
    line-height: 1.2;
}

/* Force Global Widget Title Style */
.widget-title {
    margin-top: 0;
    font-size: 1.1rem;
    border-bottom: 1px solid #6b6b6b !important;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

/* =========================================
   Course Page Refactoring (Added via Agent)
   ========================================= */

/* Course Eyecatch */
.hps-course-eyecatch {
    margin-top: 15px;
    margin-bottom: 30px;
}

.hps-course-eyecatch img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* Chapter Header Flex Layout */
.hps-chapter-header {
    display: flex;
    gap: 30px;
    align-items: center;
    /* Vertically center content */
    padding-bottom: 25px;
    border-bottom: 1px solid #eee;
    margin-bottom: 30px;
}

/* If no image, block or full width flex */
.hps-chapter-header.no-image {
    display: block;
}

/* Left Column: Image (40%) */
.hps-chapter-left {
    width: 40%;
    flex-shrink: 0;
}

.hps-chapter-left img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    border-radius: 6px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

/* Right Column: Content (60%) */
.hps-chapter-right {
    flex-grow: 1;
    width: 60%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hps-chapter-header.no-image .hps-chapter-right {
    width: 100%;
}

/* Chapter Meta Information */
.hps-chapter-meta {
    margin-bottom: 5px;
}

.hps-chapter-number {
    display: block;
    font-size: 0.95rem;
    color: #666;
    font-weight: 700;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

/* Override existing Chapter Title styles within Header */
.hps-chapter-header .hps-chapter-title {
    font-size: 1.6rem;
    line-height: 1.3;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    color: #333;
}

/* Progress Section (Bottom Right aligned) */
.hps-chapter-progress-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 15px;
}

/* Responsive */
@media (max-width: 768px) {
    .hps-chapter-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .hps-chapter-left,
    .hps-chapter-right {
        width: 100%;
    }

    .hps-chapter-left {
        margin-bottom: 10px;
    }

    .hps-chapter-header .hps-chapter-title {
        font-size: 1.4rem;
    }
}