:root {
    /* Импортируем переменные из header.css */
    --color-bg-primary: #111827;
    --color-bg-secondary: #1F2937;
    --color-text-light: #FFFFFF;
    --color-text-medium: #D1D5DB;
    --color-text-dark: #9CA3AF;
    --color-accent-blue-light: #60A5FA;
    --color-accent-blue-medium: #3B82F6;
    --color-accent-blue-dark: #2563EB;
    --color-accent-purple: #8B5CF6;
    --color-border-subtle: #374151;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-full: 9999px;
    --transition-fast: all 0.15s ease-in-out;
    --transition-medium: all 0.3s ease-in-out;
    --success-color: #10B981; /* Tailwind green-500 */
    --error-color: #EF4444; /* Tailwind red-500 */
}

/* Обновляем body, чтобы он не переопределял основной фон темы */
body {
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Удаляем градиент фона, чтобы основной фон темы был виден */
    /* background: linear-gradient(to bottom right, #f8faff, #f0f4f8); */
    min-height: 100vh;
}

/* Основной виджет, который будет "сливаться" с фоном профиля */
.exchange-settings-widget {
    background-color: var(--color-bg-secondary);
    font-family: 'Inter', sans-serif;
    color: var(--color-text-light);
    line-height: 1.6;
    min-height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.5rem;
    width: 95%;
    max-width: 1200px;
    margin: 0 auto;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--color-border-subtle);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInMoveUp 0.8s ease-out forwards;
    overflow-x: hidden; /* Добавляем это свойство */
}

@keyframes fadeInMoveUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--color-text-light);
    margin-bottom: 2rem;
    text-align: center;
    letter-spacing: -0.025em;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid var(--color-border-subtle);
}

/* Информационные блоки (О подключении бирж, Как получить API ключи?) */
.description-block, .faq-info-block {
    background-color: var(--color-bg-primary);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--color-border-subtle);
    width: 100%;
    max-width: 900px;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    color: var(--color-text-light);
}

.description-block .description-icon-wrapper {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background-color: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    color: var(--color-accent-blue-light);
    padding-top: 0.25rem;
}

.description-icon-wrapper i {
    font-size: 2rem;
}

.faq-info-block .info-icon-wrapper {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background-color: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    color: var(--color-accent-blue-light);
    padding-top: 0.25rem;
}

.info-icon-wrapper i {
    font-size: 2rem;
}

.description-text-content, .info-text-content {
    flex-grow: 1;
}

.description-block h3, .faq-info-block h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-light);
    margin-bottom: 0.5rem;
}
.description-block p, .faq-info-block p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--color-text-medium);
    margin-bottom: 0.8rem;
}
.description-block p:last-child, .faq-info-block p:last-child {
    margin-bottom: 0;
}

.faq-info-block a {
    color: var(--color-accent-blue-light);
    text-decoration: underline;
    font-weight: 500;
    transition: var(--transition-fast);
}
.faq-info-block a:hover {
    color: var(--color-accent-blue-medium);
}

/* Основной раздел настроек бирж (содержит форму и список) */
.exchange-settings {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Две колонки */
    gap: 2rem;
    margin-top: 32px;
    max-width: 1200px; /* Увеличим максимальную ширину */
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    align-items: stretch; /* Блоки будут одинаковой высоты */
}

/* Для маленьких экранов оставляем одну колонку */
@media (max-width: 767px) {
    .exchange-settings {
        grid-template-columns: 1fr;
    }
}

/* Для больших экранов (от 768px и выше) явно устанавливаем две колонки */
@media (min-width: 768px) {
    .exchange-settings {
        grid-template-columns: 1fr 1fr;
    }
}

/* Добавим выравнивание для карточек */
.exchange-form, .exchange-list {
    background-color: var(--color-bg-primary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border-subtle);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%; /* Займет всю доступную высоту */
    box-sizing: border-box; /* Учитываем padding в высоте */
}

.form-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--color-text-light);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-title i {
    font-size: 24px;
    color: var(--color-accent-blue-light);
}

.input-group {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-medium);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0.5rem;
}

.input-group .relative.group .ph-info {
    color: var(--color-text-dark);
    transition: color 0.2s ease-in-out;
}

.input-group .relative.group:hover .ph-info {
    color: var(--color-text-light);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--color-text-light);
    background-color: var(--color-bg-secondary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    border-color: var(--color-accent-blue-medium);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.2), 0 0 8px rgba(79, 140, 255, 0.2);
}

.form-input:disabled {
    background-color: var(--color-border-subtle);
    cursor: not-allowed;
    color: var(--color-text-dark);
}

.select-wrapper {
    position: relative;
}

.select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2.5rem;
}

