/* ============================================
   PLANNERMAG APP - Custom Styles
   Uzupelnienie Tailwind CDN o elementy
   ktorych nie da sie zrobic inline
   ============================================ */

/* ---- CSS Custom Properties ---- */
:root {
    --color-lime: #a3e635;
    --color-lime-light: #bef264;
    --color-dark: #0a0a0f;
    --color-purple: #7c3aed;
    --color-fuchsia: #d946ef;
}

/* ---- Base ---- */
html {
    scroll-behavior: smooth;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

::-webkit-scrollbar-track {
    background: #1a1a2e;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #5c5c8a;
}

/* ---- Selection ---- */
::selection {
    background-color: rgba(163, 230, 53, 0.3);
    color: white;
}

/* ---- Cosmic Animated Background ---- */
.cosmic-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.cosmic-bg__gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom right, #110a1a, #0a0a0f, #0a0f1a);
    background-size: 200% 200%;
    animation: gradient-shift 15s ease infinite;
}

.cosmic-bg__blob--purple {
    position: absolute;
    top: 0;
    right: 0;
    width: 1000px;
    height: 700px;
    background: linear-gradient(to bottom left,
        rgba(147, 51, 234, 0.2),
        rgba(217, 70, 239, 0.1),
        transparent
    );
    filter: blur(64px);
    animation: pulse-slow 8s ease-in-out infinite;
}

.cosmic-bg__blob--fuchsia {
    position: absolute;
    top: 10%;
    right: 10%;
    width: 500px;
    height: 500px;
    background: linear-gradient(to bottom left,
        rgba(232, 121, 249, 0.1),
        rgba(147, 51, 234, 0.05),
        transparent
    );
    filter: blur(100px);
    animation: pulse-slower 12s ease-in-out infinite;
}

.cosmic-bg__blob--blue {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 600px;
    height: 400px;
    background: linear-gradient(to top right,
        rgba(37, 99, 235, 0.1),
        rgba(6, 182, 212, 0.05),
        transparent
    );
    filter: blur(64px);
    animation: pulse-slower 12s ease-in-out infinite;
}

/* Mobile: mniejsze bloby dla wydajnosci */
@media (max-width: 768px) {
    .cosmic-bg__blob--purple {
        width: 500px;
        height: 350px;
    }
    .cosmic-bg__blob--fuchsia {
        width: 250px;
        height: 250px;
    }
    .cosmic-bg__blob--blue {
        width: 300px;
        height: 200px;
    }
}

/* ---- Glass Morphism ---- */
.glass {
    background: rgba(26, 26, 46, 0.6);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Fallback dla przegladarek bez backdrop-filter */
@supports not (backdrop-filter: blur(12px)) {
    .glass {
        background: rgba(26, 26, 46, 0.92);
    }
}

/* ---- Glow Effects ---- */
.glow-lime {
    box-shadow: 0 0 40px rgba(163, 230, 53, 0.3);
}

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

/* ---- Button Glow ---- */
.btn-glow:hover {
    box-shadow: 0 0 30px rgba(163, 230, 53, 0.4);
}

/* ---- Style Pill (plan config modal) ---- */
.style-pill.active-pill {
    background: var(--color-lime);
    color: #000;
}
.style-pill:not(.active-pill):hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ---- Spinner ---- */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--color-lime);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
}

.spinner--small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

/* ---- Select Dropdown (dark theme for <option>) ---- */
select option {
    background: #1a1a2e;
    color: white;
}

/* ---- Input Autofill Override ---- */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
    -webkit-text-fill-color: white;
    box-shadow: 0 0 0 1000px #1a1a2e inset;
    border-color: rgba(255, 255, 255, 0.1);
    transition: background-color 5000s ease-in-out 0s;
}

/* ============================================
   ANIMATIONS / KEYFRAMES
   ============================================ */

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes pulse-slow {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.05); }
}

@keyframes pulse-slower {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.1); }
}

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

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

