/* Common styles for all web apps - Updated version matching main tools design */

:root {
    /* PlayStation inspired color palette - matching main tools */
    --primary-dark: #002B5B;
    --primary-darker: #001F3F;
    --accent-blue: #4A90E2;
    --accent-purple: #6A5ACD;
    --white: #FFFFFF;
    --gray-light: #F5F7FA;
    --gray: #94A3B8;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    
    /* Fonts */
    --font-primary: 'Orbitron', 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Changa One', 'Orbitron', sans-serif;
}

.app-body {
    font-family: var(--font-primary);
    color: var(--text-primary);
    background: var(--white);
    padding-top: 0; /* Remove padding - header is positioned fixed */
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
    min-height: 100vh;
    margin: 0;
}

/* Fixed navigation header - matching main tools */
.nav-menu {
    position: fixed !important;
    top: 16px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    display: grid !important;
    grid-template-columns: 200px 1fr 100px !important;
    align-items: center !important;
    gap: 24px !important;
    min-height: 56px !important;
    padding: 0 24px !important;
    border-radius: 28px !important;
    backdrop-filter: blur(20px) !important;
    background: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
    z-index: 1000 !important;
    max-width: 1200px !important;
    width: calc(100% - 32px) !important;
    opacity: 1 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.nav-logo {
    display: flex !important;
    align-items: center !important;
    height: 40px !important;
    position: relative !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
}

.nav-logo img {
    height: 40px !important;
    width: auto !important;
    filter: brightness(0.2) !important;
    opacity: 0.85 !important;
    transition: all 0.3s ease !important;
    display: block !important;
}

.nav-logo:hover img {
    opacity: 1;
    transform: translateX(2px);
}

.nav-center {
    display: flex;
    gap: 32px;
    justify-content: center;
}

.nav-menu a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.5rem 0;
}

.nav-menu a:not(.nav-logo)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent-blue);
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.nav-menu a:hover {
    color: var(--accent-blue);
}

.nav-menu a:not(.nav-logo):hover::after {
    width: 100%;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-end;
}

/* Language toggle button */
.app-lang-toggle {
    background: white;
    border: 2px solid var(--accent-blue);
    border-radius: 20px;
    padding: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.app-lang-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.app-lang-toggle span {
    padding: 4px 10px;
    border-radius: 14px;
    transition: all 0.3s ease;
    display: inline-block;
}

.lang-ja, .lang-en {
    background: transparent;
    color: var(--text-secondary);
}

body[data-locale="ja"] .lang-ja,
.app-lang-toggle[data-active="ja"] .lang-ja {
    background: var(--accent-blue);
    color: white;
}

body[data-locale="en"] .lang-en,
.app-lang-toggle[data-active="en"] .lang-en {
    background: var(--accent-blue);
    color: white;
}

/* Hamburger menu for mobile */
.app-hamburger-menu,
.hamburger-menu {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    margin-left: 8px;
}

.app-hamburger-menu span,
.hamburger-menu span {
    width: 100%;
    height: 3px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

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

.app-hamburger-menu.active span:nth-child(2),
.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.app-hamburger-menu.active span:nth-child(3),
.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile menu overlay */
.app-mobile-menu-overlay,
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    width: 320px;
    max-width: 90%;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 999;
    padding: 80px 20px 20px;
    overflow-y: auto;
}

.app-mobile-menu-overlay.active,
.mobile-menu-overlay.active {
    right: 0;
}

.app-mobile-menu-overlay a,
.mobile-menu-overlay a {
    display: block;
    padding: 15px 0;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

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

/* App Header Section - Updated design */
.app-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 24px 32px;
    margin-bottom: 24px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    text-align: left;
}

.app-title-section {
    display: block;
    margin-bottom: 16px;
    text-align: left;
}

.app-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    margin: 0 0 12px 0;
    padding: 0;
    background: linear-gradient(135deg, var(--primary-dark), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
    text-align: left;
    line-height: 1.2;
    font-weight: 700;
}

.app-meta {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.app-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.app-version {
    padding: 4px 12px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    border-radius: 20px;
    font-weight: 600;
}

.app-description {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
    padding: 0;
    max-width: 800px;
    text-align: left;
}

/* Quick Access Controls - Updated styling */
.app-controls {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.control-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-control {
    padding: 10px 20px;
    border-radius: 8px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    background: white;
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-primary);
}

.btn-control:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(74, 144, 226, 0.3);
    border-color: var(--accent-blue);
}

.btn-control.primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    border: none;
}

.btn-control.primary:hover {
    box-shadow: 0 15px 40px rgba(74, 144, 226, 0.4);
}

.btn-control.active {
    background: var(--primary-dark);
    color: white;
    border-color: var(--primary-dark);
}

/* Main App Canvas */
.app-canvas {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    min-height: 600px;
    padding: 0;
    margin-bottom: 24px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    position: relative;
}

/* Info Panel - Updated styling */
.app-info-panel {
    background: linear-gradient(135deg, var(--white) 0%, var(--gray-light) 100%);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.info-toggle {
    width: 100%;
    padding: 16px 24px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-primary);
}

.info-toggle:hover {
    background: rgba(74, 144, 226, 0.05);
}

.info-content {
    padding: 0 36px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.info-content.show {
    max-height: 2000px;
    padding: 20px 36px 24px;
    overflow: visible;
}

.info-content h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--primary-dark);
    font-weight: 700;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .app-hamburger-menu,
    .hamburger-menu {
        display: flex;
        width: 30px;
        height: 24px;
        margin-left: 4px;
        margin-right: 0;
    }
    
    .nav-center {
        display: none;
    }
    
    .nav-menu {
        grid-template-columns: auto 1fr auto !important;
        padding: 0 12px !important;
        min-height: 56px !important;
        top: 8px !important;
        border-radius: 28px !important;
        gap: 8px !important;
    }
    
    .nav-logo {
        height: 32px !important;
    }
    
    .nav-logo img {
        height: 32px !important;
    }
    
    .nav-actions {
        display: flex;
        gap: 6px;
        justify-content: flex-end;
        align-items: center;
        margin-right: -4px;
    }
    
    .app-body {
        padding-top: 0;
    }
    
    .app-container {
        padding: 12px;
        margin-top: 70px;
    }
    
    .app-header {
        padding: 20px;
    }
    
    .app-title {
        font-size: 1.5rem;
    }
    
    .app-meta {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .app-controls {
        padding: 16px;
        gap: 12px;
        flex-direction: column;
    }
    
    .control-group {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .app-canvas {
        min-height: 400px;
    }
    
    /* Make tool cards more compact on mobile */
    .btn-control {
        font-size: 12px;
        padding: 8px 16px;
    }
    
    .app-description {
        font-size: 14px;
    }
}

/* Loading state */
.app-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
}

.app-loading::after {
    content: '';
    width: 48px;
    height: 48px;
    border: 4px solid rgba(74, 144, 226, 0.1);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* References section */
.app-references {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.app-references h4 {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.app-references p {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
    opacity: 0.7;
}

.app-references a {
    color: var(--text-muted);
    text-decoration: underline;
}

.app-references a:hover {
    color: var(--text-secondary);
}