/* --- CSS Variables --- */
:root {
    --background: #f9f9f9;
    --primary: #6a11cb;
    --secondary: #eb337a;
    --accent1: #00f2fe;
    --accent2: #f5a623;
    --dark-text: #2c3e50;
    --light-text: #8a8a8a;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: #f3f4f6;
}

/* --- Skip Link Styles --- */
.skip-to-content {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    background-color: #4F46E5;
    color: white;
    padding: 1rem;
    z-index: 9999;
}

.skip-to-content:focus {
    position: fixed;
    top: 10px;
    left: 10px;
    width: auto;
    height: auto;
    overflow: visible;
    text-decoration: none;
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1),
        0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* --- Modern Keyframe Animations --- */
@keyframes toast-in {
    0% {
        transform: translateY(-100%) scale(0.95);
        opacity: 0;
    }

    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes toast-out {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(-100%) scale(0.95);
        opacity: 0;
    }
}

@keyframes fade-in {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

/* Modern slide-up with gentle bounce */
@keyframes slide-up-gentle {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }

    60% {
        transform: translateY(-4px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth scale entrance */
@keyframes scale-in-smooth {
    0% {
        opacity: 0;
        transform: scale(0.92);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Modern tooltip appearance */
@keyframes tooltip-appear {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-4px) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

/* Subtle float for decorative elements */
@keyframes float-subtle {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-6px);
    }
}

/* Gentle pulse for loading states */
@keyframes pulse-gentle {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* --- Animation Utility Classes --- */
.animate-toast-in {
    animation: toast-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.animate-toast-out {
    animation: toast-out 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.animate-fade-in {
    animation: fade-in 0.4s ease-out;
}

.animate-slide-up {
    animation: slide-up-gentle 0.5s cubic-bezier(0.34, 1.26, 0.64, 1) forwards;
}

.animate-scale-in {
    animation: scale-in-smooth 0.3s cubic-bezier(0.34, 1.26, 0.64, 1) forwards;
}

.animate-tooltip-in {
    animation: tooltip-appear 0.2s cubic-bezier(0.34, 1.26, 0.64, 1) forwards;
}

.animate-float {
    animation: float-subtle 4s ease-in-out infinite;
}

.animate-pulse {
    animation: pulse-gentle 2s ease-in-out infinite;
}

/* Staggered animations for lists */
.animate-stagger-1 {
    animation-delay: 50ms;
}

.animate-stagger-2 {
    animation-delay: 100ms;
}

.animate-stagger-3 {
    animation-delay: 150ms;
}

.animate-stagger-4 {
    animation-delay: 200ms;
}

.animate-stagger-5 {
    animation-delay: 250ms;
}

/* --- Onboarding Modal --- */
.onboarding-modal-backdrop {
    animation: fade-in 0.25s ease-out forwards;
}

.onboarding-modal-content {
    animation: scale-in-smooth 0.3s cubic-bezier(0.34, 1.26, 0.64, 1) forwards;
}

/* --- Editor Toggle --- */
.editor-side-toggle-active {
    background-color: #4F46E5;
    color: white;
    border-color: #4F46E5;
    border-radius: 0.375rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Template Cards --- */
.template-card {
    aspect-ratio: 1014 / 639;
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.template-card:hover {
    border-color: #4F46E5;
    box-shadow: 0 8px 16px -4px rgba(79, 70, 229, 0.15);
    transform: translateY(-2px);
}

.template-card-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
    margin-top: 0.5rem;
}

/* --- Editor Panels --- */
.editor-left-panel>div {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.editor-left-panel>div>.flex-grow {
    height: 100%;
    overflow-y: auto;
}

/* --- Custom Tooltip --- */
.custom-tooltip {
    position: fixed;
    background-color: #1f2937;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    z-index: 10000;
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
    animation: tooltip-appear 0.2s cubic-bezier(0.34, 1.26, 0.64, 1) forwards;
}

/* --- Grid Panels --- */
.editor-grid-panel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
}

.editor-grid-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    color: #374151;
    font-size: 0.75rem;
    line-height: 1rem;
    text-align: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 44px;
    min-width: 44px;
    cursor: pointer;
}

.editor-grid-button:hover {
    background-color: #f9fafb;
    border-color: #4F46E5;
    color: #4F46E5;
    transform: translateY(-1px);
}

.editor-grid-button svg {
    width: 1.5rem;
    height: 1.5rem;
    margin-bottom: 0.25rem;
}

/* --- Canvas --- */
.canvas-wrapper {
    position: relative;
    width: fit-content;
    height: fit-content;
    margin: auto;
}

canvas {
    display: block;
}

.canvas-container {
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
}

/* --- Toolbar Buttons --- */
.tool-button {
    background-color: white;
    color: #374151;
    padding: 0.5rem;
    border: 1px solid #D1D5DB;
    border-radius: 0.25rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    cursor: pointer;
}

.tool-button:hover {
    background-color: #E5E7EB;
    transform: translateY(-1px);
}

.tool-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tool-button:disabled:hover {
    background-color: white;
    transform: none;
}

.tool-button svg {
    width: 1.25rem;
    height: 1.25rem;
}

.tool-separator {
    width: 1px;
    height: 1.5rem;
    background-color: #D1D5DB;
    margin-left: 0.25rem;
    margin-right: 0.25rem;
}

/* --- Dashboard Cards --- */
.dashboard-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.34, 1.26, 0.64, 1);
    border: 1px solid transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.dashboard-card:hover {
    box-shadow: 0 12px 24px -8px rgba(79, 70, 229, 0.2);
    transform: translateY(-4px);
    border-color: rgba(79, 70, 229, 0.1);
}

/* --- Easy Editor --- */
.easy-editor-step {
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.easy-editor-step-header {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.easy-editor-frame-btn {
    width: 5rem;
    height: 5rem;
    border: 2px solid #d1d5db;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 44px;
    min-width: 44px;
}

.easy-editor-frame-btn:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 12px -4px rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
}

.easy-editor-frame-btn.active {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(165, 180, 252, 0.3);
}

/* --- Modern Loader (UPDATED) --- */
#global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f9f9f9 0%, #ffffff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 40px;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.4s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

/* New Swatch Loader */
.creative-loader {
    display: grid;
    grid-template-columns: repeat(2, 60px);
    grid-template-rows: repeat(2, 60px);
    gap: 8px;
}

.swatch {
    width: 100%;
    height: 100%;
    background-color: var(--color);
    border-radius: 8px;
    transform-origin: center;
    opacity: 0;
    animation: swatch-animate 2.4s ease-in-out infinite;
    animation-delay: var(--delay);
}

@keyframes swatch-animate {

    0%,
    100% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }

    50% {
        transform: scale(1) rotate(180deg);
        opacity: 1;
    }
}

/* End New Swatch Loader */


/* --- Loading Text (Unchanged) --- */
.loading-text-container {
    text-align: center;
}

.title-main {
    font-size: 22px;
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 8px;
    animation: fade-in 0.5s ease-out;
}

.title-sub {
    font-size: 15px;
    color: var(--light-text);
    position: relative;
    display: inline-block;
    width: 220px;
    height: 20px;
}

.loading-step {
    position: absolute;
    left: 0;
    right: 0;
    opacity: 0;
    animation: fade-text-smooth 4.8s ease-in-out infinite;
}

.loading-step:nth-child(1) {
    animation-delay: 0s;
}

.loading-step:nth-child(2) {
    animation-delay: 1.2s;
}

.loading-step:nth-child(3) {
    animation-delay: 2.4s;
}

.loading-step:nth-child(4) {
    animation-delay: 3.6s;
}

@keyframes fade-text-smooth {

    0%,
    100% {
        opacity: 0;
        transform: translateY(0);
    }

    10%,
    90% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Homepage Styles --- */
.home-background-gradient {
    position: absolute;
    top: -100px;
    left: 0;
    right: 0;
    height: 600px;
    background: radial-gradient(ellipse at 50% -50%, rgba(99, 102, 241, 0.08), transparent 70%);
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.home-hero-title {
    background: linear-gradient(135deg, var(--primary, #6a11cb), #3b0769);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.home-hero-subtitle {
    font-size: 1.25rem;
    color: #4b5563;
    max-width: 600px;
    margin: 1rem auto 2rem auto;
}

/* --- Mode Selection Cards --- */
.mode-selection-card {
    display: flex;
    flex-direction: column;
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.26, 0.64, 1);
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05);
}

.mode-selection-card:hover {
    transform: translateY(-6px);
    border-color: var(--primary, #6a11cb);
    box-shadow: 0 12px 24px -8px rgba(106, 17, 203, 0.25);
}

.mode-selection-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

.mode-selection-card p {
    color: #6b7280;
    font-size: 0.875rem;
    flex-grow: 1;
    margin-bottom: 1rem;
}

/* --- Color Utilities --- */
.indigo-bg-light {
    background-color: #eef2ff;
}

.indigo-text {
    color: #4f46e5;
}

.indigo-hover-border:hover {
    border-color: #6366f1;
}

.teal-bg-light {
    background-color: #f0fdfa;
}

.teal-text {
    color: #0d9488;
}

.teal-hover-border:hover {
    border-color: #2dd4bf;
}

.purple-bg-light {
    background-color: #faf5ff;
}

.purple-text {
    color: #9333ea;
}

.purple-hover-border:hover {
    border-color: #a855f7;
}

.sky-bg-light {
    background-color: #f0f9ff;
}

.sky-text {
    color: #0284c7;
}

.sky-hover-border:hover {
    border-color: #38bdf8;
}

.green-bg-light {
    background-color: #f0fdf4;
}

.green-text {
    color: #16a34a;
}

.green-hover-border:hover {
    border-color: #4ade80;
}

.amber-bg-light {
    background-color: #fffbeb;
}

.amber-text {
    color: #d97706;
}

.amber-hover-border:hover {
    border-color: #fcd34d;
}

/* --- Mobile Navigation --- */
.mobile-nav-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
    animation: fade-in 0.25s ease-out;
}

.mobile-nav-menu {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 80%;
    max-width: 300px;
    background-color: white;
    z-index: 50;
    padding: 1.5rem;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    transform: translateX(-100%);
    animation: slide-in-menu 0.3s cubic-bezier(0.34, 1.26, 0.64, 1) forwards;
}

@keyframes slide-in-menu {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(0);
    }
}

@keyframes slide-out-menu {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

.mobile-nav-menu.closing {
    animation: slide-out-menu 0.25s ease-in forwards;
}

/* --- Admin Styles --- */
.admin-stat-card {
    display: flex;
    align-items: center;
    background-color: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05);
    border: 1px solid #e5e7eb;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-stat-card:hover {
    box-shadow: 0 4px 12px -4px rgb(0 0 0 / 0.1);
    transform: translateY(-2px);
}

.admin-stat-icon-wrapper {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 3.5rem;
    height: 3.5rem;
    margin-right: 1.5rem;
}

.admin-stat-icon-wrapper svg {
    width: 1.75rem;
    height: 1.75rem;
}

.admin-stat-content h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
}

.admin-stat-content p {
    font-size: 2.25rem;
    font-weight: 800;
    color: #1f2937;
    line-height: 1;
}

.admin-sidebar-nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin: 0.25rem 0;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #4b5563;
}

.admin-sidebar-nav-link:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}

.admin-sidebar-nav-link.active {
    background-color: #eef2ff;
    color: #4f46e5;
}

.admin-sidebar-nav-link svg {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
}

/* --- Auth Decorator --- */
.auth-decorator-gradient {
    background: linear-gradient(165deg, #4f46e5 0%, #06b6d4 100%);
}

.auth-decorator-text {
    position: relative;
    z-index: 10;
}

.auth-decorator-text h3 {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.auth-decorator-text p {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.8);
}

.auth-decorator-gradient::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.5;
}