/* ======================================= */
/*     TEXT MODE - Brand Indigo Theme      */
/* ======================================= */

[data-mode="text"] {
    --text-primary: #184243;
    --text-primary-hover: #102b2c;
}

[data-theme="dark"][data-mode="text"] {
    --text-primary: #D0C9B9;
    --text-primary-hover: #aea797;
}

/* Container */
.text-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: var(--primary);
}

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

/* Service Selector */
.service-selector {
    display: flex;
    justify-content: center;
    gap: 0;
    background: var(--component-bg);
    border: 1px solid var(--border-color);
    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: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.service-tab:hover {
    color: var(--text);
    background: var(--secondary-bg);
}

.service-tab.active {
    background: var(--primary);
    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: var(--component-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    transition: border-color 0.2s ease;
}

.service-card:hover {
    border-color: var(--primary);
}

.service-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.service-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    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: var(--text);
    margin-bottom: 0.75rem;
}

.label-icon {
    font-size: 0.9rem;
    color: var(--primary);
}

.text-textarea {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--secondary-bg);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.2s ease;
    direction: rtl;
    box-sizing: border-box;
}

.text-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(24, 66, 67, 0.1);
}

[data-theme="dark"] .text-textarea:focus {
    box-shadow: 0 0 0 3px rgba(208, 201, 185, 0.1);
}

.text-textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.char-counter {
    text-align: left;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Options Row */
.options-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.option-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.toggle-button-group {
    display: flex;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.toggle-button {
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.toggle-button.active {
    background: var(--primary);
    color: #fff;
}

/* Generate Button */
.generate-btn-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.9rem;
    background: var(--primary);
    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-text:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

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

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

.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);
    }
}

/* Result Section */
.result-section {
    margin-top: 1.5rem;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    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 var(--border-color);
}

.result-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.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 var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.action-btn:hover {
    background: var(--component-bg);
    border-color: var(--primary);
    color: var(--primary);
}

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

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--component-bg);
    color: var(--text);
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-size: 0.88rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    z-index: 9999;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* History Sidebar */
.history-sidebar {
    position: fixed;
    top: 56px;
    left: -350px;
    width: 320px;
    height: calc(100vh - 56px);
    background: var(--component-bg);
    border-right: 1px solid var(--border-color);
    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: var(--text);
}

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

/* Font Awesome icon in tools */
.tool-icon-fa {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

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

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

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

    .service-card {
        padding: 1.5rem;
    }

    .options-row {
        flex-direction: column;
        align-items: flex-start;
    }
}