/* API Keys Dashboard CSS - CSP Compliant */

/* Import League Spartan font */
@import url('https://fonts.googleapis.com/css2?family=League+Spartan:wght@300;400;500;600;700;800;900&display=swap');

/* Beautiful Purple Green Blue Background - Same as Account/Affiliates */
html, body {
  background: radial-gradient(circle at 25% 25%, rgba(139, 92, 246, 0.3) 0%, transparent 50%), 
              radial-gradient(circle at 75% 75%, rgba(16, 185, 129, 0.2) 0%, transparent 50%), 
              radial-gradient(circle at 50% 10%, rgba(59, 130, 246, 0.2) 0%, transparent 40%),
              linear-gradient(135deg, #000000 0%, #0a0a0f 100%) !important;
  background-attachment: fixed !important;
  backdrop-filter: blur(20px) !important;
  min-height: 100vh !important;
  position: relative !important;
}

/* Force override any aurora effects, canvas backgrounds, or other effects */
body::after, 
html::before, html::after,
.aurora, .aurora-effect, .background-animation,
canvas[class*="aurora"], canvas[class*="background"],
div[class*="aurora"], div[class*="background-effect"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  z-index: -9999 !important;
}

/* Main background overlay with radial gradients */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 25% 25%, rgba(139, 92, 246, 0.4) 0%, transparent 50%), 
              radial-gradient(circle at 75% 75%, rgba(16, 185, 129, 0.3) 0%, transparent 50%), 
              radial-gradient(circle at 50% 10%, rgba(59, 130, 246, 0.25) 0%, transparent 40%),
              radial-gradient(circle at 10% 80%, rgba(6, 182, 212, 0.2) 0%, transparent 45%),
              linear-gradient(135deg, #000000 0%, #0a0a0f 50%, #111118 100%) !important;
  backdrop-filter: blur(30px) !important;
  z-index: -1000 !important;
  pointer-events: none !important;
  animation: subtleShift 25s ease-in-out infinite !important;
}

@keyframes subtleShift {
  0%, 100% { 
    transform: translateX(0) translateY(0) scale(1);
  }
  25% { 
    transform: translateX(10px) translateY(-10px) scale(1.02);
  }
  50% { 
    transform: translateX(-5px) translateY(10px) scale(0.98);
  }
  75% { 
    transform: translateX(-10px) translateY(-5px) scale(1.01);
  }
}

/* Base Styles - Consistent with dashboard-account.css */
.api-keys-page {
    font-family: 'League Spartan', sans-serif;
    color: white;
    min-height: 100vh;
}

/* Modern Page Header - Same as Account/Affiliates */
.api-keys-header {
    text-align: center;
    position: relative;
}

.api-keys-title {
    font-size: 3rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 1rem;
    text-shadow: 0 0 30px rgba(79, 209, 199, 0.3);
}

