/*
Theme Name: BTLabs
Description: A modern WordPress theme inspired by Japanese samurai culture and origami aesthetics for Barrack Technology Labs
Version: 1.0
Author: Barrack Technology Labs
Text Domain: bt-labs-theme
*/

/* Import Google Fonts for Japanese aesthetic */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700&family=Playfair+Display:wght@400;700&display=swap');

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

body {
    font-family: 'Noto Sans JP', 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: #4a4a4a; /* Dark grey for normal text */
    background-color: #ffffff;
    overflow-x: hidden;
}

/* Loading Animation */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d1b1b 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-animation {
    position: relative;
    display: inline-block;
}

.loading-image {
    max-width: 150px;
    max-height: 150px;
    width: auto;
    height: auto;
}

.loading-text {
    color: #f5f5f5;
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    letter-spacing: 2px;
    text-align: center;
}

/* Rotation Style */
.loading-rotation .loading-image {
    animation: rotate360 2s linear infinite;
}

@keyframes rotate360 {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Spinning Style (spin around Y axis) */
.loading-spinning .loading-image {
    animation: spin3D 2s linear infinite;
}

@keyframes spin3D {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}

/* Flashing Style */
.loading-flashing .loading-image {
    animation: fadeInOut 2s ease-in-out infinite;
}

.loading-flashing .loading-image-2 { animation-delay: 0.4s; opacity: 0; }
.loading-flashing .loading-image-3 { animation-delay: 0.8s; opacity: 0; }
.loading-flashing .loading-image-4 { animation-delay: 1.2s; opacity: 0; }
.loading-flashing .loading-image-5 { animation-delay: 1.6s; opacity: 0; }

@keyframes fadeInOut {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Spin & Flash Style */
.loading-spin_flash .loading-spin-image {
    animation: spinAndFade 2s linear infinite;
}

@keyframes spinAndFade {
    0%, 19.99% { 
        transform: rotateY(0deg);
        opacity: 1;
    }
    20%, 100% { 
        transform: rotateY(360deg);
        opacity: 0;
    }
}

/* Gradual Style - Image fades in with transparency */
.loading-gradual .loading-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.loading-bar-container {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 10px;
}

.loading-bar {
    height: 100%;
    background: linear-gradient(90deg, #8b0000, #dc3545);
    width: 0%;
    transition: width 0.3s ease;
}

/* Fixed Style - Image appears and stays */
.loading-fixed .loading-image {
    opacity: 1;
    animation: none;
}

/* Percentage Text Animation */
.loading-percentage {
    display: inline-block;
}

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

/* Header */
.site-header {
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(139, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid #8b0000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Fallback for browsers without :has() support */
.site-branding:has(.site-logo-emblem) {
    gap: 1rem;
}

.site-branding:not(:has(.site-logo-emblem)) {
    gap: 0;
}

/* Alternative approach for better browser support */
.site-branding-text:only-child {
    margin-left: 0;
}

.site-logo-emblem {
    width: 50px;
    height: 50px;
    background: #8b0000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f5f5f5;
    font-weight: bold;
    font-size: 1.2rem;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.site-logo-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Custom logo styling for uploaded images */
.site-branding .custom-logo-link {
    display: block;
    max-height: 60px;
    width: auto;
    text-decoration: none;
}

.site-branding .custom-logo-link img {
    max-height: 60px;
    width: auto;
    border-radius: 8px;
    display: block;
    object-fit: contain;
}

.default-emblem {
    font-family: 'Noto Sans JP', sans-serif;
}

.site-title {
    margin: 0;
}

.site-title a {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: #2c2c2c;
    text-decoration: none;
    letter-spacing: 1px;
}

.site-title a:hover {
    color: #8b0000;
    transition: color 0.3s ease;
}

.site-description {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
    font-weight: 300;
    letter-spacing: 0.5px;
}

/* Navigation */
.main-navigation {
    position: relative;
}

.main-navigation ul {
    list-style: none;
    display: flex;
    gap: 2.5rem;
    align-items: center;
}


.main-navigation li {
    position: relative;
}

.main-navigation a {
    text-decoration: none;
    color: #4a4a4a;
    font-weight: 500;
    font-size: 1rem;
    letter-spacing: 0.5px;
    position: relative;
    transition: all 0.3s ease;
    padding: 0.5rem 0;
    display: inline-block;
}

.main-navigation a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: #8b0000;
    transition: width 0.3s ease;
}

.main-navigation > ul > li > a:hover,
.main-navigation > ul > li > a.active {
    color: #8b0000;
}

.main-navigation > ul > li > a:hover::after,
.main-navigation > ul > li > a.active::after {
    width: 100%;
}

/* Submenu Styles */
.main-navigation .sub-menu {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    min-width: 220px;
    background: white;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 0.5rem 0;
    display: none;
    flex-direction: column;
    gap: 0;
    z-index: 1000;
    border-top: 3px solid #8b0000;
}

.main-navigation li:hover > .sub-menu {
    display: flex;
}

.main-navigation .sub-menu li {
    width: 100%;
}

.main-navigation .sub-menu a {
    padding: 0.5rem 1rem;
    color: #4a4a4a;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.main-navigation .sub-menu a::after {
    display: none;
}

.main-navigation .sub-menu a:hover {
    background: #f8f9fa;
    color: #8b0000;
    padding-left: 1.25rem;
}

/* Menu item with submenu indicator */
.main-navigation .menu-item-has-children > a::before {
    content: '▾';
    margin-left: 0.5rem;
    font-size: 0.8rem;
}

/* Main Content */
.site-main {
    padding: 2rem 0;
}

.content-area {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    margin-bottom: 2rem;
}

.content-area-full {
    max-width: 100%;
}

/* Posts and Pages */
.post, .page {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.post-title, .page-title {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.post-meta {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.post-content {
    line-height: 1.8;
}

.post-content p {
    margin-bottom: 1rem;
}

.post-content h2 {
    color: #2c3e50;
    margin: 2rem 0 1rem 0;
    font-size: 1.5rem;
}

.post-content h3 {
    color: #34495e;
    margin: 1.5rem 0 0.5rem 0;
    font-size: 1.25rem;
}

/* Sidebar */
.sidebar {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    height: fit-content;
}

.widget {
    margin-bottom: 2rem;
}

.widget-title {
    color: #2c3e50;
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #8b0000;
}

/* Footer */
.site-footer {
    background: transparent;
    color: #2c3e50;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-widget h3 {
    color: #8b0000;
    margin-bottom: 1rem;
}

.footer-widget a {
    color: #2c3e50;
    text-decoration: none;
}

.footer-widget a:hover {
    color: #8b0000;
}

.site-info {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e9ecef;
    color: #2c3e50;
}

.site-info a {
    color: #8b0000;
    text-decoration: none;
}

.site-info a:hover {
    color: #2c3e50;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.875rem 2rem;
    background: #8b0000;
    color: #f5f5f5;
    text-decoration: none;
    border-radius: 25px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(139, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    background: #a00000;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #4a4a4a;
    box-shadow: 0 4px 15px rgba(74, 74, 74, 0.2);
}

.btn-secondary:hover {
    background: #333333;
    box-shadow: 0 6px 20px rgba(74, 74, 74, 0.3);
}

.btn-primary {
    background: #8b0000;
}

.btn-outline {
    background: transparent;
    color: #8b0000;
    border: 2px solid #8b0000;
    box-shadow: none;
}

.btn-outline:hover {
    background: #8b0000;
    color: #f5f5f5;
    box-shadow: 0 4px 15px rgba(139, 0, 0, 0.2);
}

/* Responsive Design */
@media screen and (max-width: 1024px) {
    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        position: relative;
    }
    
    .site-branding {
        flex: 1;
    }
    
    .main-navigation {
        position: static;
    }
    
    .menu-toggle {
        display: block !important; /* DEBUG: Force display on mobile */
        order: 2;
        position: relative !important;
        z-index: 9999 !important;
        background: #ffffff !important; /* White background */
        border: none !important; /* Transparent border */
        min-width: 50px !important;
        min-height: 50px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .main-navigation ul {
        display: flex;
        flex-direction: column;
        gap: 0;
        text-align: left;
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: #fff;
        box-shadow: -4px 0 20px rgba(0,0,0,0.15);
        padding: 2rem 1.5rem;
        z-index: 999;
        transition: right 0.3s ease-in-out;
        overflow-y: auto;
        border-left: 3px solid #8b0000;
    }
    
    .main-navigation ul.active {
        right: 0 !important; /* Slide menu in from right */
        border-left: 3px solid #8b0000 !important; /* Dark red left border */
    }
    
    .main-navigation li {
        border-bottom: 1px solid #f0f0f0;
        padding: 0.5rem 0;
    }
    
    .main-navigation li:last-child {
        border-bottom: none;
    }
    
    .main-navigation a {
        padding: 1rem 0;
        display: block;
        font-size: 1.2rem;
        font-weight: 500;
        color: #333;
        text-decoration: none;
        transition: color 0.3s ease, padding-left 0.3s ease;
    }
    
    .main-navigation a:hover {
        color: #8b0000;
        padding-left: 1rem;
    }
    
    .main-navigation .sub-menu {
        position: static;
        box-shadow: none;
        border-top: none;
        border-left: 3px solid #8b0000;
        margin-left: 1rem;
        padding: 0.5rem 0;
    }
    
    .main-navigation li:hover > .sub-menu,
    .main-navigation .sub-menu.active {
        display: flex;
    }
    
    .main-navigation .menu-item-has-children > a::before {
        content: '▸';
        margin-left: 0;
        margin-right: 0.5rem;
    }
    
    /* Mobile menu backdrop */
    .mobile-menu-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .mobile-menu-backdrop.active {
        opacity: 1;
        visibility: visible;
    }
    
    .content-area {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .post, .page, .sidebar {
        padding: 1.5rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .post-navigation {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-next {
        text-align: left;
    }
}

/* Mobile Menu Styles */
.menu-toggle {
    display: none;
    background: #ffffff;
    border: none;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    position: relative;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.menu-toggle:hover {
    background-color: #f5f5f5;
}

.menu-toggle-icon {
    display: flex;
    flex-direction: column;
    width: 30px;
    height: 24px;
    justify-content: space-between;
}

.menu-toggle-icon span {
    background: #8b0000;
    height: 3px;
    width: 100%;
    transition: all 0.3s ease;
    border-radius: 2px;
    transform-origin: center;
}

.menu-toggle.active .menu-toggle-icon span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.menu-toggle.active .menu-toggle-icon span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .menu-toggle-icon span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* DEBUG: Force mobile menu toggle visibility - Highest Priority */
@media screen and (max-width: 1024px) {
    .menu-toggle {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        background: #ffffff !important;
        border: none !important;
        width: 50px !important;
        height: 50px !important;
        position: relative !important;
        z-index: 99999 !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
}

/* Responsive logo sizing */
@media (max-width: 768px) {
    .site-branding .custom-logo-link {
        max-height: 45px;
    }
    
    .site-branding .custom-logo-link img {
        max-height: 45px;
    }
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: #8b0000;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #a00000;
    transform: translateY(-2px);
}

/* Form Validation Styles */
.form-group input.error,
.form-group textarea.error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

.error-message {
    color: #e74c3c;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Loading States */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

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

/* Post Navigation */
.post-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

.nav-previous,
.nav-next {
    flex: 1;
}

.nav-next {
    text-align: right;
}

.nav-previous a,
.nav-next a {
    display: block;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    transition: background 0.3s ease;
}

.nav-previous a:hover,
.nav-next a:hover {
    background: #e9ecef;
}

.nav-subtitle {
    display: block;
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.nav-title {
    font-weight: 500;
    color: #2c3e50;
}

/* Comments Section */
.comments-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

.comments-title {
    color: #2c3e50;
    margin-bottom: 1.5rem;
}

.comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.comment {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.comment-meta {
    color: #6c757d;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.comment-author {
    font-weight: 500;
    color: #2c3e50;
}

.comment-content {
    margin-top: 1rem;
    line-height: 1.6;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.p-1 { padding: 1rem; }
.p-2 { padding: 2rem; }