.select-wrapper .ph-caret-down {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--color-text-medium);
}

/* Tooltips */
.tooltip-text {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--color-bg-primary);
    color: var(--color-text-light);
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out, transform 0.3s ease-out;
    z-index: 20;
    pointer-events: none;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-subtle);
}

.tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: var(--color-bg-primary) transparent transparent transparent;
}

.input-group .relative.group:hover .tooltip-text {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-5px);
}

/* Buttons */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition-fast);
    cursor: pointer;
    border: none;
    white-space: nowrap;
    background: linear-gradient(90deg, var(--color-accent-blue-medium) 0%, var(--color-accent-blue-dark) 100%);
    color: var(--color-text-light);
    box-shadow: 0 4px 12px rgba(79,140,255,0.2);
    width: 100%;
}

.btn-primary i {
    font-size: 20px;
    margin-right: 0.5rem;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(90deg, var(--color-accent-blue-dark) 0%, var(--color-accent-blue-medium) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79,140,255,0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-primary:focus:not(:disabled) {
    outline: none;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.3);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2) inset;
}

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition-fast);
    cursor: pointer;
    background-color: var(--color-bg-secondary);
    color: var(--color-text-medium);
    border: 1px solid var(--color-border-subtle);
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.btn-secondary i {
    font-size: 20px;
    margin-right: 0.5rem;
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--color-border-subtle);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: var(--color-text-light);
}

.btn-secondary:focus:not(:disabled) {
    outline: none;
    box-shadow: 0 0 0 4px rgba(160, 174, 192, 0.3);
}

.btn-secondary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03) inset;
}

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid var(--color-text-light);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.exchange-list {
    background-color: var(--color-bg-primary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border-subtle);
}

.exchange-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border-subtle);
}

.exchange-list-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--color-text-light);
    display: flex;
    align-items: center;
    gap: 10px;
}

.exchange-list-header h3 i {
    font-size: 24px;
    color: var(--color-accent-purple);
}

.status-indicator {
    padding: 0.4rem 0.8rem;
    background-color: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    font-weight: 600;
    color: var(--color-accent-purple);
    font-size: 0.9rem;
}

.status-indicator span#connectedCount {
    color: var(--color-accent-purple);
}

#exchangeList {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: none; /* Убираем фиксированную высоту */
    overflow-y: auto;
    padding-right: 8px;
    flex-grow: 1; /* Займет все доступное пространство */
}

#exchangeList::-webkit-scrollbar {
    width: 8px;
}

#exchangeList::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
    border-radius: 10px;
}

#exchangeList::-webkit-scrollbar-thumb {
    background: var(--color-border-subtle);
    border-radius: 10px;
}

#exchangeList::-webkit-scrollbar-thumb:hover {
    background: #4B5563;
}

.exchange-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--color-bg-secondary);
    border: 1px solid var(--color-border-subtle);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
}

.exchange-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-accent-blue-medium);
    background-color: #2D3A4B;
}

.exchange-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.exchange-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: contain;
    background-color: var(--color-bg-primary);
    padding: 4px;
    border: 1px solid var(--color-border-subtle);
    flex-shrink: 0;
}

