:root {
    --bg-color: #0d1117;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --accent-color: #58a6ff;
    --accent-hover: #1f6feb;
    --glass-bg: rgba(22, 27, 34, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-bg: rgba(33, 38, 45, 0.6);
    --card-hover: rgba(48, 54, 61, 0.8);
    --blob-1: #238636;
    --blob-2: #8957e5;
    --blob-3: #1f6feb;
}

[data-theme="light"] {
    --bg-color: #f6f8fb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(0, 0, 0, 0.05);
    --card-bg: rgba(255, 255, 255, 0.8);
    --card-hover: rgba(255, 255, 255, 1);
    --blob-1: #10b981;
    --blob-2: #8b5cf6;
    --blob-3: #3b82f6;
}

[data-theme="cyberpunk"] {
    --bg-color: #0f0f1a;
    --text-primary: #0ff;
    --text-secondary: #f0f;
    --accent-color: #f0f;
    --accent-hover: #0ff;
    --glass-bg: rgba(15, 15, 26, 0.8);
    --glass-border: rgba(0, 255, 255, 0.2);
    --card-bg: rgba(20, 20, 35, 0.8);
    --card-hover: rgba(30, 30, 50, 0.9);
    --blob-1: #f0f;
    --blob-2: #0ff;
    --blob-3: #ff003c;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

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

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: float 20s infinite alternate ease-in-out;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: var(--blob-1);
    animation-delay: 0s;
}

.blob-2 {
    top: 40%;
    right: -20%;
    width: 40vw;
    height: 40vw;
    background: var(--blob-2);
    animation-delay: -5s;
}

.blob-3 {
    bottom: -20%;
    left: 20%;
    width: 45vw;
    height: 45vw;
    background: var(--blob-3);
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(5%, 10%) scale(1.1);
    }

    66% {
        transform: translate(-5%, 5%) scale(0.9);
    }

    100% {
        transform: translate(10%, -5%) scale(1.05);
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 2rem;
    position: relative;
    z-index: 1;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4rem;
}

.header-titles {
    text-align: left;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    color: var(--text-primary);
    background: var(--glass-bg);
}

h1 {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #79c0ff, #d2a8ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 1rem;
    letter-spacing: -1px;
}

header p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
}

.selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.nav-btn {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
}

.nav-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    background: var(--card-hover);
    border-color: var(--accent-color);
}

.nav-btn.active {
    background: linear-gradient(135deg, rgba(31, 111, 235, 0.2), rgba(137, 87, 229, 0.2));
    border-color: var(--accent-color);
    box-shadow: 0 0 20px rgba(88, 166, 255, 0.1);
}

.nav-btn .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
}

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



.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-height: 80vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* align-items: center; */
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
    gap: 1rem;
}

.panel-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.copy-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.copy-btn:active {
    transform: scale(0.95);
}

.copy-icon {
    width: 18px;
    height: 18px;
}

.output-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

.output-actions .action-btn {
    margin-top: 0;
}

.dropdown-wrapper {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.5rem;
    min-width: 200px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 50;
    display: flex;
    flex-direction: column;
}

.dropdown-menu.hidden {
    display: none;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    background: transparent;
    border: none;
    text-align: left;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background: var(--glass-bg);
    color: var(--accent-color);
}

.action-btn {
    background: rgba(88, 166, 255, 0.2);
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    color: var(--accent-color);
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.action-btn:hover {
    background: rgba(88, 166, 255, 0.4);
    transform: translateY(-2px);
}

.action-btn.danger {
    background: rgba(248, 81, 73, 0.2);
    border-color: #f85149;
    color: #f85149;
}

.action-btn.danger:hover {
    background: rgba(248, 81, 73, 0.4);
}

.action-btn.secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-btn.secondary:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem 0;
    font-style: italic;
}

.custom-template-list {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.custom-template-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-item-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.template-tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent-color);
    border: 1px solid rgba(88, 166, 255, 0.3);
}

.custom-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.header-tools {
    display: flex;
    gap: 0.5rem;
}


.custom-template-item:hover {
    border-color: var(--glass-border);
    background: rgba(0, 0, 0, 0.3);
}

.custom-template-item.active {
    border-color: var(--accent-color);
    background: rgba(88, 166, 255, 0.1);
}

.custom-template-item-tools {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 0.2rem;
}

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

.icon-btn.delete:hover {
    color: #f85149;
}

.template-content pre {
    background: rgba(0, 0, 0, 0.3) !important;
    border-radius: 12px !important;
    padding: 1.5rem !important;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid rgba(0, 0, 0, 0.5);
    margin: 0 !important;
    flex-grow: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.98);
    }
}

/* History Drawer */
.history-drawer {
    position: fixed;
    top: 0;
    right: -400px;
    width: 350px;
    height: 100vh;
    background: var(--bg-color);
    border-left: 1px solid var(--glass-border);
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: right 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.history-drawer.open {
    right: 0;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.history-container {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    border-color: var(--accent-color);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.history-item-content {
    font-size: 0.9rem;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.content-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
    align-items: start;
}

.form-group {
    margin-bottom: 1.5rem;
}

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

.form-control {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
    background: rgba(0, 0, 0, 0.4);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.suggestions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.suggestion-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--accent-color);
}

/* Auto Prompt & Select Custom Styles */
select.form-control.custom-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e6edf3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    padding-right: 2.5rem;
    cursor: pointer;
}

[data-theme="light"] select.form-control.custom-select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

[data-theme="cyberpunk"] select.form-control.custom-select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

select.form-control option {
    background: var(--bg-color);
    color: var(--text-primary);
}

select.form-control option:disabled {
    color: var(--text-secondary);
    font-style: italic;
}

.auto-prompt-section {
    background: rgba(88, 166, 255, 0.05);
    /* Slight tint of accent color */
    border-color: rgba(88, 166, 255, 0.2);
}

/* Wizard Options Grid and Buttons */
.wizard-options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.wizard-option-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.8rem 1.2rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.wizard-option-btn:hover {
    background: rgba(88, 166, 255, 0.1);
    border-color: rgba(88, 166, 255, 0.3);
    transform: translateY(-2px);
}

.wizard-option-btn.active {
    background: rgba(88, 166, 255, 0.25);
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(88, 166, 255, 0.15);
    font-weight: 500;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    .selection-grid {
        grid-template-columns: 1fr;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .glass-panel {
        padding: 1.5rem;
    }

    .auto-prompt-section>div {
        grid-template-columns: 1fr !important;
    }

    .wizard-options-grid {
        flex-direction: column;
    }
}