:root {
  --primary-color: #3390ec;
  --primary-hover: #2883d9;
  --bg-color: #ffffff;
  --secondary-bg: #f4f4f5;
  --text-color: #000000;
  --text-secondary: #707579;
  --border-color: #dfe1e5;
  --input-bg: #ffffff;
  --input-focus-border: #3390ec;
  --danger-color: #e53935;
  --warning-color: #fb8c00;
  --success-color: #4caf50;
  --radius: 8px;
  --spacing: 16px;
}

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

body {
  font-family: "Vazirmatn", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  direction: rtl;
  line-height: 1.5;
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding-bottom: 50px;
}

/* Header */
.main-header {
  display: flex;
  justify-content: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1000px;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 24px;
  color: var(--primary-color);
}

.logo-section h1 {
  font-size: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.divider {
  color: var(--text-secondary);
}

.current-page {
  font-weight: 700;
}

.user-section {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

.budget {
  font-weight: 500;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-color);
  cursor: pointer;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

/* Main Content */
.main-content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px;
}

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

.page-header h2 {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  font-size: 12px;
  background-color: var(--secondary-bg);
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: normal;
}

.target-selector {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tabs {
  background-color: var(--secondary-bg);
  padding: 4px;
  border-radius: 20px;
  display: flex;
}

.tab-btn {
  border: none;
  background: none;
  padding: 6px 16px;
  border-radius: 16px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.tab-btn.active {
  background-color: var(--primary-color);
  color: white;
}

.tab-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

/* Layout */
.creation-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

/* Form Styles */
.form-group {
  margin-bottom: 24px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-color);
}

.info-icon {
  color: var(--text-secondary);
  cursor: help;
  font-size: 12px;
}

input[type="text"],
input[type="url"],
input[type="number"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.2s;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--input-focus-border);
}

.ltr-input {
  direction: ltr;
  text-align: left;
}

.helper-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.checkbox-group label {
  margin-bottom: 0;
  font-weight: normal;
}

.upload-btn {
  width: 100%;
  padding: 12px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s;
}

.upload-btn:hover {
  background-color: var(--primary-hover);
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.currency-icon {
  position: absolute;
  right: 12px;
  color: var(--text-secondary);
}

.input-with-icon input {
  padding-right: 36px;
}

.approx-value {
  position: absolute;
  left: 12px;
  color: var(--text-secondary);
  font-size: 13px;
}

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

.link-action {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 13px;
}

.link-action:hover {
  text-decoration: underline;
}

.segment-control {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.segment-control label {
  flex: 1;
  margin: 0;
  text-align: center;
  cursor: pointer;
  position: relative;
}

.segment-control input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.segment-control span {
  display: block;
  padding: 10px;
  background: var(--bg-color);
  border-left: 1px solid var(--border-color);
  transition: background-color 0.2s;
}

.segment-control label:last-child span {
  border-left: none;
}

.segment-control input:checked + span {
  background-color: var(--primary-color);
  color: white;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-group label {
  font-weight: normal;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

.indented {
  margin-right: 24px;
  display: block;
  margin-top: 4px;
}

/* Tag Input Styles */
.input-tag-wrapper {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.tags-input-container {
  flex-grow: 1;
  min-height: 42px;
  padding: 4px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background-color: var(--input-bg);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  transition: border-color 0.2s;
}

.tags-input-container:focus-within {
  border-color: var(--input-focus-border);
}

.tag-item {
  background-color: var(--primary-color);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tag-remove {
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  line-height: 1;
  opacity: 0.8;
}

.tag-remove:hover {
  opacity: 1;
}

.tag-input {
  border: none !important;
  padding: 6px 8px !important;
  flex-grow: 1;
  min-width: 150px;
  background: transparent;
  height: 32px;
}

.tag-input:focus {
  box-shadow: none;
}

.add-tag-btn {
  padding: 0 16px;
  height: 42px;
  background-color: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-color);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s;
  white-space: nowrap;
}

.add-tag-btn:hover {
  background-color: #e4e4e5;
}

.dynamic-summary {
  margin-top: 12px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-color);
}

.dynamic-summary .icon {
  font-size: 18px;
  line-height: 1.2;
}

.icon.green {
  color: var(--success-color);
}

/* Preview Section */
.preview-section {
  padding-top: 20px;
}

.preview-container h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.preview-card-wrapper {
  background-image: url("assets/images/telegram-bg.png"); /* Local background */
  background-color: #99ba92; /* Fallback color */
  background-size: cover;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 24px;
}

.preview-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  max-width: 320px;
  margin: 0 auto;
}

.preview-header {
  padding: 8px 12px;
  display: flex;
  align-items: center;
}

.preview-channel-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.channel-avatar {
  width: 36px;
  height: 36px;
  background-color: #ccc;
  border-radius: 50%;
}

.channel-text {
  line-height: 1.2;
}

.channel-name {
  font-weight: 600;
  font-size: 14px;
}

.post-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.preview-content {
  padding: 0 12px 12px;
}

.preview-image-placeholder {
  width: 100%;
  height: 150px;
  background-color: #f0f2f5;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-size: 14px;
}

#previewText {
  font-size: 15px;
  white-space: pre-wrap;
}

.preview-footer {
  padding: 8px 12px;
  border-top: 1px solid #f0f2f5;
}

.preview-cta-btn {
  width: 100%;
  background-color: #f5fcfeb5; /* Light blueish tint */
  color: var(--primary-color);
  border: none;
  padding: 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

/* Warnings */
.warnings {
  margin-top: 16px;
  font-size: 13px;
}

.warning-item {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  align-items: flex-start;
}

.warning-item .icon {
  font-size: 16px;
  flex-shrink: 0;
}

.warning-item .icon.red {
  color: var(--danger-color);
}
.warning-item .icon.orange {
  color: var(--warning-color);
}

/* Bottom Actions */
.bottom-actions {
  border-top: 1px solid var(--border-color);
  margin-top: 40px;
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.terms-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.terms-checkbox a {
  color: var(--primary-color);
  text-decoration: none;
}

.action-buttons {
  display: flex;
  gap: 16px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary-color);
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  transition: background-color 0.2s;
}

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

/* Native Ad Preview Styles */
.native-ad-container {
    padding: 12px 16px;
    direction: ltr; /* Structural LTR */
    background-color: #f1f7fa; /* Light blue tint like Telegram */
    position: relative;
    border-radius: 0 10px 10px 0; /* Rounded right corners */
    min-height: 80px;
    display: flex;
    flex-direction: column;
}

/* Blue accent line on the left */
.preview-card.native-mode {
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    background-color: #f1f7fa;
    padding-left: 4px; /* Space for the blue line */
}

.preview-card.native-mode::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: #3390ec;
    z-index: 1;
}

.native-ad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.native-ad-badge-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.native-ad-label {
    color: #3390ec;
    font-weight: 500;
    font-size: 15px;
}

.native-ad-info {
    background-color: #ebf3f8;
    color: #6d7f8f; /* Darker grey-blue */
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: default;
    white-space: nowrap;
}

.native-ad-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 60%;
    justify-content: flex-end;
}

.native-ad-avatar {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    background-color: #ccc;
    background-image: url('assets/images/placeholder.png');
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.native-ad-title {
    font-size: 14px;
    font-weight: 600;
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
    direction: rtl;
    opacity: 0.8;
}

.native-ad-text {
    font-size: 15px;
    color: #000;
    line-height: 1.5;
    white-space: pre-wrap;
    direction: rtl;
    text-align: right;
    margin-bottom: 12px;
    flex-grow: 1;
}

/* Adjustments for Native Mode Card */
.preview-card.native-mode .preview-header {
    display: none;
}

.preview-card.native-mode .preview-content {
    padding: 0; /* Remove default padding */
}

.preview-card.native-mode .preview-footer {
    border-top: 1px solid rgba(51, 144, 236, 0.15); /* Subtle separator */
    background-color: #f1f7fa; /* Match card bg */
    padding: 0;
    margin-left: 4px; /* Align with content past the blue line */
}

.preview-card.native-mode .preview-cta-btn {
    background-color: transparent;
    color: #3390ec;
    border-radius: 0;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    width: 100%;
    text-align: center;
    letter-spacing: 0.5px;
}

.preview-card.native-mode .preview-cta-btn:hover {
    background-color: rgba(51, 144, 236, 0.08);
}

/* Media Upload Styles */
.media-upload-container {
    position: relative;
    width: 100%;
}

.media-preview-box {
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background-color: #000;
    margin-bottom: 8px;
}

.media-content-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
}

.media-content-wrapper img,
.media-content-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover; /* or contain based on preference, cover fills 16:9 */
}

.delete-media-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    z-index: 10;
}

