:root {
    --primary: #F59E0B;
    /* Amber 500 */
    --primary-hover: #D97706;
    /* Amber 600 */
    --accent: #8B5CF6;
    /* Violet 500 */

    --bg-main: #0F172A;
    /* Slate 900 */
    --bg-panel: rgba(30, 41, 59, 0.7);
    /* Slate 800 with opacity */
    --bg-card: rgba(30, 41, 59, 0.4);

    --text-main: #F8FAFC;
    --text-muted: #94A3B8;

    --border: rgba(255, 255, 255, 0.1);
    --border-highlight: rgba(245, 158, 11, 0.3);

    --font-ui: 'Inter', system-ui, sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-ui);
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    position: relative;
    /* Ambient glow */
    background-image:
        radial-gradient(circle at 15% 50%, rgba(245, 158, 11, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.08) 0%, transparent 40%);
}

.glass {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--border);
    border-left: 1px solid var(--border);
}

.app-layout {
    display: grid;
    grid-template-columns: 240px 1fr 300px;
    height: 100%;
}

@media (max-width: 1024px) {
    .app-layout {
        grid-template-columns: 80px 1fr 300px;
    }

    .brand h2,
    .nav-btn text {
        display: none;
    }

    .sidebar-actions {
        padding: 1rem 0.5rem;
    }
}

@media (max-width: 768px) {
    .app-layout {
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
    }

    .app-layout>* {
        border: none !important;
        border-bottom: 1px solid var(--border) !important;
        width: 100% !important;
    }

    .sidebar {
        order: 1;
        height: auto;
    }

    .workspace {
        order: 2;
        height: 500px;
    }

    .inspector {
        order: 3;
        height: auto;
    }
}

/* Base Typo & Utils */
.text-sm {
    font-size: 0.85rem;
}

.text-muted {
    color: var(--text-muted);
}

.w-full {
    width: 100%;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.hidden {
    display: none !important;
}

.scrollable {
    overflow-y: auto;
}

.padding-md {
    padding: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary.shadow-glow {
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-ghost {
    background: transparent;
    color: var(--text-main);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-danger:hover {
    color: #EF4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.brand {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.logo-box {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-menu {
    flex: 1;
    padding: 1.5rem 0.5rem;
}

.nav-btn {
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
}

.nav-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
    color: var(--primary);
    background: rgba(245, 158, 11, 0.1);
}

.sidebar-actions {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border-top: 1px solid var(--border);
}

/* Workspace */
.workspace {
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.3);
}

.toolbar {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border);
}

.toolbar>div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.view-toggles {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    padding: 2px;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.4rem 1rem;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
}

.toggle-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.preview-area {
    flex: 1;
    position: relative;
}

/* Inspector */
.inspector {
    display: flex;
    flex-direction: column;
    z-index: 10;
    padding: 1.5rem;
}

.panel-header {
    margin-bottom: 1.5rem;
}

.panel-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

input[type="text"],
input[type="number"],
textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus {
    border-color: var(--primary);
}

textarea {
    resize: vertical;
}

.upload-btn {
    cursor: pointer;
}

/* Radio Cards (Style Options) */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
}

.radio-card {
    cursor: pointer;
    position: relative;
}

.radio-card input {
    position: absolute;
    opacity: 0;
}

.card-content {
    display: block;
    text-align: center;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.radio-card input:checked+.card-content {
    border-color: var(--primary);
    background: rgba(245, 158, 11, 0.1);
    color: var(--primary);
}

/* Color Picker */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: 1px solid var(--border);
    border-radius: 4px;
}

/* Grid Layout vs Single Layout */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

.cards-single {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.cards-single .t-card-wrapper {
    max-width: 600px;
    width: 100%;
}

/* Testimonial Card Wrapper in Builder */
.t-card-wrapper {
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
}

.t-card-wrapper:hover {
    transform: translateY(-4px);
}

.t-card-wrapper.selected {
    outline: 2px solid var(--primary);
    outline-offset: 4px;
    border-radius: var(--radius-md);
}

/* Base Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-main);
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal h2 {
    margin-bottom: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* Raw code output in modal */
.code-output {
    width: 100%;
    height: 200px;
    background: #000;
    color: #10B981;
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    resize: none;
}