/* ======================================= */
/*       DEV MODE - Dark Theme             */
/* ======================================= */

/* Force dark theme for dev mode */
[data-mode="dev"] {
    --bg: #0f172a;
    --component-bg: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --hover-bg: rgba(255, 255, 255, 0.05);
    --background: #0f172a;
    --secondary-bg: #1e293b;
    --primary: #10b981;
    --primary-hover: #059669;
}

/* Override light theme completely in dev mode */
[data-theme="light"][data-mode="dev"] {
    --background: #0f172a;
    --secondary-bg: #1e293b;
    --component-bg: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --primary: #10b981;
    --primary-hover: #059669;
}

/* Override header in dev mode */
[data-mode="dev"] .app-header {
    background: #1e293b;
    border-bottom-color: #334155;
}

[data-mode="dev"] .mode-switch {
    background: #0f172a;
    border-color: #334155;
}

[data-mode="dev"] .mode-btn {
    color: #64748b;
}

[data-mode="dev"] .mode-btn:hover {
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.05);
}

[data-mode="dev"] .mode-btn.active {
    background: #10b981;
    color: #fff;
}

[data-mode="dev"] .header-icon-btn {
    color: #94a3b8;
}

[data-mode="dev"] .header-icon-btn:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.05);
}

[data-mode="dev"] .profile-dropdown {
    background: #1e293b;
    border-color: #334155;
}

[data-mode="dev"] .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Container */
.dev-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Section Header */
.section-header {
    text-align: center;
    margin-bottom: 2rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.section-title h1 {
    font-size: inherit;
    font-weight: inherit;
    margin: 0;
}

.section-icon {
    font-size: 1.25rem;
    color: #10b981;
}

.section-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Service Selector */
.service-selector {
    display: flex;
    justify-content: center;
    gap: 0;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.service-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.service-tab:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.05);
}

.service-tab.active {
    background: #10b981;
    color: #ffffff;
}

.tab-icon {
    font-size: 0.95rem;
}

.tab-text {
    white-space: nowrap;
}

/* Service Panel */
.service-panel {
    display: none;
}

.service-panel.active {
    display: block;
    animation: fadeInPanel 0.3s ease;
}

@keyframes fadeInPanel {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Service Card */
.service-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 16px;
    padding: 2rem;
    transition: border-color 0.2s ease;
}

.service-card:hover {
    border-color: #10b981;
}

.service-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 0.5rem;
}

.service-description {
    font-size: 0.9rem;
    color: #94a3b8;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Input Section */
.input-section {
    margin-bottom: 1.5rem;
}

.input-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 0.75rem;
}

.label-icon {
    font-size: 0.9rem;
    color: #10b981;
}

.dev-textarea {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 1px solid #334155;
    border-radius: 12px;
    background: #0f172a;
    color: #f1f5f9;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.2s ease;
    direction: rtl;
    box-sizing: border-box;
}

.dev-textarea:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.dev-textarea::placeholder {
    color: #64748b;
}

.edit-textarea {
    flex: 1;
}

.char-counter {
    text-align: left;
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 0.5rem;
}

/* Generate Button */
.generate-btn-dev {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.9rem;
    background: #10b981;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.generate-btn-dev:hover {
    background: #059669;
    transform: translateY(-1px);
}

.generate-btn-dev:active {
    transform: translateY(0);
}

.generate-btn-dev:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.edit-btn {
    width: auto;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
}

.btn-icon {
    font-size: 1rem;
}

.btn-loader {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* PRD Edit Section */
.prd-edit-section {
    padding: 1.25rem;
    border-top: 1px solid #334155;
}

.edit-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

/* Result Section */
.result-section {
    margin-top: 1.5rem;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 14px;
    overflow: hidden;
    animation: fadeInPanel 0.4s ease;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #334155;
}

.result-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #f1f5f9;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: transparent;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: #10b981;
    color: #10b981;
}

.result-content {
    padding: 1.25rem;
    font-size: 0.95rem;
    line-height: 1.8;
    color: #f1f5f9;
    white-space: pre-wrap;
    word-wrap: break-word;
    direction: rtl;
}

.result-content.markdown-formatted {
    white-space: normal;
}

.result-content.markdown-formatted h1,
.result-content.markdown-formatted h2,
.result-content.markdown-formatted h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.result-content.markdown-formatted ul,
.result-content.markdown-formatted ol {
    padding-right: 1.5rem;
    margin: 0.5rem 0;
}

.result-content.markdown-formatted code {
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88em;
    color: #34d399;
}

.result-content.markdown-formatted pre {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    direction: ltr;
    text-align: left;
}

.result-content.markdown-formatted pre code {
    background: transparent;
    padding: 0;
    color: #e2e8f0;
}

/* Toast Override for Dev */
[data-mode="dev"] .toast {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #334155;
}

/* History Sidebar */
.history-sidebar {
    position: fixed;
    top: 56px;
    left: -350px;
    width: 320px;
    height: calc(100vh - 56px);
    background: #1e293b;
    border-right: 1px solid #334155;
    z-index: 999;
    transition: left 0.3s ease;
    padding: 1.5rem;
    overflow-y: auto;
}

.history-sidebar.open {
    left: 0;
}

.history-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #f1f5f9;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Override suggested tools for dev mode */
[data-mode="dev"] .suggested-tools {
    border-top-color: #334155;
}

[data-mode="dev"] .tool-link {
    background: rgba(255, 255, 255, 0.05);
    border-color: #334155;
    color: #f1f5f9;
}

[data-mode="dev"] .tool-link:hover {
    border-color: #10b981;
}

/* Font Awesome icon in tools */
.tool-icon-fa {
    font-size: 0.9rem;
    color: #94a3b8;
}

/* Responsive */
@media (max-width: 768px) {
    .dev-container {
        padding: 1.5rem 1rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .service-selector {
        flex-direction: column;
        max-width: 100%;
    }

    .service-card {
        padding: 1.5rem;
    }

    .edit-row {
        flex-direction: column;
    }

    .edit-btn {
        width: 100%;
    }
}