.delete-media-btn:hover {
    background-color: rgba(229, 57, 53, 0.8);
}

.change-media-btn {
    width: 100%;
    padding: 10px;
    background-color: #3390ec;
    color: white;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.change-media-btn:hover {
    background-color: #2883d9;
}

/* Search Preview Styles */
.preview-card-search {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    direction: ltr; /* Telegram UI is usually LTR even for Persian content in search lists sometimes, but let's keep it consistent. */
}

.search-header {
    background-color: #f5f5f5; /* Light gray like Telegram */
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #707579;
}

.search-icon {
    font-size: 16px;
    color: #707579;
}

.search-text {
    font-size: 14px;
    font-weight: 500;
    color: #707579;
}

.search-results {
    padding: 0;
    background: white;
}

.global-search-label {
    background-color: #f4f4f5;
    color: #707579;
    font-size: 13px;
    padding: 8px 16px;
    font-weight: 500;
    text-transform: uppercase;
}

.search-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    gap: 12px;
    background: white;
    cursor: default;
}

.search-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    background-color: #5ea6e9; /* Telegram blue avatar bg */
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: 600;
    flex-shrink: 0;
}

.search-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0; /* Text truncation fix */
}

.search-title {
    font-weight: 600;
    font-size: 16px;
    color: #000;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-subtitle {
    font-size: 14px;
    color: #8e959b; /* Muted gray */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-ad-badge {
    background-color: #ebf5fa; /* Light blue badge bg */
    color: #2481cc; /* Telegram blue */
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    flex-shrink: 0;
}

