@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --white: #ffffff;
    --black: #000000;
    --panna: #faf7f2;
}

@keyframes blink {
    50% { opacity: 0; }
}
.cursor-blink {
    animation: blink 0.8s step-end infinite;
}

[data-theme="dark"] {
    --bg: var(--black);
    --bg-alt: var(--black);
    --text: var(--white);
    --text-alt: var(--white);
    --border: var(--white);
    --card: var(--black);
    --hover: var(--white);
    --btn-primary-hover: #e6e6e6;
    --btn-secondary-hover: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] {
    --bg: #eae6de;
    --bg-alt: #f0ede6;
    --text: var(--black);
    --text-alt: var(--black);
    --border: var(--black);
    --card: rgba(255, 255, 255, 0.72);
    --hover: var(--black);
    --btn-primary-hover: #1a1a1a;
    --btn-secondary-hover: rgba(0, 0, 0, 0.05);
}

/* (=^. .^=) */

* {
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.01em;
}
html, body {
    overflow-x: hidden;
    width: 100%;
}
body {
    scroll-behavior: smooth;
    background: var(--bg);
    color: var(--text);
    transition: background-color 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), color 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
body[data-theme="light"] {
    background: url('./concrete.png') repeat !important;
}

.bg-gradient-text {
    background: linear-gradient(135deg, var(--text) 0%, var(--text) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card-hover {
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}
.card-hover:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 24px 48px rgba(0,0,0,0.25);
}

.theme-glow {
    box-shadow: 0 0 20px rgba(255,255,255,0.1);
}
[data-theme="light"].theme-glow {
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.feature-row {
    display: flex;
    align-items: center;
    gap: 4rem;
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.feature-row.reverse {
    flex-direction: row-reverse;
    transform: translateX(50px);
}
.feature-row.in-view {
    opacity: 1;
    transform: translateX(0);
}

.nav-link {
    color: var(--text-alt);
    opacity: 0.7;
    transition: opacity 0.2s;
}
.nav-link:hover { opacity: 1; }
.nav-link.active {
    opacity: 1;
    font-weight: 600;
}

.fade-in { animation: fadeIn 0.4s ease-in; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.modal-backdrop {
    backdrop-filter: blur(8px);
    background-color: rgba(0, 0, 0, 0.7);
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
    background: var(--text);
    opacity: 0.3;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { opacity: 0.5; }

input, textarea, select {
    background: var(--card);
    color: var(--text);
    border-color: var(--border);
}

.btn-primary {
    background: var(--text);
    color: var(--bg);
    border: 1px solid var(--text);
    transition: all 0.3s ease;
}
.btn-primary:hover {
    background: var(--btn-primary-hover);
    transform: scale(1.02);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}
.btn-secondary:hover {
    background: var(--btn-secondary-hover);
    transform: scale(1.02);
}

.theme-toggle {
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.theme-toggle:active {
    transform: scale(0.9) rotate(180deg);
}

.liquid-glass-effect {
    filter: url(#liquid-glass-text);
    color: rgba(255, 255, 255, 0.14);
    -webkit-text-stroke: 1.2px rgba(255, 255, 255, 0.42);
    font-weight: 900;
    user-select: none;
    -webkit-user-select: none;
    display: inline-block;
}
[data-theme="light"] .liquid-glass-effect {
    color: rgba(0, 0, 0, 0.08);
    -webkit-text-stroke: 1.2px rgba(0, 0, 0, 0.25);
}

/* Floating Navbar styling */
.navbar-liquid-glass {
    position: fixed;
    top: 0;
    left: 0;
    transform: none;
    z-index: 50;
    width: 100%;
    border-radius: 0;
    padding: 0 1.25rem;
    transition: all 0.3s ease;

    /* Fallback: standard glassmorphism */
    backdrop-filter: blur(28px) saturate(210%) contrast(85%);
    -webkit-backdrop-filter: blur(28px) saturate(210%) contrast(85%);
    background: rgba(15, 15, 18, 0.62); /* more transparent dark frosted glass */

    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    border-left: none;
    border-right: none;
    border-top: none;
    box-shadow: 0 4px 30px -2px rgba(0, 0, 0, 0.4);
}
@media (min-width: 768px) {
    .navbar-liquid-glass {
        top: 16px;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 2rem);
        max-width: 80rem; /* 1280px (max-w-7xl) */
        border-radius: 20px;
        padding: 0 2rem;
        border: 1px solid rgba(255, 255, 255, 0.12);
        box-shadow: 
            0 1px 0px 0px rgba(255, 255, 255, 0.15) inset,
            0 4px 30px -2px rgba(0, 0, 0, 0.4);
    }
}
[data-theme="light"] .navbar-liquid-glass {
    /* Fallback */
    backdrop-filter: blur(28px) saturate(210%) contrast(85%);
    -webkit-backdrop-filter: blur(28px) saturate(210%) contrast(85%);
    background: rgba(250, 247, 242, 0.55); /* more transparent light frosted glass matching cream */

    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    border-left: none;
    border-right: none;
    border-top: none;
    box-shadow: 0 4px 30px -2px rgba(0, 0, 0, 0.12);
}
@media (min-width: 768px) {
    [data-theme="light"] .navbar-liquid-glass {
        border: 1px solid rgba(0, 0, 0, 0.1);
        box-shadow: 
            0 1px 0px 0px rgba(255, 255, 255, 0.5) inset,
            0 4px 30px -2px rgba(0, 0, 0, 0.12);
    }
}

/* Full-screen background stars/dots canvas */
#bg-stars-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -10;
    pointer-events: none;
    display: block;
}

/* Animated Glassmorphism Footer */
.footer-glass {
    backdrop-filter: blur(28px) saturate(210%) contrast(85%);
    -webkit-backdrop-filter: blur(28px) saturate(210%) contrast(85%);
    background: rgba(15, 15, 18, 0.62);

    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 -4px 30px -2px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .footer-glass {
    background: rgba(250, 247, 242, 0.55);
    border-top: 1px solid rgba(0, 0, 0, 0.10);
    box-shadow: 0 -4px 30px -2px rgba(0, 0, 0, 0.06);
}

/* (=^. .^=) Theme Card Custom Shimmers & Image Box Animations */
.animated-image-box {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--card) 0%, rgba(128, 128, 128, 0.08) 100%);
    border: 1px solid rgba(128, 128, 128, 0.15);
    transition: all 0.5s ease;
}
.animated-image-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255, 255, 255, 0.12) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.5s ease;
}
.animated-image-box:hover::before {
    opacity: 1;
}
@keyframes shimmer-flow {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.shimmer-bar {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
    transform: translateX(-100%);
    animation: shimmer-flow 3s infinite;
}
@keyframes pulse-slow {
    0%, 100% { opacity: 0.35; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.04); }
}
.theme-pulse-glow {
    animation: pulse-slow 3.5s ease-in-out infinite;
}

/* (=^. .^=) Responsive Feature Row Adjustments */
@media (max-width: 768px) {
    .feature-row, .feature-row.reverse {
        flex-direction: column-reverse !important;
        text-align: center;
        gap: 2.5rem;
        transform: translateY(40px) !important;
    }
    .feature-row.in-view, .feature-row.reverse.in-view {
        transform: translateY(0) !important;
    }
}

/* (=^. .^=) Prevent theme flash on first paint: transitions are enabled only after load */
body.preload,
body.preload * {
    transition: none !important;
}

/* (=^. .^=) Gentle reveal-on-scroll animation */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Footer social icons */
.social-link {
    display: inline-block;
    transition: transform 0.25s ease, color 0.2s ease, opacity 0.2s ease;
}
.social-link:hover {
    transform: translateY(-3px) scale(1.12);
}

/* Soft floating animation (Themes page) */
@keyframes float-soft {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.float-soft {
    animation: float-soft 4s ease-in-out infinite;
}

/* FAQ accordion */
details.faq-item summary {
    cursor: pointer;
    list-style: none;
}
details.faq-item summary::-webkit-details-marker {
    display: none;
}
details.faq-item .faq-chevron {
    transition: transform 0.3s ease;
}
details.faq-item[open] .faq-chevron {
    transform: rotate(180deg);
}
details.faq-item .faq-answer {
    animation: fadeIn 0.35s ease;
}
details.faq-item {
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

/* Admin Tabs Style */
.admin-tab-btn {
    position: relative;
    transition: all 0.3s ease;
}
.admin-tab-btn::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--text);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}
.admin-tab-btn.active {
    color: var(--text) !important;
    opacity: 1 !important;
}
.admin-tab-btn.active::after {
    transform: scaleX(1);
}

/* Responsive, scrollable modals */
#modal > div {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
#modal .flex-1 {
    display: flex;
    flex-direction: column;
    max-height: 100%;
}
#modal-desc {
    overflow-y: auto;
    max-height: 60vh;
    white-space: pre-wrap;
    padding-right: 6px;
}