.api-keys-title .title-text {
    background: linear-gradient(135deg, #4fd1c7, #ece6f2, #10b981);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.api-keys-subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
}

/* Legacy page title - kept for backward compatibility but hidden */
.pageTitle {
    display: none;
}

.pageTitle h3 {
    margin-bottom: 0.5rem;
    font-size: 2.5rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.pageTitle p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Card Headers - Same as Account/Affiliates */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.card-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

/* Main Dashboard Cards - Same as Account/Affiliates */
.main-dashboard-card, .payment-dashboard-card {
  background: linear-gradient(135deg, rgb(24, 5, 47) 0%, rgb(1, 4, 8) 50%, rgb(10, 77, 46) 100%);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(16, 185, 129, 0.6);
  border-radius: 16px;
  padding: 2rem;
  color: white;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(16, 185, 129, 0.3);
}

/* Tutorial Container */
.instructionsContainer {
    margin: 2rem auto;
    padding: 2rem;
    max-width: 1000px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgb(24, 5, 47) 0%, rgb(1, 4, 8) 50%, rgb(10, 77, 46) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(16, 185, 129, 0.6);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(16, 185, 129, 0.3);
    display: none; /* Hidden by default, shown via JavaScript */
}

/* Tutorial Steps */
.apiKeyRowCont {
    padding: 2rem;
    margin: 2rem auto;
    max-width: 900px;
    background: linear-gradient(135deg, rgb(24, 5, 47) 0%, rgb(1, 4, 8) 50%, rgb(10, 77, 46) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(16, 185, 129, 0.6);
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(16, 185, 129, 0.3);
    position: relative;
    overflow: hidden;
}

.apiKeyRowCont::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 25% 25%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.apiKeyRowCont h6 {
    font-size: 1.1rem;
    line-height: 1.6;
    color: white;
    margin-bottom: 1rem;
}

.apiKeyRowCont .gold {
    color: #ffd700;
    font-weight: 700;
}

/* Important Background Styling */
.importantBackground {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(220, 38, 38, 0.3) 100%);
    border: 2px solid rgba(239, 68, 68, 0.6);
}

/* Warning/Info Boxes */
.tutorial-info-box {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-left: 4px solid #10B981;
}

.tutorial-warning-box {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-left: 4px solid #ef4444;
}

.tutorial-warning-box .warning-text {
    color: #fecaca;
    font-weight: 500;
}

.tutorial-tip-box {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-left: 4px solid #ffd700;
}

/* Permission Settings Display */
.permissions-display {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.permissions-display .section-title {
    color: #ffd700;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.permission-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.permission-item:last-child {
    border-bottom: none;
}

.permission-label {
    font-weight: 600;
    color: white;
}

.permission-value {
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
}

.permission-value.allowed {
    background: rgba(16, 185, 129, 0.2);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.permission-value.denied {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* IP Address Section */
.ip-address-section {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #ffd700;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.ip-section-header {
    color: #ffd700;
    margin-bottom: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ip-grid {
    display: grid;
    gap: 0.8rem;
    margin-top: 1rem;
}

.ip-copy-feedback {
    display: none;
    color: #10B981;
    margin-top: 1rem;
    font-weight: 700;
    text-align: center;
    padding: 0.5rem;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 6px;
}

.ip-tip {
    color: #ffd700;
    font-size: 0.9rem;
    margin-top: 1rem;
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    line-height: 1.4;
}

/* Form Styling */
.apiKeysArea {
    margin: 2rem auto;
    width: 90%;
    max-width: 1000px;
}

.apiKeysList {
    margin: 2rem auto;
    padding: 2rem;
    border-radius: 16px;
    background: linear-gradient(135deg, rgb(24, 5, 47) 0%, rgb(1, 4, 8) 50%, rgb(10, 77, 46) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(16, 185, 129, 0.6);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25);
}

.apiKeysFormRow {
    display: none;
    margin: 2rem 0;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border-left: 3px solid #168a8b;
    backdrop-filter: blur(5px);
}

.apiKeysFormRow input {
    width: 100%;
    padding: 1rem;
    margin-top: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.apiKeysFormRow input:focus {
    outline: none;
    border-color: #168a8b;
    box-shadow: 0 0 0 2px rgba(22, 138, 139, 0.3);
    background: rgba(0, 0, 0, 0.5);
}

.apiKeysFormRow input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.apiKeysFormRow .addNewAPIKey {
    text-align: center;
}

.apiKeysFormRow .addNewAPIKey h4 {
    color: #ffd700;
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.apiKeysFormRow .addNewAPIKey p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
}

/* Exchange Selection */
.addApiKeySelectExchange {
    display: flex;
    margin: 3rem 0;
    align-items: center;
    justify-content: space-around;
    gap: 2rem;
    flex-wrap: wrap;
}

.addApiKeySelectExchange > * {
    display: flex;
    flex-direction: column;
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    min-width: 200px;
    cursor: pointer;
}

.addApiKeySelectExchange > *:hover {
    border-color: #168a8b;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(22, 138, 139, 0.3);
}

.addApiKeySelectExchange img {
    max-height: 60px;
    max-width: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
    margin-bottom: 1rem;
}

/* Button Styling */
.buttonRow, .cancelbuttonRow {
    display: none;
    margin: 2rem auto;
    text-align: center;
    gap: 1rem;
}

.buttonRow button, .cancelbuttonRow button {
    min-width: 210px;
    padding: 1rem 2rem;
    font-size: 16px;
    font-weight: 700;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.greenButton {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
}

.greenButton:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.redButton {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: white;
}

.redButton:hover {
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

/* Make sure button color classes work in edit area */
.editButtonRow .greenButton:hover {
    transform: translateY(-1px);
}

.editButtonRow .redButton:hover {
    transform: translateY(-1px);
}

.blueButton {
    background: linear-gradient(135deg, #3B82F6 0%, #1E40AF 100%);
    color: white;
}

.blueButton:hover {
    background: linear-gradient(135deg, #1E40AF 0%, #1E3A8A 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

/* API Key List Styling */
.apiKeyListRow {
    display: flex;
    align-content: stretch;
    justify-content: space-evenly;
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.apiKeyListRow:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(16, 185, 129, 0.3);
    transform: translateY(-2px);
}

.apiKeyListRow > div {
    vertical-align: middle;
    display: flex;
    align-items: center;
}

/* Specific column width overrides */
.apiKeyListRow .enabled {
    flex: 0 0 80px !important;
}

.apiKeyListRow .exchange {
    flex: 0 0 80px !important;
    padding-right: 0.75rem !important; /* Add space after exchange logo */
}

/* Exchange logo styling within API keys list */
.apiKeyListRow .exchange img {
    max-height: 28px !important;
    max-width: 70px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    margin-right: 0.5rem !important; /* Extra spacing after logo */
}

/* Specific logo adjustments for better alignment */
.apiKeyListRow .exchange .bitmexLogo {
    max-height: 24px !important;
    margin-right: 0.75rem !important;
}

.apiKeyListRow .exchange .bybitLogo {
    max-height: 26px !important;
    margin-right: 0.5rem !important;
}

.apiKeyListRow .exchange .deribitLogo {
    max-height: 26px !important;
    margin-right: 0.5rem !important;
}

.apiKeyListRow .nickName {
    flex: 0 0 220px !important; /* Increased from 100px to 220px for more nickname space */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-left: 0.5rem !important; /* Add space before nickname text */
    padding-right: 1rem !important;
    display: flex !important;
    align-items: center !important; /* Vertically center the nickname */
}

.apiKeyListRow .apiKey {
    flex: 1 !important; /* Changed from flex: 20 to flex: 1 to give remaining space */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 150px; /* Added minimum width to ensure API key is still readable */
    padding-right: 1rem;
}

.apiKeyListRow .edit {
    flex: 0 0 100px !important;
    justify-content: center;
    padding: 0.25rem;
}

.apiKeyListRow .edit .blueButton {
    width: 90px;
    height: 32px;
    padding: 0;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    background: linear-gradient(135deg, #3B82F6 0%, #1E40AF 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.apiKeyListRow .edit .blueButton:hover {
    background: linear-gradient(135deg, #1E40AF 0%, #1E3A8A 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

.apiKeyListRow .delete {
    flex: 0 0 80px !important;
    justify-content: center;
}

.apiKeyListRow .edit, .apiKeyListRow .delete {
    cursor: pointer;
}

.editArea {
    display: none;
    flex-direction: column;
    align-content: stretch;
    justify-content: space-evenly;
    width: 100%;
    background: rgba(22, 138, 139, 0.2);
    border-radius: 12px;
    margin-bottom: 1rem;
    min-height: 120px;
    padding: 2rem;
    text-align: left;
    border: 1px solid rgba(22, 138, 139, 0.4);
}

.editArea input {
    width: 80%;
    max-width: 320px;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-family: inherit;
}

.editArea button {
    margin-right: 1rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

/* Edit Area Button Styling */
.editButtonRow {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
    align-items: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.editButton {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.editButton:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Edit Input Group Styling */
.edit-input-group {
    margin-bottom: 1rem;
}

.edit-label {
    margin-bottom: 0.5rem;
}

.edit-input input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 14px;
}

.edit-input input:focus {
    outline: none;
    border-color: #168a8b;
    box-shadow: 0 0 0 2px rgba(22, 138, 139, 0.3);
}

.edit-input input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Loading Animation */
.addApiKeysLoading {
    display: none;
    margin: 2rem auto;
    width: 100%;
    text-align: center;
    background: rgba(22, 138, 139, 0.2);
    border: 1px solid rgba(22, 138, 139, 0.4);
    border-radius: 12px;
    padding: 2rem;
    vertical-align: middle;
}

.loading {
    display: none;
    width: 100%;
    text-align: center;
}

.lds-ellipsis {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
}

.lds-ellipsis div {
    position: absolute;
    top: 33px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #fff;
    animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

.lds-ellipsis div:nth-child(1) {
    left: 8px;
    animation: lds-ellipsis1 0.6s infinite;
}

.lds-ellipsis div:nth-child(2) {
    left: 8px;
    animation: lds-ellipsis2 0.6s infinite;
}

.lds-ellipsis div:nth-child(3) {
    left: 32px;
    animation: lds-ellipsis2 0.6s infinite;
}

.lds-ellipsis div:nth-child(4) {
    left: 56px;
    animation: lds-ellipsis3 0.6s infinite;
}

@keyframes lds-ellipsis1 {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

@keyframes lds-ellipsis3 {
    0% { transform: scale(1); }
    100% { transform: scale(0); }
}

@keyframes lds-ellipsis2 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(24px, 0); }
}

/* Form Errors and Success */
.formErrors, .twoFactorFailed {
    display: none;
    margin: 1rem;
    padding: 1rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #000;
    text-align: center;
    font-weight: 600;
}

.editSuccess, .deleteSuccess {
    display: none;
    width: 100%;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    border-radius: 12px;
    margin-bottom: 1rem;
    padding: 1rem;
    color: white;
    font-weight: 600;
}

/* Exchange-specific styling */
/* Tutorial sections are hidden by default and shown via JavaScript */
.binance:not(.instructionsContainer), 
.bitmex:not(.instructionsContainer), 
.bybit:not(.instructionsContainer), 
.deribit:not(.instructionsContainer) {
    display: none;
}

/* CRITICAL: Ensure all exchanges can be shown when JavaScript activates them */
.binance:not(.instructionsContainer)[style*="display"],
.bitmex:not(.instructionsContainer)[style*="display"],
.bybit:not(.instructionsContainer)[style*="display"],
.deribit:not(.instructionsContainer)[style*="display"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Exchange Tutorial Containers */
.instructionsContainer {
    display: none; /* Hidden by default */
}

.instructionsContainer.active {
    display: block !important; /* Show when activated - use !important to override other display rules */
}

/* Specific override for exchange instruction containers */
.deribit.instructionsContainer.active,
.binance.instructionsContainer.active,
.bitmex.instructionsContainer.active,
.bybit.instructionsContainer.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Force show Deribit instructions when active - highest specificity */
div.deribit.instructionsContainer.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Additional fallback for all instruction containers when active */
.instructionsContainer.active,
div.instructionsContainer.active,
[class*="instructionsContainer"].active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 10 !important;
}

/* Fallback hiding for API keys list when adding new keys */
.apiKeysList[style*="display: none"],
.allApiKeys[style*="display: none"],
.listHeader[style*="display: none"] {
    display: none !important;
    visibility: hidden !important;
}

/* Ensure instruction containers can always override other display rules */
.deribit.instructionsContainer,
.binance.instructionsContainer,
.bitmex.instructionsContainer,
.bybit.instructionsContainer {
    position: relative !important;
}

/* Override the hiding when exchange forms are being shown */
.deribit:not(.instructionsContainer)[style*="display: block"],
.binance:not(.instructionsContainer)[style*="display: block"],
.bitmex:not(.instructionsContainer)[style*="display: block"],
.bybit:not(.instructionsContainer)[style*="display: block"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* ONLY hide API keys list when it has the inline style display:none (set by JavaScript) */
.apiKeysList[style*="display: none"],
.allApiKeys[style*="display: none"],
.listHeader[style*="display: none"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Trusted IPs */
.trustedIPs {
    width: 90%;
    max-width: 800px;
    min-height: 123px;
    margin-bottom: 1rem;
    color: black;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    font-family: monospace;
    font-size: 14px;
}

.copiedTrustedIPs {
    width: 80%;
    max-width: 520px;
    margin: 1rem auto;
    padding: 1rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    color: #10B981;
    text-align: center;
    font-weight: 600;
}

/* Supported Exchanges */
.supported-exchanges {
    margin-top: 2rem;
    text-align: center;
}

.exchange-badge {
    display: inline-block;
    background: rgba(22, 138, 139, 0.3);
    padding: 0.5rem 1rem;
    margin: 0 0.5rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 215, 0, 0.5);
    font-weight: 700;
    color: #ffd700;
    font-size: 0.9rem;
}

/* Countdown Timer */
.countDown {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffd700;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .apiKeysArea {
        width: 95%;
    }
    
    .instructionsContainer {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .apiKeyRowCont {
        margin: 1rem;
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .addApiKeySelectExchange {
        flex-direction: column;
        gap: 1rem;
    }
    
    .addApiKeySelectExchange > * {
        min-width: auto;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
    
    .apiKeysFormRow {
        padding: 1.5rem;
    }
    
    .buttonRow, .cancelbuttonRow {
        flex-direction: column;
        gap: 1rem;
    }
    
    .buttonRow button, .cancelbuttonRow button {
        min-width: auto;
        width: 100%;
    }
    
    .apiKeyRowCont {
        padding: 1rem;
    }
    
    .permissions-display {
        padding: 1rem;
    }
    
    .permission-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .pageTitle h3 {
        font-size: 2rem;
    }
    
    .instructionsContainer {
        padding: 1rem;
    }
    
    .apiKeyRowCont {
        padding: 1rem;
    }
    
    .apiKeysFormRow {
        padding: 1rem;
    }
    
    .trustedIPs {
        width: 100%;
        font-size: 12px;
    }
}

/* Logo styling */
.binanceLogo {
    max-width: 34px;
}

.exchange-logo-container {
    padding: 1rem 2rem;
    background-color: #000;
    border-radius: 8px;
    margin: 0 auto;
    display: inline-block;
}

.exchange-logo {
    max-height: 55px;
    max-width: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.bybit-logo {
    height: 89px;
}

.warning-limitation-box {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(245, 158, 11, 0.3) 100%) !important;
    border: 2px solid rgba(251, 191, 36, 0.6) !important;
    backdrop-filter: blur(10px) !important;
}

.warning-limitation-box h6 {
    color: #fbbf24 !important;
    font-weight: bold !important;
    margin-bottom: 1rem !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) !important;
}

.warning-limitation-box p {
    color: #ffffff !important;
    font-weight: 500 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
    line-height: 1.6 !important;
}

.warning-limitation-box strong {
    color: #fbbf24 !important;
    font-weight: 700 !important;
}

/* Optional styling */
.optional {
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.15);
    padding: 0.5rem;
}

/* Center alignment utility */
.center {
    text-align: center;
}

.glassmorph {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Gold text for step numbers */
.gold {
    color: #ffd700;
    font-weight: 700;
}

/* Tutorial Screenshot Styling */
.tutorial-screenshot {
    height: auto;
    max-width: 80%;
    margin: 1rem auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Loading and Empty State Styling */
.loading-center {
    text-align: center;
    padding: 2rem;
}

.loading-text {
    color: #ffd700;
    margin-top: 1rem;
}

.empty-state {
    display: none;
    text-align: center;
    padding: 2rem;
    color: #ccc;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-title {
    color: #ffd700;
    margin-bottom: 1rem;
}

/* Template hiding */
.apiKeyListRowTemplate {
    display: none;
}

/* IP Address UI Styling */
.ip-header {
    color: #ffd700;
    margin-bottom: 1rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ip-header::before {
    content: "ℹ️";
}

.ip-grid {
    display: grid;
    gap: 0.8rem;
}

.ip-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ip-label {
    color: #ffd700;
    min-width: 60px;
    font-size: 14px;
    font-weight: bold;
}

.ip-input {
    flex: 1;
    padding: 0.75rem;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    color: #fff;
    font-family: monospace;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ip-input:hover {
    background: rgba(255,255,255,0.2);
    border-color: #ffd700;
}

.ip-input.copied {
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
}

.ip-copy-btn {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #ffd700 0%, #f59e0b 100%);
    border: none;
    border-radius: 6px;
    color: #000;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.ip-copy-btn:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #ffd700 100%);
    transform: translateY(-2px);
}

/* Login Required Message */
.login-required-message {
    background: rgba(255, 193, 7, 0.1);
    padding: 2rem;
    border-radius: 8px;
    border: 2px solid rgba(255, 193, 7, 0.3);
    text-align: center;
}

.login-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-title {
    color: #ffc107;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: bold;
}

.login-text {
    color: #fff;
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.login-btn {
    display: inline-block;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #ffc107 0%, #ff8f00 100%);
    color: #000;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.login-btn:hover {
    background: linear-gradient(135deg, #ff8f00 0%, #ffc107 100%);
    transform: translateY(-2px);
}

.login-tip {
    color: #ffd700;
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Tutorial Screenshot Styling */
.tutorial-screenshot-large {
    height: auto;
    max-width: 80%;
    margin: 1rem auto;
    display: block;
}

/* Hidden containers */
.instructions-hidden {
    display: none;
}

/* When tutorials are shown, integrate them better with the form */
.instructionsContainer:not(.instructions-hidden) {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

/* Tutorial header containers */
.tutorial-header {
    padding: 6px 12px;
    background-color: #000;
    border-radius: 6px;
    padding: 1rem 2rem;
    margin: 0 auto;
}

/* Key permissions row */
.key-permissions-row {
    background: rgba(255, 193, 7, 0.1);
    border: 2px solid rgba(255, 193, 7, 0.3);
}

/* Permission text styling */
.permission-order {
    color: #ffd700;
    font-weight: bold;
    font-size: 18px;
}

.permission-disabled {
    color: #ef4444;
}

/* IP Address Section */
.ip-section-bitmex {
    background: rgba(0,0,0,0.3);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #ffd700;
}

.ip-section-header {
    color: #ffd700;
    margin-bottom: 1rem;
    font-weight: bold;
}

.ip-grid {
    display: grid;
    gap: 0.8rem;
}

.ip-grid-center {
    text-align: center;
    padding: 1rem;
}

.ip-load-button {
    padding: 0.5rem 1rem;
    background: #ffd700;
    color: #000;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.copy-feedback {
    display: none;
    color: #10B981;
    margin-top: 1rem;
    font-weight: bold;
    text-align: center;
    padding: 0.5rem;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 6px;
}

.ip-disclaimer {
    color: #ffd700;
    font-size: 13px;
    margin-top: 1rem;
    text-align: center;
    padding: 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
}

.ip-disclaimer .fas.fa-lightbulb {
    color: #ffd700;
}

/* Success section styling */
.success-section {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

/* Limitations section styling */
.limitations-section {
    background: rgba(255, 193, 7, 0.1);
    border: 2px solid rgba(255, 193, 7, 0.3);
}

.limitations-title {
    color: #fbbf24;
}

.limitations-text {
    margin-top: 1rem;
    font-style: italic;
}

/* Inline icon styling */
.inline-icon {
    display: inline;
    height: 20px;
    vertical-align: middle;
}

/* Deribit permissions styling */
.permissions-section {
    margin-top: 1rem;
}

.permission-note {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Center section with padding */
.center-padded {
    padding: 1rem;
}

/* Tutorial info box */
.tutorial-info-box-bg {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.3) 100%);
}

/* Fix SweetAlert positioning and modal issues */
/* Simplified approach for better compatibility */
.swal2-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 10001 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1rem !important;
    background-color: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(3px) !important;
}

/* SweetAlert popup positioning */
.swal2-popup {
    position: relative !important;
    max-width: 500px !important;
    width: 90% !important;
    max-height: 80vh !important;
    margin: 0 !important;
    overflow-y: auto !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7) !important;
    transform: none !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
}

/* Force center positioning */
.swal2-container.swal2-center {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.swal2-container.swal2-center > .swal2-popup {
    position: relative !important;
    margin: 0 !important;
    transform: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .swal2-popup {
        max-width: 95vw !important;
        max-height: 90vh !important;
        margin: 0 !important;
    }
}

/* Ensure body doesn't interfere with positioning */
body.swal2-shown {
    overflow: hidden !important;
}

/* Additional backup positioning rules */
.swal2-modal {
    position: relative !important;
    margin: 0 auto !important;
    transform: none !important;
}

/* Custom SweetAlert positioning class */
.swal2-container-proper-position {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10000 !important;
    padding: 20px !important;
    background-color: rgba(0, 0, 0, 0.4) !important;
    backdrop-filter: blur(5px) !important;
}

.swal2-container-proper-position .swal2-popup {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0 auto !important;
    transform: none !important;
    max-width: 500px !important;
    width: 90% !important;
}

/* IP Input Fields Styling */
.ip-inputs-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    margin: 15px 0 !important;
    padding: 15px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border-radius: 8px !important;
    border: 1px solid rgba(255, 215, 0, 0.3) !important;
}

.ip-input-field {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 2px solid rgba(255, 215, 0, 0.4) !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    color: #ffffff !important;
    font-family: 'Courier New', monospace !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-align: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    outline: none !important;
}

.ip-input-field:hover {
    background: rgba(255, 215, 0, 0.1) !important;
    border-color: rgba(255, 215, 0, 0.6) !important;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3) !important;
    transform: translateY(-1px) !important;
}

.ip-input-field:focus {
    background: rgba(255, 215, 0, 0.15) !important;
    border-color: #ffd700 !important;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5) !important;
}

/* Single column on mobile */
@media (max-width: 768px) {
    .ip-inputs-grid {
        grid-template-columns: 1fr !important;
    }
}