/* Empty State */
.preview-card-empty {
    width: 100%;
    height: 200px;
    background-color: #f5f5f5;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    text-align: center;
    padding: 20px;
    border: 1px dashed #ccc;
    font-size: 14px;
}

.search-placeholder-lines {
    padding: 10px 16px;
    opacity: 0.5;
}

.line {
    height: 10px;
    background-color: #f0f2f5;
    border-radius: 5px;
    margin-bottom: 10px;
}

.line.long { width: 85%; }
.line.medium { width: 65%; }
.line.short { width: 45%; }
/* Bot Preview Styles */
.preview-card-bot {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    font-family: 'Vazirmatn', sans-serif !important; /* Ensure Vazirmatn is applied */
    direction: ltr; /* Reset to LTR for layout structure */
}

.bot-preview-ad-area {
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid #f0f0f0;
}

.bot-ad-badge {
    color: #3390ec;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 8px;
    display: inline-flex; /* Use inline-flex for better alignment */
    align-items: center; /* Center content vertically */
}

.bot-ad-badge::after {
    content: "what's this?";
    color: #aeb4b9;
    font-weight: 400;
    font-size: 11px;
    margin-left: 6px;
    background: #ebf3f8;
    padding: 1px 5px;
    border-radius: 4px;
    display: inline-block;
    white-space: nowrap; /* Prevent breaking */
}

.bot-ad-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.bot-ad-text {
    font-size: 15px;
    color: #000;
    line-height: 1.4;
    flex-grow: 1;
    margin-right: 12px;
    white-space: pre-wrap;
    text-align: right; /* Right align Persian text */
    direction: rtl; /* Set text direction to RTL */
}

.bot-ad-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 60px;
}

.bot-ad-avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background-color: #e15f41;
    overflow: hidden;
}

.bot-ad-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bot-ad-title {
    font-size: 13px;
    font-weight: 600;
    color: #000;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.bot-preview-chat-area {
    background-color: #90bd71;
    background-image: url("assets/images/telegram-bg.png");
    background-size: cover;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    direction: ltr; /* Chat area is LTR structurally */
}