/* High contrast text overrides for better accessibility in light and dark themes */
.text-\[var\(--text\)\]\/40 {
    color: var(--text) !important;
    opacity: 0.75 !important;
}
.text-\[var\(--text\)\]\/50 {
    color: var(--text) !important;
    opacity: 0.8 !important;
}
.text-\[var\(--text\)\]\/60 {
    color: var(--text) !important;
    opacity: 0.85 !important;
}
.text-\[var\(--text\)\]\/70 {
    color: var(--text) !important;
    opacity: 0.9 !important;
}
.text-\[var\(--text\)\]\/80 {
    color: var(--text) !important;
    opacity: 0.95 !important;
}
::placeholder {
    color: var(--text) !important;
    opacity: 0.75 !important;
}

/* Enhance contrast of accent colors in light mode to meet WCAG standards */
[data-theme="light"] .text-green-500 {
    color: #15803d !important;
}
[data-theme="light"] .text-blue-500 {
    color: #1d4ed8 !important;
}
[data-theme="light"] .text-violet-500 {
    color: #6d28d9 !important;
}

/* Grafici professionali - adattivi light/dark */
.chart-card {
    background: var(--card);
    border: 1px solid color-mix(in srgb, var(--border) 16%, transparent);
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: 0 8px 30px -18px rgba(0,0,0,0.35);
    position: relative;
    overflow: hidden;
}
.chart-card::before {
    content: "";
    position: absolute;
    top: -40%;
    right: -20%;
    width: 60%;
    height: 80%;
    background: radial-gradient(ellipse at center, color-mix(in srgb, var(--text) 6%, transparent) 0%, transparent 70%);
    pointer-events: none;
}
.chart-wrap {
    position: relative;
    height: 300px;
}
@media (min-width: 640px) {
    .chart-wrap { height: 340px; }
}
.stats-period-btn.active {
    background: var(--text) !important;
    color: var(--bg) !important;
    border-color: var(--text) !important;
}
[data-theme="light"] .chart-card {
    box-shadow: 0 10px 40px -20px rgba(0,0,0,0.10);
    border-color: rgba(0,0,0,0.06);
}
/* Numeri stats */
.stat-number {
    background: linear-gradient(180deg, var(--text) 0%, color-mix(in srgb, var(--text) 70%, transparent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

/* Contrast styling for native selects and option lists in dark/light themes */
select {
    color: var(--text) !important;
    background-color: var(--bg) !important;
}
select option {
    background-color: var(--bg) !important;
    color: var(--text) !important;
}