.exchange-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.exchange-text h4 {
    font-weight: 600;
    color: var(--color-text-light);
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.exchange-text small {
    font-size: 0.8rem;
    color: var(--color-text-medium);
}

.delete-btn {
    display: inline-flex;
    align-items: center;
    background-color: var(--error-color);
    color: var(--color-text-light);
    border: 1px solid var(--error-color);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.delete-btn:hover {
    background-color: #e03838;
    color: white;
    border-color: #e03838;
}

.delete-btn i {
    font-size: 1rem;
    margin-right: 0.5rem;
}

/* No exchanges message */
.exchange-item.text-gray-500.italic {
    text-align: center;
    color: var(--color-text-dark);
    font-style: italic;
    padding: 20px;
    background-color: var(--color-bg-primary);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}


/* Notification styles */
.notification {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    color: var(--color-text-light);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

.notification.visible {
    opacity: 1;
    transform: translateY(0);
}

.notification.success {
    background-color: var(--success-color);
}

.notification.error {
    background-color: var(--error-color);
}

.notification.info {
    background-color: var(--color-accent-blue-medium);
}

.notification i {
    font-size: 1.25rem;
}

/* Styles for custom confirm dialog */
.fixed.inset-0.bg-gray-900.bg-opacity-75 {
    background-color: rgba(17, 24, 39, 0.75);
    transition: opacity 0.3s ease-out;
    opacity: 1;
}
.fixed.inset-0.bg-gray-900.bg-opacity-75.hidden {
    opacity: 0;
    pointer-events: none;
}
.bg-white.p-6.rounded-lg.shadow-xl {
    background-color: var(--color-bg-secondary);
    color: var(--color-text-light);
    border: 1px solid var(--color-border-subtle);
    animation: popIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.bg-white.p-6.rounded-lg.shadow-xl .text-lg.font-semibold.text-gray-800 {
    color: var(--color-text-light);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Адаптивность - пересматриваем, чтобы Tailwind классы в HTML работали корректно */
/* Некоторые правила из старого адаптива могут быть избыточны или конфликтовать с Tailwind классами */
@media (max-width: 1023px) {
  .exchange-settings {
    gap: 15px;
  }
  .exchange-form, .exchange-list {
    /* flex: 1 1 100%; */
    /* max-width: 100%; */
    padding: 18px 15px;
  }
  
  /* Container for exchange settings */
  .exchange-settings {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
  }

  /* Adjust buttons to stack vertically on smaller screens */
  .flex.flex-col.sm\:flex-row.gap-4.mt-6 {
    flex-direction: column;
    gap: 1rem; /* Adjust gap for stacked buttons */
  }

  .btn-primary, .btn-secondary {
    width: 100%; /* Make buttons full width */
  }

  .description-block, .faq-info-block {
    flex-direction: column; /* Stack content vertically */
    align-items: center; /* Center items when stacked */
    text-align: center;
  }

  .description-block .description-icon-wrapper, .faq-info-block .info-icon-wrapper {
    margin-bottom: 0.5rem; /* Add some space below icons */
  }
}

@media (max-width: 768px) {
  .exchange-settings-widget {
    padding: 1.5rem; /* Slightly more padding for tablets */
    width: 98%; /* Allow slightly more width */
  }

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

  .description-block, .faq-info-block {
    padding: 1rem;
    font-size: 0.875rem;
  }

  .description-block h3, .faq-info-block h3 {
    font-size: 1.1rem;
  }

  .exchange-form, .exchange-list {
    padding: 1.5rem;
  }

  .form-title, .exchange-list-header h3 {
    font-size: 1.2rem;
  }

  .input-group label {
    font-size: 0.85rem;
  }

  .form-input {
    font-size: 0.9rem;
    padding: 0.6rem 0.8rem;
  }

  .btn-primary, .btn-secondary {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  .exchange-item {
    flex-direction: column; /* Stack info and delete button */
    align-items: flex-start; /* Align stacked items to start */
    padding: 1rem;
    gap: 0.5rem;
  }

  .delete-btn {
    width: 100%; /* Make delete button full width */
    justify-content: center; /* Center content of delete button */
    margin-top: 0.5rem; /* Space between info and delete button */
  }

  .exchange-info {
    width: 100%;
    justify-content: center; /* Center exchange logo and text */
    text-align: center;
    margin-bottom: 0.5rem;
  }
  .exchange-text {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .exchange-settings-widget {
    padding: 1rem; /* Reduced padding for very small screens */
    width: 100%; /* Full width on smallest screens */
    border-radius: 0; /* Remove border-radius on smallest screens for edge-to-edge content */
    box-shadow: none; /* Remove shadow on smallest screens */
    border: none; /* Remove border on smallest screens */
  }

  .section-title {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
  }

  .description-block, .faq-info-block {
    padding: 0.8rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
  }

  .description-block h3, .faq-info-block h3 {
    font-size: 1rem;
  }

  .exchange-form, .exchange-list {
    padding: 1rem;
    gap: 1rem;
  }

  .form-title, .exchange-list-header h3 {
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
  }

  .input-group {
    margin-bottom: 0.8rem;
    gap: 6px;
  }

  .input-group label {
    font-size: 0.75rem;
  }

  .form-input {
    font-size: 0.8rem;
    padding: 0.5rem 0.6rem;
  }

  .flex.flex-col.sm\:flex-row.gap-4.mt-6 {
    gap: 0.8rem;
  }

  .btn-primary, .btn-secondary {
    padding: 0.6rem 0.8rem;
    font-size: 0.8rem;
    min-width: unset;
  }

  .exchange-list-header {
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
  }

  #exchangeList {
    gap: 10px;
  }

  .exchange-item {
    padding: 0.8rem;
  }

  .exchange-logo {
    width: 28px;
    height: 28px;
    padding: 3px;
  }

  .exchange-text h4 {
    font-size: 0.9rem;
  }

  .exchange-text small {
    font-size: 0.7rem;
  }

  .delete-btn {
    padding: 5px 10px;
    font-size: 0.7rem;
  }

  .notification {
    bottom: 1rem;
    right: 1rem;
    padding: 0.6rem 1rem;
    font-size: 0.7rem;
    gap: 0.6rem;
  }
} 