.bot-chat-bubble {
    background: white;
    padding: 8px 12px;
    border-radius: 12px 12px 12px 0;
    position: relative;
    align-self: flex-start;
    max-width: 85%;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.bot-chat-text {
    font-size: 15px;
    color: #000;
    line-height: 1.4;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; /* Keep English font for system message */
}

.bot-chat-time {
    font-size: 11px;
    color: #aeb4b9;
    text-align: right;
    margin-top: 2px;
}

.bot-start-btn {
    background-color: rgba(0, 0, 0, 0.2);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    width: 100%;
    cursor: default;
    backdrop-filter: blur(5px);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Responsive Design */
@media (max-width: 900px) {
    .creation-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .preview-section {
        order: -1; /* Preview on top for mobile */
        margin-bottom: 20px;
        padding-top: 0;
    }
    
    .preview-card-wrapper {
        padding: 16px;
        margin-bottom: 0;
    }
}

@media (max-width: 600px) {
    .app-container {
        padding-bottom: 80px;
    }

    .main-header {
        padding: 12px 16px;
        margin-bottom: 20px;
    }

    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .logo-section {
        justify-content: center;
    }

    .user-section {
        justify-content: space-between;
        width: 100%;
        border-top: 1px solid var(--secondary-bg);
        padding-top: 12px;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
        margin-bottom: 24px;
    }

    .page-header h2 {
        justify-content: center;
    }

    .target-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .target-selector .label {
        text-align: center;
        display: none; /* Hide label to save space if clear enough */
    }

    .tabs {
        width: 100%;
        display: flex;
    }
    
    .tab-btn {
        flex: 1;
        padding: 8px 4px;
        font-size: 13px;
        white-space: nowrap;
        text-align: center;
    }

    /* Form Elements */
    .form-group {
        margin-bottom: 20px;
    }
    
    input[type="text"],
    input[type="url"],
    input[type="number"],
    textarea {
        font-size: 16px; /* Prevent iOS zoom */
        padding: 12px;
    }

    .segment-control label span {
        padding: 12px 4px;
        font-size: 13px;
    }

    /* Bottom Actions */
    .bottom-actions {
        flex-direction: column;
        gap: 24px;
        align-items: stretch;
        margin-top: 32px;
    }

    .terms-checkbox {
        justify-content: center;
    }

    .action-buttons {
        flex-direction: column-reverse;
        gap: 12px;
        width: 100%;
    }

    .btn-primary, .btn-text {
        width: 100%;
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
    }
    
    .btn-text {
        color: var(--text-secondary);
    }
}

/* Pricing Tooltip and Badge Styles */
.price-info-container {
    position: absolute;
    left: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
}

.approx-value {
    position: static; /* Reset absolute positioning */
    color: var(--text-secondary);
    font-size: 13px;
}

.multiplier-badge {
    background-color: #fff3e0; /* Light orange bg */
    color: #e65100; /* Dark orange text */
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
}

.multiplier-badge:hover .tooltip {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

.tooltip {
    visibility: hidden;
    width: max-content;
    max-width: 240px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px 12px;
    position: absolute;
    z-index: 100;
    bottom: 135%; /* Position above */
    left: 50%;
    transform: translateX(-50%) translateY(0);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    font-size: 12px;
    line-height: 1.5;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    pointer-events: none;
    white-space: normal;
    word-wrap: break-word;
}

.tooltip::after {
    content: "";
    position: absolute;
    top: 100%; /* At the bottom of the tooltip */
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

/* Fix Input Field Alignment */
.input-with-icon {
    position: relative;
}

/* Move Currency Unit (Toman) to the LEFT */
.currency-icon {
    position: absolute;
    left: 12px !important;
    right: auto !important;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: bold;
    pointer-events: none;
    z-index: 2;
}

/* Input Padding Adjustment */
.input-with-icon input {
    padding-left: 60px !important; /* Space for Toman */
    padding-right: 12px !important; /* Default padding */
    text-align: right; /* Numbers aligned to right */
    direction: ltr; /* Force LTR for numbers to handle decimals/separators better? Or keep RTL. */
    /* Let's keep RTL but ensure padding is correct */
}

/* Fix for CPM Multiplier Badge Position - Move to Left next to Toman */
.price-info-container {
    position: absolute !important;
    left: 55px !important; /* Positioned after 'Toman' text */
    right: auto !important;
    top: 50%;
    transform: translateY(-50%);
    margin: 0 !important;
    z-index: 2;
    height: auto !important;
}

/* Base padding for CPM input (Space for Toman) */
#cpm {
    padding-right: 12px !important; /* Normal right padding */
    padding-left: 60px !important; /* Default for Toman */
    transition: padding-left 0.2s;
}

/* Dynamic padding when badge is present */
#cpm.has-badge {
    padding-left: 130px !important; /* Extra space for Badge */
}

/* Ensure Multiplier Badge looks good inside input */
.multiplier-badge {
    padding: 2px 8px;
    font-size: 12px;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Date Input Styles */
.input-with-suffix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-suffix input {
    padding-right: 90px; /* Space for suffix */
}

.input-suffix {
    position: absolute;
    right: 12px;
    color: var(--text-secondary);
    font-size: 13px;
    pointer-events: none;
    direction: ltr;
}

/* Ensure indented links align nicely */
.indented {
    margin-right: 24px;
    display: inline-block;
    margin-top: 4px;
}

/* Status & Date Picker Styling - Telegram Style */
.status-group {
    margin-bottom: 24px;
}

.radio-option-wrapper {
    margin-bottom: 12px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    margin-bottom: 4px;
}

.radio-label input {
    margin-left: 10px;
}

.date-config-area {
    margin-right: 28px; /* Indent under radio text */
    min-height: 20px;
}

.set-date-link {
    color: #3390ec; /* Telegram Blue */
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
}

.set-date-link:hover {
    text-decoration: none;
}

.date-picker-box {
    margin-top: 8px;
    max-width: 100%;
}

.picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.remove-date-link {
    color: #3390ec;
    text-decoration: none;
    font-size: 13px;
}

.picker-input-container {
    position: relative;
    border: 1px solid #dfe1e5;
    border-radius: 6px;
    background: #fff;
    display: flex;
    align-items: center;
    padding: 0 12px;
    height: 40px;
    transition: border-color 0.2s;
}

.picker-input-container:hover {
    border-color: #c4c7cc;
}

.picker-input-container:focus-within {
    border-color: #3390ec;
}

.styled-date-input {
    border: none !important;
    outline: none !important;
    background: transparent !important;
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    direction: ltr; /* Date inputs are usually LTR */
    padding: 0 !important;
    color: var(--text-primary);
}

.timezone-badge {
    font-size: 13px;
    color: #707579;
    margin-left: 10px;
    white-space: nowrap;
    pointer-events: none;
}

/* Split Date/Time Picker Styling */
.picker-row {
    display: flex;
    gap: 12px;
}

.custom-input-container {
    position: relative;
    border: 1px solid #dfe1e5;
    border-radius: 8px;
    background: #fff;
    display: flex;
    align-items: center;
    padding: 0 12px;
    height: 42px;
    transition: border-color 0.2s;
}

.custom-input-container:hover {
    border-color: #c4c7cc;
}

.custom-input-container:focus-within {
    border-color: #3390ec;
}

.date-container {
    flex: 1.4;
}

.time-container {
    flex: 1;
}

.real-input {
    border: none !important;
    outline: none !important;
    background: transparent !important;
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    direction: ltr;
    padding: 0 !important;
    color: var(--text-primary);
    height: 100%;
}

.input-icon {
    font-size: 16px;
    color: #707579;
    margin-left: 8px;
    pointer-events: none;
}

.timezone-label {
    font-size: 13px;
    color: #707579;
    white-space: nowrap;
    margin-left: 8px;
    pointer-events: none;
}

/* Make the date input trigger clickable area */
input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
}

input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0; 
    /* We might want to keep the clock icon or hide it? 
       Telegram screenshot doesn't show a clock icon, just text.
    */
    display: none;
}

/* Updated Date Picker Icon Styles */
.input-icon {
    margin-left: 14px !important; /* Breathing room from numbers */
    margin-right: 4px;
    color: #707579;
    pointer-events: none;
    flex-shrink: 0; /* Don't squash icon */
    opacity: 0.8;
}

/* Hide timezone label as requested */
.timezone-label {
    display: none !important;
}

/* Ensure time input is centered or looks good without label */
.time-container input {
    text-align: center;
}

/* Adjust Date Container to accommodate icon better */
.date-container {
    padding-right: 14px; /* Balance padding */
}

/* Manual Date/Time Picker Styles */
.manual-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    direction: ltr; /* Ensure LTR order for date components */
    padding: 0 8px !important;
}

