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

html {
    scroll-behavior: smooth;
    overflow-y: scroll;
}

/* Scrollbar fade transition */
html::-webkit-scrollbar {
    transition: opacity 0.3s ease;
}

html.loading-active::-webkit-scrollbar,
html.welcome-active::-webkit-scrollbar {
    opacity: 0;
    transition: opacity 0s;
}

html::-webkit-scrollbar-thumb {
    transition: opacity 0.3s ease;
}

html.loading-active::-webkit-scrollbar-thumb,
html.welcome-active::-webkit-scrollbar-thumb {
    opacity: 0;
    transition: opacity 0s;
}

html::-webkit-scrollbar-track {
    transition: opacity 0.3s ease;
}

html.loading-active::-webkit-scrollbar-track,
html.welcome-active::-webkit-scrollbar-track {
    opacity: 0;
    transition: opacity 0s;
}

/* Firefox scrollbar fade */
html {
    scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
    transition: scrollbar-color 0.3s ease;
}

html.loading-active,
html.welcome-active {
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0s;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #fafafa;
    min-height: calc(100vh + 1px);
    color: #1a1a1a;
    line-height: 1.6;
    overflow-x: hidden;
}

/* CSS Variables */
:root {
    --primary-color: #00a88f;
    --primary-hover: #008f7a;
    --secondary-color: #667eea;
    --secondary-hover: #5568d3;
    --text-dark: #1a1a1a;
    --text-medium: #666;
    --text-light: #999;
    --border-light: #f0f0f0;
    --border-medium: #e0e0e0;
    --bg-white: white;
    --bg-light: #fafafa;
    --bg-gray: #f8f8f8;
    --success: #059669;
    --warning: #d97706;
    --error: #dc2626;
}

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

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

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

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

/* Utility Classes */
.fade-in {
    animation: fadeIn 0.6s ease-in-out;
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 8px;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Shimmer wrapper for loading animation */
.shimmer-wrapper {
    position: relative;
    display: inline-block;
    overflow: hidden;
    width: clamp(80px, 15vw, 120px);
    max-width: 100%;
}

.shimmer-wrapper .loading-logo {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* Responsive adjustments for loading screen */
@media (max-width: 768px) {
    .shimmer-wrapper {
        width: clamp(70px, 20vw, 100px);
    }
}

@media (max-width: 480px) {
    .shimmer-wrapper {
        width: clamp(60px, 25vw, 90px);
    }
}

/* Shimmer overlay */
.shimmer-wrapper::after {
    content: "";
    position: absolute;
    top: 0;
    left: -150%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        120deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.35) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -150%;
    }
    100% {
        left: 150%;
    }
}

.loading-text {
    margin-top: 0.5rem;
    margin-left: 1.5rem;
    color: var(--text-medium);
    font-size: 1rem;
    font-weight: 500;
    animation: pulse 1.5s ease-in-out infinite;
}

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

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

/* Common View Styles */
.view {
    display: none !important;
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.view.active {
    display: block !important;
}
