/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;700&display=swap');

:root {
    --bg-dark: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary-accent: #8b5cf6;
    --secondary-accent: #ec4899;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background Animations */
.background-globes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 10s infinite ease-in-out;
}

.globe-1 {
    width: 400px;
    height: 400px;
    background: var(--primary-accent);
    top: -50px;
    left: -100px;
    animation-delay: 0s;
}

.globe-2 {
    width: 500px;
    height: 500px;
    background: var(--secondary-accent);
    bottom: -100px;
    right: -100px;
    animation-delay: -2s;
}

.globe-3 {
    width: 300px;
    height: 300px;
    background: #3b82f6;
    top: 40%;
    left: 40%;
    animation-delay: -4s;
    opacity: 0.2;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(20px, -20px);
    }
}

/* Main Container */
.app-container {
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo i {
    color: var(--primary-accent);
    -webkit-text-fill-color: initial;
}

.app-nav {
    display: flex;
    gap: 1rem;
    align-items: center;
    /* Center align nav items including BMC button */
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s;
}

.nav-btn.active,
.nav-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.bmc-button img {
    height: 38px;
    transition: transform 0.2s;
    display: block;
}

.bmc-button:hover img {
    transform: scale(1.05);
}

/* Workspace */
.workspace {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Upload Zone */
.upload-zone {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px dashed var(--glass-border);
    margin: 2rem;
    border-radius: 16px;
    transition: all 0.3s;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--primary-accent);
    background: rgba(139, 92, 246, 0.05);
}

.upload-content {
    text-align: center;
}

.upload-icon {
    font-size: 4rem;
    color: var(--primary-accent);
    margin-bottom: 1.5rem;
}

.upload-content h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.upload-content p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.cta-btn {
    background: linear-gradient(135deg, var(--primary-accent), var(--secondary-accent));
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(139, 92, 246, 0.3);
}

/* Editor Interface */
.editor-interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
    height: 100%;
}

.hidden {
    display: none !important;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tool-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.tool-btn.active {
    background: var(--primary-accent);
    color: white;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.canvas-container {
    flex: 1;
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: crosshair;
}

canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 100%;
    max-height: 100%;
}

#imageCanvas {
    z-index: 1;
}

#maskCanvas {
    z-index: 2;
    opacity: 0.6;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    z-index: 10;
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    animation: fadeIn 0.3s;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Bottom Bar */
.bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
}

.secondary-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-main);
}

.primary-btn {
    background: linear-gradient(to right, var(--primary-accent), var(--secondary-accent));
    border: none;
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.3);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.primary-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(236, 72, 153, 0.5);
}

.download-btn {
    background: var(--success);
    border: none;
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Range Input Stylization */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 150px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--text-main);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.2s;
}

.modal-content {
    background: #1e293b;
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: 24px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    transform: scale(1);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.modal-header h2 {
    font-size: 1.5rem;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-modal:hover {
    color: var(--secondary-accent);
    background: rgba(255, 255, 255, 0.05);
}

.modal-body p {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: #cbd5e1;
}

.support-section {
    margin-top: 2rem;
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
}

.support-section p {
    margin-bottom: 1rem;
    font-weight: 500;
    color: var(--text-main);
}