/* =========================================================
   CAN APPLE-INSPIRED DESIGN SYSTEM
   Estilo minimalista premium inspirado en Apple.
   Se superpone a Tailwind y estilos existentes.
   ========================================================= */

/* --- CUSTOM PROPERTIES --- */
:root {
    /* Refined CAN palette */
    --can-red: #D2232A;
    --can-gold: #FDBE15;
    --can-cyan: #4CB6C1;
    --can-dark: #002B49;

    /* Apple-inspired neutrals */
    --apple-bg: #FAFAFA;
    --apple-surface: #FFFFFF;
    --apple-surface-secondary: #F5F5F7;
    --apple-text-primary: #1d1d1f;
    --apple-text-secondary: #6e6e73;
    --apple-text-tertiary: #86868b;
    --apple-border: rgba(0, 0, 0, 0.06);
    --apple-border-strong: rgba(0, 0, 0, 0.12);

    /* Shadow system */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 24px 60px rgba(0, 0, 0, 0.1), 0 8px 20px rgba(0, 0, 0, 0.06);

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-blur: 20px;
    --glass-saturate: saturate(180%) blur(var(--glass-blur));

    /* Radius system */
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;

    /* Timing functions */
    --ease-apple: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.19, 1, 0.22, 1);

    /* Spacing */
    --section-gap: clamp(60px, 8vw, 120px);
}

/* --- GLOBAL REFINEMENTS --- */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: 'Inter', 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--apple-bg);
    color: var(--apple-text-primary);
    font-weight: 450;
    letter-spacing: -0.011em;
    line-height: 1.6;
}

/* --- TYPOGRAPHY REFINEMENTS --- */
h1, h2, h3, h4, h5, h6, .brand-font, .font-montserrat {
    font-family: 'Montserrat', 'Inter', -apple-system, sans-serif;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

h1 { letter-spacing: -0.03em; }
h2 { letter-spacing: -0.025em; }

p {
    color: var(--apple-text-secondary);
    line-height: 1.65;
}

a {
    transition: color 0.2s var(--ease-apple), opacity 0.2s var(--ease-apple);
}

/* --- SELECTION --- */
::selection {
    background: rgba(76, 182, 193, 0.2);
    color: var(--can-dark);
}

/* --- SCROLLBAR (Webkit) --- */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* --- REFINED NAVIGATION --- */
.apple-nav {
    background: var(--glass-bg) !important;
    backdrop-filter: var(--glass-saturate) !important;
    -webkit-backdrop-filter: var(--glass-saturate) !important;
    border: 1px solid var(--glass-border) !important;
    box-shadow: var(--shadow-sm) !important;
    transition: all 0.6s var(--ease-smooth) !important;
}

.apple-nav.scrolled {
    box-shadow: var(--shadow-md) !important;
    background: rgba(255, 255, 255, 0.88) !important;
}

.nav-item {
    font-weight: 500 !important;
    font-size: 13.5px !important;
    letter-spacing: 0;
    transition: all 0.25s var(--ease-apple) !important;
}

.nav-item:hover {
    opacity: 0.7;
}

.nav-item::after {
    height: 1.5px !important;
    background: var(--can-dark) !important;
    transition: width 0.35s var(--ease-apple) !important;
}

.nav-dropdown {
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: var(--glass-saturate) !important;
    -webkit-backdrop-filter: var(--glass-saturate) !important;
    border: 1px solid var(--apple-border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg) !important;
    padding: 8px !important;
}

.dropdown-item {
    border-radius: var(--radius-sm) !important;
    font-weight: 500 !important;
    font-size: 13px !important;
    padding: 10px 14px !important;
    transition: all 0.2s var(--ease-apple) !important;
}

.dropdown-item:hover {
    background: var(--apple-surface-secondary) !important;
    padding-left: 18px !important;
    color: var(--can-dark) !important;
}

/* --- BUTTONS --- */
.magnetic-btn,
button[type="submit"],
a[class*="bg-[#D2232A]"],
.pse-banner {
    transition: all 0.3s var(--ease-apple) !important;
}

/* Primary CTA refinements */
a[class*="rounded-full"][class*="font-bold"],
button[class*="rounded-full"][class*="font-bold"],
button[class*="rounded-xl"][class*="font-bold"],
button[class*="rounded-2xl"][class*="font-bold"] {
    transition: all 0.3s var(--ease-apple) !important;
    position: relative;
    overflow: hidden;
}

a[class*="rounded-full"][class*="font-bold"]:active,
button[class*="rounded-full"][class*="font-bold"]:active,
button[class*="rounded-xl"][class*="font-bold"]:active,
button[class*="rounded-2xl"][class*="font-bold"]:active {
    transform: scale(0.97) !important;
    transition: transform 0.1s var(--ease-apple) !important;
}

/* --- CARDS --- */
.feature-card,
.glass-panel,
.grade-section,
.category-card,
.glow-card {
    border: 1px solid var(--apple-border) !important;
    box-shadow: var(--shadow-sm) !important;
    transition: all 0.4s var(--ease-apple) !important;
    border-radius: var(--radius-lg) !important;
}

.feature-card:hover,
.glass-panel:hover,
.category-card:hover,
.glow-card:hover {
    box-shadow: var(--shadow-lg) !important;
    border-color: var(--apple-border-strong) !important;
    transform: translateY(-4px) !important;
}

/* --- FORM INPUTS --- */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="url"],
textarea,
select {
    border: 1.5px solid var(--apple-border-strong) !important;
    border-radius: var(--radius-md) !important;
    font-weight: 450 !important;
    transition: all 0.25s var(--ease-apple) !important;
    font-size: 15px !important;
    background: var(--apple-surface) !important;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--can-cyan) !important;
    box-shadow: 0 0 0 4px rgba(76, 182, 193, 0.12) !important;
    outline: none !important;
}

