/* Reset & Core variables */
:root {
    --bg-dark: hsl(220, 24%, 6%);
    --panel-dark: hsla(220, 24%, 10%, 0.8);
    --border-color: hsla(220, 20%, 20%, 0.5);
    --border-glow: hsla(263, 80%, 60%, 0.2);
    
    --text-primary: hsl(210, 20%, 95%);
    --text-secondary: hsl(215, 15%, 70%);
    --text-muted: hsl(215, 12%, 45%);
    
    --accent-indigo: hsl(263, 80%, 60%);
    --accent-emerald: hsl(150, 80%, 45%);
    --accent-rose: hsl(340, 85%, 55%);
    --accent-amber: hsl(35, 90%, 50%);
    --accent-violet: hsl(280, 85%, 60%);
    
    --active-accent: var(--accent-indigo);
    --active-accent-rgb: 124, 58, 237; /* indigo */
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
}

/* Scrollbar styles */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: hsla(220, 24%, 6%, 0.3);
}
::-webkit-scrollbar-thumb {
    background: hsla(220, 20%, 30%, 0.5);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--active-accent);
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: relative;
    background: radial-gradient(circle at 80% 20%, hsla(263, 80%, 40%, 0.08), transparent 45%),
                radial-gradient(circle at 15% 70%, hsla(180, 80%, 40%, 0.05), transparent 40%);
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    background-color: hsla(220, 24%, 6%, 0.7);
    backdrop-filter: blur(12px);
    z-index: 50;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--active-accent), hsl(180, 80%, 50%));
    border-radius: 8px;
    box-shadow: 0 0 15px hsla(263, 80%, 60%, 0.4);
    position: relative;
    overflow: hidden;
}

.logo-icon::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: rotate(45deg);
    animation: shine 4s infinite linear;
}

@keyframes shine {
    0% { transform: translate(-100%, -100%) rotate(45deg); }
    100% { transform: translate(100%, 100%) rotate(45deg); }
}

.logo-text h1 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.logo-text h1 span {
    background: linear-gradient(135deg, var(--active-accent), hsl(180, 80%, 50%));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.version-badge {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--active-accent), hsla(var(--active-accent-rgb), 0.8));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px hsla(var(--active-accent-rgb), 0.4);
}

.btn-glow {
    box-shadow: 0 0 10px hsla(var(--active-accent-rgb), 0.2);
}

.btn-secondary {
    background-color: hsla(220, 20%, 18%, 0.8);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: hsla(220, 20%, 25%, 0.8);
    border-color: var(--active-accent);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--border-color);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-large {
    padding: 14px 28px;
    font-size: 16px;
    border-radius: 10px;
}

/* Wallet icon inside button */
.wallet-icon {
    width: 14px;
    height: 14px;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 18V19C21 20.1 20.1 21 19 21H5C3.89 21 3 20.1 3 19V5C3 3.9 3.89 3 5 3H19C20.1 3 21 3.9 21 5V6H12C10.9 6 10 6.9 10 8V16C10 17.1 10.9 18 12 18H21ZM12 16H22V8H12V16ZM16 13.5C15.17 13.5 14.5 12.83 14.5 12C14.5 11.17 15.17 10.5 16 10.5C16.83 10.5 17.5 11.17 17.5 12C17.5 12.83 16.83 13.5 16 13.5Z'/%3E%3C/svg%3E") no-repeat center;
    mask-size: contain;
}

/* Workspace */
.app-workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background-color: var(--panel-dark);
    border-right: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 10;
}

.sidebar-section {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-section h3 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Component selection grid */
.component-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comp-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background-color: hsla(220, 20%, 15%, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.comp-btn:hover {
    background-color: hsla(220, 20%, 20%, 0.6);
    color: var(--text-primary);
    border-color: hsla(var(--active-accent-rgb), 0.3);
}

.comp-btn.active {
    background-color: hsla(var(--active-accent-rgb), 0.1);
    color: var(--text-primary);
    border-color: var(--active-accent);
    box-shadow: 0 0 10px hsla(var(--active-accent-rgb), 0.15);
}

.btn-icon {
    font-size: 16px;
}

/* Customizer controls */
.control-group {
    margin-bottom: 20px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.control-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.control-val {
    font-size: 12px;
    font-weight: 700;
    color: var(--active-accent);
    background: hsla(var(--active-accent-rgb), 0.15);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Range sliders */
.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: hsla(220, 20%, 20%, 0.8);
    outline: none;
    transition: var(--transition-smooth);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--active-accent);
    cursor: pointer;
    box-shadow: 0 0 8px var(--active-accent);
    transition: var(--transition-smooth);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 12px var(--active-accent);
}

/* Accent Color Dot Picker */
.theme-picker {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition-smooth);
}

.color-dot:hover {
    transform: scale(1.1);
}

.color-dot.active {
    border-color: white;
    transform: scale(1.15);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Switches / Toggles */
.toggle-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: hsla(220, 20%, 20%, 0.8);
    transition: .4s;
    border-radius: 24px;
    border: 1px solid var(--border-color);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--active-accent);
}

