/* Telegram Username Editor - فارسی */
.tg-container {
    max-width: 500px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    font-family: yekanbakh, sans-serif;
    direction: rtl;
}

.tg-msg {
    padding: 12px 16px;
    text-align: center;
    font-size: 14px;
    border-bottom: 1px solid;
}

.tg-msg.success {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.tg-msg.error {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

/* Header */
.tg-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #0088cc;
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
}

.tg-header-content {
    display: flex;
    align-items: center;
    width: 100%;
}

.tg-back {
    color: white;
    text-decoration: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.tg-title {
    flex: 1;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
}

.tg-save {
    background: transparent;
    border: none;
    color: white;
    font-size: 17px;
    opacity: 0.5;
    cursor: not-allowed;
    padding: 8px 16px;
}

.tg-save:enabled {
    opacity: 1;
    cursor: pointer;
    font-weight: 500;
}

/* Top section */
.tg-top-section {
    background: white;
    padding: 20px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.tg-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 16px;
    display: block;
}

/* Field */
.tg-field {
    display: flex;
    align-items: center;
    background: transparent;
    border: none;
    margin-bottom: 8px;
    direction: ltr;
}

.tg-prefix {
    padding: 0 12px;
    font-size: 16px;
    color: #666;
    height: 48px;
    display: flex;
    align-items: center;
    border-right: none;
    font-family: monospace;
    white-space: nowrap;
}

.tg-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0 12px;
    height: 48px;
    font-size: 16px;
    font-family: monospace;
    color: #000;
    outline: none;
    width: 100%;
    border-bottom: 2px solid #e0e0e0;
}

.tg-input:focus {
    border-bottom-color: #0088cc;
}

.tg-input::placeholder {
    color: #999;
}

/* Message Area */
.tg-message {
    font-size: 13px;
    padding: 8px 0;
    min-height: 20px;
    text-align: right;
}

.tg-message.error {
    color: #f44336;
}

.tg-message.success {
    color: #4caf50;
}

.tg-message.loading {
    color: #666;
}

/* Loading dots animation */
.tg-loading-dots {
    display: inline-block;
}

.tg-loading-dots span {
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #666;
    margin: 0 1px;
    animation: tgDotPulse 1.4s infinite ease-in-out both;
}

.tg-loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.tg-loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes tgDotPulse {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Bottom section */
.tg-bottom-section {
    background: #f0f0f0;
    min-height: 300px;
}

.tg-content {
    padding: 20px 16px;
}

.tg-help {
    font-size: 14px;
    color: #666;
    line-height: 1.8;
    margin-bottom: 12px;
    background: white;
    padding: 16px;
    border-radius: 8px;
}

.tg-info-text {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    background: white;
    padding: 16px;
    border-radius: 8px;
}

/* Form */
#tgForm {
    display: none;
}

/* Responsive */
@media (max-width: 600px) {
    .tg-container {
        margin: 0;
    }
}