/* ================================================
   ANSWER-Lite Custom Styles
   Apple-inspired Design System
   ================================================ */

/* Global Styles & Resets
   ================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


/* Navigation Styles
   ================================================ */
.nav-item {
    position: relative;
    color: #6b7280;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item:hover {
    background-color: #f9fafb;
    color: #0e7496;
    transform: translateX(4px);
}

.nav-item.active {
    background-color: #0e7496;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(14, 116, 150, 0.25);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: linear-gradient(to bottom, #0e7496, #62A39E);
    border-radius: 0 4px 4px 0;
}


/* Page Transition Animations
   ================================================ */
.page-content {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-content.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.page-content.fade-out {
    opacity: 0;
    transform: translateY(-20px);
}

.fade-in {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Card Hover Effects (Apple-style)
   ================================================ */
.bg-white {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bg-white:hover {
    transform: translateY(-2px);
}

/* Status Card Animations */
.bg-white.rounded-xl.border.border-gray-200.shadow-sm {
    border: 1px solid #e5e7eb;
}

.bg-white.rounded-xl.border.border-gray-200.shadow-sm:hover {
    border-color: #0e7496;
    box-shadow: 0 10px 30px rgba(14, 116, 150, 0.1);
}


/* Pulse Animation
   ================================================ */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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


/* Modal Animations
   ================================================ */
.scale-up {
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.scale-up.active {
    transform: scale(1);
    opacity: 1;
}


/* Button Ripple Effect
   ================================================ */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    animation: ripple-animation 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}


/* Smooth Scrollbar
   ================================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}


/* Input Focus States (Apple-style)
   ================================================ */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #0e7496;
    box-shadow: 0 0 0 3px rgba(14, 116, 150, 0.1);
    transition: all 0.2s ease;
}

input[type="checkbox"]:checked {
    background-color: #0e7496;
    border-color: #0e7496;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0e7496;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(14, 116, 150, 0.3);
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(14, 116, 150, 0.4);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0e7496;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(14, 116, 150, 0.3);
    transition: all 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(14, 116, 150, 0.4);
}


/* Glass Morphism Effect (Modern Apple Design)
   ================================================ */
.glass-effect {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}


/* Button Hover States
   ================================================ */
button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}


/* Table Row Animations
   ================================================ */
tbody tr {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

tbody tr:hover {
    background-color: #f9fafb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}


/* Badge Animations
   ================================================ */
.badge-pulse {
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}


/* Loading Spinner
   ================================================ */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}


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

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


/* Chart Line Animation
   ================================================ */
.chart-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: draw-line 2s ease-in-out forwards;
}

@keyframes draw-line {
    to {
        stroke-dashoffset: 0;
    }
}


/* Gradient Text Effect
   ================================================ */
.gradient-text {
    background: linear-gradient(135deg, #0e7496, #62A39E);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


/* Card Shine Effect (Premium Apple Feel)
   ================================================ */
.card-shine {
    position: relative;
    overflow: hidden;
}

.card-shine::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    transition: all 0.6s ease;
}

.card-shine:hover::before {
    left: 100%;
}


/* Tooltip
   ================================================ */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    font-size: 12px;
    white-space: nowrap;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}


/* Responsive Adjustments
   ================================================ */
@media (max-width: 768px) {
    aside {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    aside.open {
        transform: translateX(0);
    }

    main {
        margin-left: 0;
    }

    .page-content {
        padding: 1rem;
    }
}


/* Print Styles
   ================================================ */
@media print {
    header,
    aside,
    footer,
    button {
        display: none;
    }

    main {
        margin: 0;
    }

    .page-content {
        display: block !important;
        opacity: 1 !important;
    }
}


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


/* Accessibility Improvements
   ================================================ */
:focus-visible {
    outline: 2px solid #0e7496;
    outline-offset: 2px;
}

.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;
}


/* Micro-interactions
   ================================================ */
.hover-lift {
    transition: transform 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
}

.hover-glow:hover {
    box-shadow: 0 8px 24px rgba(14, 116, 150, 0.2);
}


/* Status Indicators
   ================================================ */
.status-online {
    color: #10b981;
}

.status-offline {
    color: #ef4444;
}

.status-warning {
    color: #f59e0b;
}


/* Custom Easing Functions (Apple-style)
   ================================================ */
.ease-apple {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.ease-apple-in {
    transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
}

.ease-apple-out {
    transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
}


/* Visualization Tab Styles
   ================================================ */
.viz-tab {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.viz-tab.active {
    box-shadow: 0 4px 12px rgba(14, 116, 150, 0.2);
}

.viz-content {
    display: none;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.viz-content.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}


/* Enhanced Chart Styles
   ================================================ */
.data-point, .data-point-pca {
    cursor: pointer;
    transition: all 0.2s ease;
}

.data-point:hover, .data-point-pca:hover {
    opacity: 1 !important;
    transform: scale(1.3);
}

.chart-tooltip {
    pointer-events: none;
    animation: tooltip-fade-in 0.2s ease;
}

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


/* Backdrop Blur Enhancement
   ================================================ */
.backdrop-blur-sm {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.backdrop-blur-md {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}


/* Enhanced Card Borders (Glassmorphism)
   ================================================ */
.bg-white\/80 {
    background-color: rgba(255, 255, 255, 0.8);
}

.border-gray-200\/50 {
    border-color: rgba(229, 231, 235, 0.5);
}


/* Smooth SVG Transitions
   ================================================ */
svg {
    will-change: transform;
}

svg path, svg line, svg circle, svg polygon {
    vector-effect: non-scaling-stroke;
}


/* Enhanced Rounded Corners (Apple-style)
   ================================================ */
.rounded-2xl {
    border-radius: 16px;
}


/* Advanced Gradient Backgrounds
   ================================================ */
.bg-gradient-to-br {
    background-image: linear-gradient(to bottom right, var(--tw-gradient-stops));
}


/* Box Plot Custom Styles
   ================================================ */
.relative.h-64.w-16 {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}


/* Improved Focus States for Accessibility
   ================================================ */
button:focus-visible,
a:focus-visible {
    outline: 2px solid #0e7496;
    outline-offset: 2px;
    border-radius: 8px;
}


/* Progress Bar Animations
   ================================================ */
.progress-animate {
    animation: progress-fill 1s ease-out forwards;
}

@keyframes progress-fill {
    from {
        width: 0%;
    }
}


/* Fade-in Animation for New Elements
   ================================================ */
.animate-fade-in {
    animation: element-fade-in 0.5s ease-out;
}

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


/* Interactive Hover Glow
   ================================================ */
.hover-border-glow {
    transition: all 0.3s ease;
}

.hover-border-glow:hover {
    border-color: #0e7496;
    box-shadow: 0 0 0 3px rgba(14, 116, 150, 0.1);
}


/* Chart Container Zoom Support
   ================================================ */
.chart-container {
    overflow: hidden;
    cursor: grab;
}

.chart-container:active {
    cursor: grabbing;
}


/* Smooth Icon Transitions (Lucide)
   ================================================ */
i[data-lucide] {
    display: inline-block;
    vertical-align: middle;
    transition: all 0.2s ease;
}


/* Enhanced Shadow System
   ================================================ */
.shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

.shadow-2xl {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}


/* Optimized Rendering
   ================================================ */
.bg-white,
.bg-white\/80,
button,
.nav-item {
    will-change: transform;
}


/* Smooth Color Transitions
   ================================================ */
* {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}