.date-select, .time-select {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    padding: 0 2px;
    outline: none;
    cursor: pointer;
    text-align: center;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    color: var(--text-primary);
}

.date-select:focus, .time-select:focus {
    color: #3390ec;
}

.day-select { width: 35px; }
.month-select { width: 90px; }
.year-select { width: 55px; }
.hour-select, .minute-select { width: 35px; }

.date-sep, .time-sep {
    color: #aaa;
    margin: 0 2px;
    font-size: 14px;
    pointer-events: none;
}

/* Hide default select arrow */
.date-select::-ms-expand, .time-select::-ms-expand {
    display: none;
}

/* Custom Select Styling */
.custom-select-wrapper {
    position: relative;
    user-select: none;
    display: inline-block;
    height: 100%;
}

.custom-select-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-primary);
    cursor: pointer;
    height: 100%;
    white-space: nowrap;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.custom-select-trigger:hover {
    background-color: rgba(51, 144, 236, 0.08);
    color: #3390ec;
}

.custom-options {
    position: absolute;
    display: none;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 100%;
    width: max-content;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 8px;
    z-index: 1000;
    padding: 6px 0;
    border: 1px solid #dfe1e5;
    scrollbar-width: thin;
}

.custom-options.open {
    display: block;
    animation: fadeIn 0.1s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-5px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.custom-option {
    padding: 8px 16px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
}

.custom-option:hover {
    background-color: #f5f5f5;
}

.custom-option.selected {
    color: #3390ec;
    font-weight: 600;
    background-color: rgba(51, 144, 236, 0.05);
}

/* Wrapper widths */
.custom-select-wrapper.day-select { min-width: 35px; }
.custom-select-wrapper.month-select { min-width: 80px; }
.custom-select-wrapper.year-select { min-width: 55px; }
.custom-select-wrapper.hour-select, 
.custom-select-wrapper.minute-select { min-width: 35px; }

/* Fix Mobile Horizontal Scroll for Date Picker */
@media (max-width: 600px) {
    .picker-row {
        flex-direction: column; /* Stack vertically on mobile */
        gap: 10px;
    }

    .custom-input-container {
        width: 100%;
        flex: none; /* Disable flexbox resizing */
    }
    
    .date-container {
        padding-right: 12px; /* Reset padding for mobile */
    }
    
    /* Ensure custom selects don't overflow */
    .manual-picker {
        justify-content: space-between; /* Distribute space evenly */
        padding: 0 4px !important;
    }
    
    .custom-select-wrapper {
        flex: 1; /* Allow selects to take available space */
        min-width: auto; /* Allow shrinking if needed */
    }
    
    .custom-select-trigger {
        width: 100%;
        justify-content: center;
    }
}

/* Schedule Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal.open {
    display: flex;
}

.modal-content {
    background-color: #fff;
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

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

.modal-header h3 {
    font-size: 18px;
    margin: 0;
}

.modal-action-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

/* Schedule Grid */
.schedule-grid-container {
    overflow-x: auto;
    flex-grow: 1;
}

.schedule-grid {
    display: grid;
    grid-template-columns: 60px repeat(24, 1fr); /* Increased label width */
    gap: 3px;
    min-width: 650px; /* Ensure enough space */
    direction: rtl;
}

.schedule-header-row {
    display: contents;
}

.hour-header {
    font-size: 11px;
    text-align: center;
    color: var(--text-secondary);
    padding-bottom: 6px;
}

.day-label {
    font-size: 13px;
    color: var(--text-secondary);
    align-self: center;
    padding-left: 10px; /* Space from grid */
    white-space: nowrap;
    text-align: left;
}

.time-slot {
    height: 32px;
    background-color: #f0f2f5;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.1s;
    border: 1px solid transparent;
}

.time-slot:hover {
    background-color: #e4e4e5;
}

.time-slot.selected {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.time-slot.selected:hover {
    background-color: var(--primary-hover);
}

/* Selection helper overlay (optional) */
.schedule-grid {
    user-select: none;
}

/* Schedule Preview Styles */
.mini-schedule-grid {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    grid-template-rows: repeat(7, 1fr);
    gap: 1px; /* Creates the grid lines */
    height: 100px; /* Slightly taller */
    background-color: #e6e6e6; /* Grid line color */
    border: 1px solid #dfe1e5;
    border-radius: 8px;
    padding: 1px; /* Inner border for grid */
    margin-bottom: 12px;
    direction: ltr; /* Ensure 00 is on left */
    overflow: hidden;
}

.mini-slot {
    background-color: #fff; /* Inactive slot color */
}

.mini-slot.active {
    background-color: #3390ec; /* Active slot color */
}

.schedule-summary-text {
    font-size: 13px;
    color: var(--text-color);
    line-height: 1.6;
    text-align: left; /* Align summary to left for readability or match LTR logic of time ranges? */
    /* Persian text usually aligns right. But "00-01" is LTR. Mixed content. */
    /* Let's try right aligned for Persian app */
    text-align: right; 
    margin-bottom: 8px;
    direction: rtl;
}

.schedule-summary-text strong {
    font-weight: 700;
    color: #000;
}
