/* ===============================================
   なっちゃんのAI - Custom Styles
   =============================================== */

/* ===== Base Styles ===== */
:root {
    --primary: #ED7D31;
    --primary-dark: #D66A20;
    --secondary: #4A90E2;
    --secondary-dark: #357ABD;
    --accent: #27AE60;
    --danger: #E74C3C;
    --light: #F8F9FA;
    --dark: #2C3E50;
}

* {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    overflow-x: hidden;
}

/* ===== Animations ===== */
@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-in-left {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fade-in-right {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slide-in-bottom {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse-slow {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 0.8;
    }
}

.animate-fade-in {
    animation: fade-in 1s ease-out;
}

.animate-fade-in-up {
    animation: fade-in-up 1s ease-out;
}

.animate-fade-in-left {
    animation: fade-in-left 1s ease-out;
}

.animate-fade-in-right {
    animation: fade-in-right 1s ease-out;
}

.animate-slide-in-bottom {
    animation: slide-in-bottom 0.8s ease-out;
}

/* Fade in section on scroll */
.fade-in-section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

/* ===== Header Styles ===== */
#header {
    transition: all 0.3s ease;
}

#header.scrolled {
    padding: 0.5rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* 2行/3行で切る（…） */
.line-clamp-2,
.line-clamp-3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 {
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.line-clamp-3 {
    -webkit-line-clamp: 3;
    line-clamp: 3;
}


/* Mobile menu animation */
#mobile-menu {
    max-height: 0;
    transition: max-height 0.3s ease-out;
}

#mobile-menu.show {
    max-height: 500px;
    display: block;
}

/* ===== Service Tab Styles ===== */
.service-tab {
    background-color: #f3f4f6;
    color: #4b5563;
    border: 2px solid transparent;
}

.service-tab:hover {
    background-color: #e5e7eb;
}

.service-tab.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.service-content {
    display: none;
    animation: fade-in 0.5s ease-out;
}

.service-content.active {
    display: block;
}

/* ===== FAQ Accordion Styles ===== */
.faq-item .faq-question i {
    transition: transform 0.3s ease;
}

.faq-item .faq-question.active i {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.faq-answer.show {
    max-height: 1000px;
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
}

/* ===== Button Styles ===== */
button,
a.btn {
    position: relative;
    overflow: hidden;
}

button::before,
a.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:hover::before,
a.btn:hover::before {
    width: 300px;
    height: 300px;
}

/* ===== Card Hover Effects ===== */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ===== Gradient Text ===== */
.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Scroll to Top Button ===== */
#scroll-top {
    transition: all 0.3s ease;
}

#scroll-top:hover {
    transform: translateY(-5px) scale(1.1);
}

#scroll-top.show {
    display: flex !important;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ===== Responsive Images ===== */
img {
    max-width: 100%;
    height: auto;
}

/* ===== Table Responsive ===== */
@media (max-width: 768px) {
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 0.875rem;
    }

    table th,
    table td {
        padding: 0.75rem 0.5rem;
    }
}

/* ===== Section Spacing ===== */
section {
    scroll-margin-top: 100px;
}

/* ===== Hero Section Background Animation ===== */
@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    33% {
        transform: translateY(-20px) rotate(5deg);
    }

    66% {
        transform: translateY(20px) rotate(-5deg);
    }
}

.float-animation {
    animation: float 6s ease-in-out infinite;
}

/* ===== Badge Styles ===== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 9999px;
}

.badge-primary {
    background-color: var(--primary);
    color: white;
}

.badge-secondary {
    background-color: var(--secondary);
    color: white;
}

.badge-success {
    background-color: var(--accent);
    color: white;
}

/* ===== Loading Animation ===== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* ===== Timeline Styles ===== */
.timeline-line {
    position: relative;
}

.timeline-line::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary), var(--secondary));
    transform: translateX(-50%);
}

/* ===== Chat UI Styles ===== */
.chat-bubble {
    position: relative;
    max-width: 70%;
    padding: 1rem;
    border-radius: 1rem;
    word-wrap: break-word;
}