input:focus + .toggle-slider {
    box-shadow: 0 0 1px var(--active-accent);
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Sidebar footer price box */
.sidebar-footer {
    margin-top: auto;
    padding: 24px;
    border-top: 1px solid var(--border-color);
    background-color: hsla(220, 24%, 8%, 0.5);
}

.price-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.price-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 700;
}

.price-value {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.sol-price {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
}

.usd-equivalent {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Editor & Preview Pane */
.editor-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: hsla(220, 24%, 4%, 0.95);
    overflow: hidden;
}

.pane-tabs {
    display: flex;
    background-color: hsla(220, 24%, 6%, 0.5);
    border-bottom: 1px solid var(--border-color);
    padding: 0 12px;
}

.tab-btn {
    padding: 16px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--active-accent);
    border-bottom-color: var(--active-accent);
}

.tab-content {
    flex: 1;
    display: none;
    overflow: hidden;
    position: relative;
}

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

/* Live Preview Content */
.preview-viewport-container {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: hsl(220, 24%, 3%);
    background-image: 
        radial-gradient(hsla(220, 20%, 15%, 0.4) 1px, transparent 0),
        radial-gradient(hsla(220, 20%, 15%, 0.4) 1px, transparent 0);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

#preview-frame {
    width: 100%;
    height: 100%;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: transparent;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    transition: var(--transition-smooth);
}

/* Code Display & Checkout Overlay */
.code-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background-color: hsla(220, 24%, 6%, 0.8);
    border-bottom: 1px solid var(--border-color);
}

.code-title {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);
}

.code-display {
    flex: 1;
    padding: 24px;
    margin: 0;
    background-color: hsla(220, 24%, 3%, 0.95);
    overflow: auto;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
    color: hsl(210, 20%, 80%);
}

#code-content {
    font-family: var(--font-mono);
    white-space: pre-wrap;
}

/* Lock overlay */
.lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: hsla(220, 24%, 3%, 0.7);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.lock-card {
    background-color: hsla(220, 24%, 8%, 0.9);
    border: 1px solid var(--border-color);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), 0 0 30px hsla(var(--active-accent-rgb), 0.05);
    border-radius: 16px;
    padding: 40px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: bounceIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceIn {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.lock-icon {
    font-size: 48px;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.lock-card h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.lock-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 24px;
}

.benefit-list {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 30px;
    width: 100%;
    padding: 0 12px;
}

.benefit-item {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.dest-wallet {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 16px;
    display: block;
}

.dest-wallet code {
    font-family: var(--font-mono);
    color: var(--active-accent);
    background: hsla(var(--active-accent-rgb), 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: hsla(220, 24%, 8%, 0.95);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    border-radius: 16px;
    width: 90%;
    max-width: 440px;
    overflow: hidden;
    animation: modalSlide 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes modalSlide {
    0% { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 30px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loader {
    width: 40px;
    height: 40px;
    border: 3px solid hsla(var(--active-accent-rgb), 0.15);
    border-top-color: var(--active-accent);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.status-icon {
    display: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
}

.status-icon.success {
    background-color: rgba(16, 185, 129, 0.15);
    border: 2px solid var(--accent-emerald);
    color: var(--accent-emerald);
}

.status-icon.error {
    background-color: rgba(239, 68, 68, 0.15);
    border: 2px solid var(--accent-rose);
    color: var(--accent-rose);
}

.modal-body p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.tx-link-wrapper {
    display: none;
    margin-top: 8px;
}

.tx-link-wrapper a {
    color: var(--active-accent);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.tx-link-wrapper a:hover {
    text-decoration: underline;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* Layout List & Page Builder UI */
.layout-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
    max-height: 180px;
    overflow-y: auto;
}

.layout-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: hsla(220, 20%, 14%, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.layout-item:hover {
    border-color: hsla(var(--active-accent-rgb), 0.5);
    color: var(--text-primary);
    background-color: hsla(220, 20%, 16%, 0.6);
}

.layout-item-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.layout-item-controls {
    display: flex;
    gap: 2px;
}

.layout-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    transition: var(--transition-smooth);
}

.layout-btn:hover {
    color: var(--text-primary);
    background-color: hsla(220, 20%, 25%, 0.5);
}

.layout-btn.delete-btn:hover {
    color: var(--accent-rose);
    background-color: hsla(340, 85%, 55%, 0.1);
}

.layout-empty-text {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 12px 0;
    border: 1px dashed var(--border-color);
    border-radius: 6px;
}

