/* Navigation */
.navbar {
    height: 64px;
    border-bottom: 1px solid var(--bg-glass-border);
    background: var(--bg-glass);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.25rem;
}

.logo-icon {
    color: var(--accent-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 0.95rem;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

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

.btn-primary {
    background: var(--accent-primary);
    color: #fff;
    box-shadow: 0 0 15px rgba(88, 166, 255, 0.3);
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(88, 166, 255, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--bg-glass-border);
}

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

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

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

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Inputs & Textareas */
input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--bg-glass-border);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
}

textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.1);
}

/* Main Layout */
.main-content {
    padding-top: 32px;
    padding-bottom: 32px;
    flex: 1;
}

.chat-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    height: calc(100vh - 140px);
}

.input-section,
.output-section {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.section-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.badge {
    background: var(--accent-primary);
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.secondary {
    background: var(--accent-secondary);
}

/* Scene Selector Chips */
.scene-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.scene-selector label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.chips-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 2px;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none;
}

.chips-scroll::-webkit-scrollbar {
    display: none;
}

.chip {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--bg-glass-border);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    user-select: none;
}

.chip:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chip.active {
    background: var(--accent-primary);
    color: #fff;
    /* Explicit white text for active state */
    border-color: var(--accent-primary);
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.3);
}

/* Action Bar */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    gap: 16px;
}

.tone-selector {
    position: relative;
    flex: 1;
}

.tone-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    pointer-events: none;
}

.tone-selector select {
    padding-left: 40px;
}

/* Output Section */
.results-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.empty-state {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.empty-placeholder {
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.placeholder-icon {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

/* Result Card */
.result-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--bg-glass-border);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: fadeIn 0.3s ease-out;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-tag {
    font-size: 0.75rem;
    color: var(--accent-primary);
    background: rgba(88, 166, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.result-content {
    font-size: 1rem;
    white-space: pre-wrap;
    color: var(--text-primary);
}

.result-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.2s;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-glass-heavy);
    border: 1px solid var(--bg-glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

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

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Config List */
.config-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.config-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--bg-glass-border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.config-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

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

.config-info h5 {
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.config-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.config-actions {
    display: flex;
    gap: 8px;
    opacity: 0.6;
}

.config-item:hover .config-actions {
    opacity: 1;
}

/* Form Styles inside Modal */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 2000;
    transition: transform 0.3s, opacity 0.3s;
    border: 1px solid var(--bg-glass-border);
}

.toast.hidden {
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
}

/* Tabs */
.modal-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: var(--radius-md);
}

.tab-btn {
    padding: 6px 16px;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--accent-primary);
    color: #fff;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.2s ease-out;
}

.tab-pane.active {
    display: block;
}

/* Overlay Form */
.overlay-form {
    /* If we want it to overlay the list content fully */
    width: 100%;
    height: 100%;
}

/* PWA Install Banner */
.install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-glass-heavy);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--bg-glass-border);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 900;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
}

.install-banner.hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

.install-banner-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.install-banner-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

.install-banner-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.3);
}

.install-banner-icon i {
    width: 24px;
    height: 24px;
}

.install-banner-text h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.install-banner-text p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.install-banner-actions {
    display: flex;
    gap: 12px;
}

.install-banner-btn {
    flex: 1;
    height: 48px;
    font-size: 1rem;
    border-radius: 12px;
}

/* Responsive adjustment for desktop */
@media (min-width: 768px) {
    .install-banner {
        width: 400px;
        left: 24px;
        bottom: 24px;
        border: 1px solid var(--bg-glass-border);
        border-radius: var(--radius-lg);
    }
    
    .install-banner.hidden {
        transform: translate(-20px, 20px);
    }
}