.chat-bubble-user {
    background-color: var(--primary);
    color: white;
    border-top-right-radius: 0.25rem;
    margin-left: auto;
}

.chat-bubble-ai {
    background-color: white;
    border: 2px solid #e5e7eb;
    border-top-left-radius: 0.25rem;
    margin-right: auto;
}

/* ===== Icon Animations ===== */
.icon-bounce {
    animation: icon-bounce 2s infinite;
}

@keyframes icon-bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* ===== Print Styles ===== */
@media print {

    header,
    footer,
    #scroll-top {
        display: none;
    }

    section {
        page-break-inside: avoid;
    }
}

/* ===== Accessibility ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible for keyboard navigation */
a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* ===== Gradient Backgrounds ===== */
.gradient-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.gradient-secondary {
    background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
}

.gradient-accent {
    background: linear-gradient(135deg, var(--accent), #229954);
}

/* ===== Custom Shadows ===== */
.shadow-primary {
    box-shadow: 0 10px 25px -5px rgba(74, 144, 226, 0.3);
}

.shadow-secondary {
    box-shadow: 0 10px 25px -5px rgba(243, 156, 18, 0.3);
}

/* ===== Number Counter Animation ===== */
.counter {
    font-variant-numeric: tabular-nums;
}

/* ===== Responsive Typography ===== */
@media (max-width: 640px) {
    h1 {
        font-size: 2rem;
        line-height: 1.2;
    }

    h2 {
        font-size: 1.75rem;
        line-height: 1.3;
    }

    h3 {
        font-size: 1.5rem;
        line-height: 1.4;
    }
}

/* ===== Grid Auto Flow ===== */
.grid-auto-flow {
    grid-auto-flow: dense;
}

/* ===== Custom Select Styles ===== */
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* ===== Custom Checkbox Styles ===== */
input[type="checkbox"] {
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #d1d5db;
    border-radius: 0.25rem;
    background-color: white;
    cursor: pointer;
    position: relative;
}

input[type="checkbox"]:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

input[type="checkbox"]:checked::before {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.875rem;
    font-weight: bold;
}

/* ===== Utility Classes ===== */
.text-balance {
    text-wrap: balance;
}

.transition-smooth {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.aspect-video {
    aspect-ratio: 16 / 9;
}

.aspect-square {
    aspect-ratio: 1 / 1;
}

/* ===== Dark Mode Support (Future Enhancement) ===== */
@media (prefers-color-scheme: dark) {
    /* Dark mode styles can be added here in future updates */
}

/* ===== Performance Optimization ===== */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* ===== Backdrop Blur Support ===== */
@supports (backdrop-filter: blur(10px)) {
    .backdrop-blur {
        backdrop-filter: blur(10px);
    }
}

/* ===== Container Query Support (Future) ===== */
@container (min-width: 400px) {
    /* Container queries for more granular responsive design */
}

/* ===== Custom Underline Effect ===== */
.underline-effect {
    position: relative;
    display: inline-block;
}

.underline-effect::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.3s ease;
}

.underline-effect:hover::after {
    width: 100%;
}

/* ===== Skeleton Loading (for future use) ===== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ===== Free Highlight / Badge Styles ===== */
.free-highlight {
    position: relative;
    display: inline-block;
}

.free-highlight::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -4px;
    right: -4px;
    height: 40%;
    background: rgba(39, 174, 96, 0.15);
    z-index: -1;
    border-radius: 4px;
}

/* ===== Dynamic Counter Styles ===== */
.counter {
    font-variant-numeric: tabular-nums;
    font-family: 'Poppins', 'Noto Sans JP', sans-serif;
    letter-spacing: -0.02em;
}

.counter.counted {
    animation: counter-pop 0.3s ease-out;
}

@keyframes counter-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ===== Onboarding Flow Styles ===== */
.onboarding-step {
    transition: all 0.3s ease;
}

.onboarding-step:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
}

.onboarding-time {
    transition: all 0.3s ease;
}