/* --- IMAGES --- */
img {
    image-rendering: -webkit-optimize-contrast;
}

.interactive-photo,
.modern-photo-hover {
    border-radius: var(--radius-lg) !important;
}

/* --- SECTION SEPARATORS --- */
.content-layer {
    border-top-left-radius: 36px !important;
    border-top-right-radius: 36px !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.03) !important;
}

/* --- MICRO-ANIMATIONS --- */

/* Fade In Up */
@keyframes appleReveal {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scale In */
@keyframes appleScaleIn {
    from {
        opacity: 0;
        transform: scale(0.94);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Subtle Breathe for CTAs */
@keyframes appleBreathe {
    0%, 100% {
        box-shadow: 0 4px 14px rgba(210, 35, 42, 0.2);
    }
    50% {
        box-shadow: 0 6px 20px rgba(210, 35, 42, 0.35);
    }
}

/* Shimmer for headings */
@keyframes appleShimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* Float subtle */
@keyframes appleFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
}

/* Slide in from left */
@keyframes appleSlideLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide in from right */
@keyframes appleSlideRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Blur in */
@keyframes appleBlurIn {
    from {
        opacity: 0;
        filter: blur(10px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

/* --- ANIMATION UTILITY CLASSES --- */
.apple-animate-reveal {
    animation: appleReveal 0.8s var(--ease-smooth) both;
}

.apple-animate-scale {
    animation: appleScaleIn 0.6s var(--ease-spring) both;
}

.apple-animate-float {
    animation: appleFloat 5s ease-in-out infinite;
}

.apple-animate-breathe {
    animation: appleBreathe 3s ease-in-out infinite;
}

.apple-animate-slide-left {
    animation: appleSlideLeft 0.7s var(--ease-smooth) both;
}

.apple-animate-slide-right {
    animation: appleSlideRight 0.7s var(--ease-smooth) both;
}

.apple-animate-blur-in {
    animation: appleBlurIn 0.8s var(--ease-smooth) both;
}

/* Stagger children */
.apple-stagger > *:nth-child(1) { animation-delay: 0ms; }
.apple-stagger > *:nth-child(2) { animation-delay: 80ms; }
.apple-stagger > *:nth-child(3) { animation-delay: 160ms; }
.apple-stagger > *:nth-child(4) { animation-delay: 240ms; }
.apple-stagger > *:nth-child(5) { animation-delay: 320ms; }
.apple-stagger > *:nth-child(6) { animation-delay: 400ms; }

/* --- FOOTER APPLE REFINEMENTS --- */
footer {
    border-top: 1px solid var(--apple-border) !important;
}

footer h4 {
    font-size: 11px !important;
    letter-spacing: 0.12em !important;
    text-transform: uppercase;
    font-weight: 700 !important;
}

footer a {
    transition: color 0.2s var(--ease-apple), transform 0.2s var(--ease-apple) !important;
}

footer a:hover {
    transform: translateX(2px);
}

/* --- PAGE HEADER REFINEMENTS --- */
.page-header {
    position: relative;
}

.page-header h1 {
    font-weight: 900;
    letter-spacing: -0.04em;
}

/* --- HERO REFINEMENTS --- */
#hero-section .hero-title {
    letter-spacing: -0.04em !important;
    font-weight: 900 !important;
}

#hero-section .hero-subtitle {
    letter-spacing: 0.25em !important;
    font-weight: 300 !important;
    opacity: 0.85;
}

.hero-bg-layer {
    transition: opacity 2s var(--ease-smooth), transform 8s var(--ease-smooth) !important;
}

.hero-bg-layer.active {
    transform: scale(1.05) !important;
}

/* --- SMART HIGHLIGHT REFINEMENT --- */
.smart-highlight::after {
    height: 35% !important;
    border-radius: 3px !important;
    opacity: 0.3 !important;
}

.smart-highlight.active::after {
    opacity: 0.5 !important;
}

/* --- LEVEL CARDS REFINEMENT --- */
a[class*="rounded-2xl"][class*="overflow-hidden"][class*="group"] {
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-md) !important;
    transition: all 0.5s var(--ease-apple) !important;
}

a[class*="rounded-2xl"][class*="overflow-hidden"][class*="group"]:hover {
    box-shadow: var(--shadow-xl) !important;
    transform: translateY(-6px) !important;
}

/* --- PSE BANNER REFINEMENT --- */
.pse-banner {
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-lg) !important;
}

.pse-banner:hover {
    box-shadow: var(--shadow-xl) !important;
    transform: translateY(-3px) !important;
}

/* --- TABLES REFINEMENT --- */
.cost-table-container {
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--apple-border) !important;
    overflow: hidden;
}

.cost-table th,
.cost-table td {
    font-size: 13px !important;
}

/* --- PRINT STYLES --- */
@media print {
    .apple-nav,
    #shared-nav,
    #success-banner,
    #chat-widget,
    .can-welcome-overlay {
        display: none !important;
    }
}