@keyframes slide-down {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scale-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Animation utility classes */
.animate-fade-in-up {
    animation: fade-in-up 0.5s ease-out forwards;
}

.animate-slide-down {
    animation: slide-down 0.3s ease-out forwards;
}

.animate-scale-in {
    animation: scale-in 0.3s ease-out forwards;
}

/* ---- Modal Overlay (behavioral) ---- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 50;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

/* ---- Progress Overlay (behavioral) ---- */
.progress-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 60;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 15, 0.6);
    backdrop-filter: blur(12px);
}

.progress-overlay.active {
    display: flex;
}

/* ---- Tabs (behavioral) ---- */
.tab-content {
    display: none;
}

/* Platform content tabs (content.html post variations) */
.platform-content {
    display: none;
}

.platform-content.active {
    display: block;
    animation: fade-in-up 0.3s ease-out;
}

/* Carousel platform tabs (content.html carousel captions) */
.carousel-cap-content {
    display: none;
}

.carousel-cap-content.active {
    display: block;
    animation: fade-in-up 0.3s ease-out;
}

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

/* ---- Collapsible Sections ---- */
.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.3s ease;
    padding: 0 10px;
}

.collapsible-content.expanded {
    max-height: 2000px;
    padding: 20px 10px;
}

.collapsible-header .toggle-icon {
    transition: transform 0.3s ease;
}

.collapsible-header.expanded .toggle-icon {
    transform: rotate(180deg);
}

/* ---- Progress Step States ---- */
.progress-step.active {
    background: rgba(163, 230, 53, 0.1);
    border-left: 4px solid var(--color-lime);
}

.progress-step.completed {
    background: rgba(34, 197, 94, 0.1);
    border-left: 4px solid #22c55e;
}

/* ---- Progress Pulse ---- */
@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ---- Scale In (for success icons) ---- */
@keyframes scaleIn {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* ---- Refresh Icon Spin ---- */
.refresh-icon.loading {
    animation: spin 1s linear infinite;
}

/* ---- Line Clamp for Post Text ---- */
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Wizard Animation Placeholders ---- */
.wizard-anim {
    width: 220px;
    height: 220px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
}

.wizard-anim img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Emoji-only variant (no img): keep pulsating circle */
.wizard-anim--emoji {
    border-radius: 50%;
    animation: wizardPulse 2s ease-in-out infinite;
}

.wizard-anim--crystal {
    background: none;
}

.wizard-anim--telekinesis {
    background: none;
}

.wizard-anim--cauldron {
    background: none;
}

@keyframes wizardPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(163, 230, 53, 0.2);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 0 40px rgba(163, 230, 53, 0.4);
    }
}

/* ---- Stars Loader (sparkle progress) ---- */
.stars-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    height: 48px;
}

.stars-loader__star {
    display: inline-block;
    background: #a3e635;
    clip-path: polygon(50% 0%, 54% 46%, 100% 50%, 54% 54%, 50% 100%, 46% 54%, 0% 50%, 46% 46%);
    animation: sparkle-pulse var(--duration, 1.4s) var(--delay, 0s) ease-in-out infinite;
    filter: drop-shadow(0 0 5px rgba(163, 230, 53, 0.8));
}

.stars-loader__star:nth-child(1) { width: 20px; height: 20px; --delay: 0s;    --duration: 1.3s; }
.stars-loader__star:nth-child(2) { width: 10px; height: 10px; --delay: 0.35s; --duration: 1.5s; }
.stars-loader__star:nth-child(3) { width: 26px; height: 26px; --delay: 0.7s;  --duration: 1.2s; }
.stars-loader__star:nth-child(4) { width: 8px;  height: 8px;  --delay: 1.05s; --duration: 1.6s; }
.stars-loader__star:nth-child(5) { width: 18px; height: 18px; --delay: 1.4s;  --duration: 1.3s; }
.stars-loader__star:nth-child(6) { width: 7px;  height: 7px;  --delay: 0.5s;  --duration: 1.7s; }
.stars-loader__star:nth-child(7) { width: 13px; height: 13px; --delay: 0.2s;  --duration: 1.4s; }

@keyframes sparkle-pulse {
    0%, 100% {
        opacity: 0.15;
        transform: scale(0.5) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1) rotate(20deg);
    }
}

/* ---- Safe Area (mobile notch) ---- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .safe-bottom {
        padding-bottom: env(safe-area-inset-bottom);
    }
}