.onboarding-step:hover .onboarding-time {
    transform: scale(1.05);
}

/* ===== Plan Card Styles ===== */
@media (max-width: 1023px) {
    /* On mobile/tablet, remove the scale transform to prevent overflow */
    .lg\:scale-105 {
        transform: none !important;
    }
}

/* Plan card highlight pulse for free plan */
@keyframes free-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(39, 174, 96, 0);
    }
}

/* ===== Price Comparison Table ===== */
#price table th,
#price table td {
    vertical-align: middle;
}

#price table tbody tr:hover {
    background-color: rgba(237, 125, 49, 0.03);
}

/* ===== V5 Expanded Section Styles ===== */

/* Top 20 Features Grid */
#top20 .card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.12);
}

/* Golden Ratio Section */
#golden-ratio .grid > div {
    transition: all 0.3s ease;
}

#golden-ratio .grid > div:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.2);
}

/* Security Risk Section Pulse */
#security-risk .border-t-4 {
    transition: all 0.3s ease;
}

#security-risk .border-t-4:hover {
    transform: translateY(-5px);
}

/* Speed Management Flow */
#speed-management .space-y-4 > div {
    transition: all 0.2s ease;
}

#speed-management .space-y-4 > div:hover {
    transform: translateX(5px);
}

/* HR Strategy Cards */
#hr-strategy .card-hover:hover .bg-purple-50,
#hr-strategy .card-hover:hover [class*="bg-"] p.font-bold {
    transform: scale(1.02);
}

/* Staff Voices Section */
#staff-voices .border-l-4 {
    transition: all 0.3s ease;
}

#staff-voices .border-l-4:hover {
    transform: translateX(5px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.1);
}

/* AI Essence Workflow */
#ai-essence .grid > div {
    transition: all 0.3s ease;
}

#ai-essence .grid > div:hover {
    transform: translateY(-3px);
}

/* Evolution Section */
#evolution .grid > div {
    transition: all 0.3s ease;
}

#evolution .grid > div:hover {
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
}

/* ===== Stripe Checkout Modal ===== */
#stripe-modal {
    display: none;
    align-items: center;
    justify-content: center;
    animation: modal-fade-in 0.25s ease-out;
}

#stripe-modal > div {
    animation: modal-slide-up 0.3s ease-out;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes modal-slide-up {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

#stripe-checkout-container {
    min-height: 400px;
}

/* ===== Chatbot Widget ===== */
#chatbot-toggle {
    animation: chatbot-pulse 3s ease-in-out infinite;
}

#chatbot-toggle:hover {
    animation: none;
}

#chatbot-bubble {
    animation: bubble-fade-in 0.5s ease-out 2s both;
}

@keyframes bubble-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes chatbot-pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(237, 125, 49, 0.3); }
    50% { box-shadow: 0 4px 25px rgba(237, 125, 49, 0.6); }
}

#chatbot-window {
    animation: chatbot-open 0.3s ease-out;
}

@keyframes chatbot-open {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.chatbot-msg-bot {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.chatbot-msg-bot .msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.chatbot-msg-bot .msg-bubble {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0 16px 16px 16px;
    padding: 10px 14px;
    max-width: 80%;
    font-size: 0.875rem;
    line-height: 1.5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.chatbot-msg-user {
    display: flex;
    justify-content: flex-end;
}

.chatbot-msg-user .msg-bubble {
    background: #ED7D31;
    color: #fff;
    border-radius: 16px 0 16px 16px;
    padding: 10px 14px;
    max-width: 80%;
    font-size: 0.875rem;
    line-height: 1.5;
}

.chatbot-typing .dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing-dot 1.4s infinite;
}

.chatbot-typing .dot:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-dot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

#chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

#chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

#chatbot-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

@media (max-width: 640px) {
    #chatbot-window {
        bottom: 80px;
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
    }
    #chatbot-toggle {
        bottom: 16px;
        right: 16px;
        width: 80px;
        height: 80px;
    }
}

/* ===== End of Custom Styles ===== */