/* Core theme variables */
:root {
    --primary-color: #007bff;
    --secondary-color: #0056b3;
    --background-color: #f5f5f5;
    --border-color: #ddd;
    --border-radius: 8px;
    --padding: 12px;
    --margin: 10px;
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
}

/* Reset and core layout */
* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--background-color);
    margin: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--padding);
    flex: 1;
}

/* Header container for tokens and PayPal */
.header-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    padding: var(--padding);
    border-radius: var(--border-radius);
    margin-bottom: var(--margin);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.token-balance-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: var(--success-color);
    margin: 0 10px;
}

.token-balance-container img {
    width: 24px;
    height: 24px;
    margin-right: 8px;
}

.token-balance-container h2 {
    font-size: 14px;
    font-weight: normal;
    margin: 0;
    display: inline;
}

#paypal-button-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50px;
    margin: 0 10px;
    padding: 6px;
}

/* PayPal modal button containers */
.paypal-button-container-modal {
    display: none;
    justify-content: center;
    align-items: center;
}



/* Instance details row */
.instance-details-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 8px;
    background-color: #f9f9f9;
    border-radius: var(--border-radius);
    margin-bottom: var(--margin);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.instance-details-row span {
    font-size: 14px;
    margin: 4px;
}

/* Buttons and actions */
button {
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    transition: background-color 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:hover {
    background-color: var(--primary-color);
    color: white;
}
/* Override Buy Tokens jump: keep consistent green on hover and remove focus outline */
.btn-success:hover, .btn-success:focus {
    background-color: #218838 !important; /* darker green */
    border-color: #1e7e34 !important;
    color: white !important;
    outline: none !important;
    box-shadow: none !important;
}
/* Additional: ensure Buy Tokens button has no jump or outline */
#buy-tokens-btn {
    outline: none !important;
    box-shadow: none !important;
}

.instance-info-actions {
    margin-top: var(--margin);
    text-align: right;
}

.instance-info-actions button {
    margin-left: 10px;
}

.instance-button {
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: #fff;
}

.instance-button:hover {
    background-color: #e9e9e9;
}

.truncate-text {
    display: inline-block;
    max-width: 90%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Copy API Button Styling */
.copy-api-btn {
    display: inline-block;
    padding: 10px 15px;
    font-size: 14px;
    color: white;
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.copy-api-btn:hover {
    background: linear-gradient(135deg, #0056b3, #003f7f);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Full-screen button positioning */
.full-screen-btn-container {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
}

.full-screen-btn-container button {
    width: 150px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.full-screen-btn-container button:hover {
    background-color: var(--secondary-color);
}

/* Full-screen container styles */
#frame-container {
    position: relative;
    width: 100%;
    height: 600px;
}


#frame-container.full-screen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 9999 !important;
    background-color: #fff;
    border: none;
}

#instance-frame.full-screen {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
}

/* 🌟 WORLD'S MOST CREATIVE ORBITAL PROGRESS SYSTEM 🌟 */
.progress-bar-container {
    position: fixed;
    top: 60px; /* Below Full Screen button */
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 120px;
    z-index: 9999; /* Below Full Screen button (10000) */
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.progress-bar-container.active {
    opacity: 1;
}

/* Orbital ring system */
.progress-bar {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Central orb with pulsing glow */
.progress-bar::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.8),
                0 0 60px rgba(102, 126, 234, 0.4),
                inset 0 0 20px rgba(255, 255, 255, 0.2);
    animation: orb-pulse 2s infinite;
}

/* Orbital path ring */
.orbital-path {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid rgba(102, 126, 234, 0.1);
    border-radius: 50%;
    animation: path-glow 3s infinite;
}

@keyframes path-glow {
    0%, 100% { border-color: rgba(102, 126, 234, 0.1); }
    50% { border-color: rgba(102, 126, 234, 0.3); }
}

/* Orbiting particles with trails */
.orbital-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    top: -4px;
    left: 50%;
    transform-origin: center 64px;
    box-shadow: 0 0 10px currentColor,
                0 0 20px currentColor,
                0 0 30px currentColor;
}

.orbital-particle:nth-child(2) {
    animation: orbit 2s linear infinite;
}

.orbital-particle:nth-child(3) {
    animation: orbit 2s linear infinite 0.66s;
    background: #764ba2;
}

.orbital-particle:nth-child(4) {
    animation: orbit 2s linear infinite 1.33s;
    background: #f687b3;
}

/* Particle trail effect */
.orbital-particle::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 2px;
    background: linear-gradient(90deg, transparent, currentColor);
    top: 3px;
    right: 8px;
    opacity: 0.6;
}

@keyframes orbit {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes orb-pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        filter: brightness(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        filter: brightness(1.3);
    }
}

/* Glassmorphic progress text */
.progress-bar-text {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: #667eea;
    white-space: nowrap;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Completion animation */
.progress-complete .progress-bar::before {
    animation: completion-burst 0.5s ease-out forwards;
}

@keyframes completion-burst {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .progress-bar-container {
        top: 70px;
        transform: translateX(-50%) scale(0.8);
    }
}

/* Full screen mode safety */
#frame-container.full-screen ~ .progress-bar-container,
.full-screen .progress-bar-container {
    top: 70px !important; /* Always below Full Screen button */
}

.instance-button.active {
    background-color: var(--secondary-color);
    color: #fff;
    border-color: var(--secondary-color);
}

.instance-info-container {
    width: 100%;
    text-align: center;
    margin-bottom: var(--margin);
    background-color: #f5f5f5;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.instance-info-header {
    margin-bottom: 8px;
}

.instance-info-header h2 {
    font-weight: bold;
    font-size: 18px;
    color: var(--primary-color);
    margin-top: 0;
}

.instance-info-details {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

.instance-info-detail {
    margin-right: 16px;
    margin-bottom: 16px;
}

.instance-info-detail h3 {
    font-weight: bold;
    font-size: 16px;
    margin-top: 0;
}

.instance-info-detail p {
    font-size: 14px;
    color: #666;
}


/* Tariff card styling */
.tariff-card {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}
.tariff-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.tariff-card.selected {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--primary-color);
}
/* Originally hid secondary header; now removed to display token balance and actions */
/* .header-container { display: none; } */

/* Sidebar offcanvas scroll */
.offcanvas-body { overflow-y: auto; }

/* Style instance list items */
.list-group-item small {
  color: #666;
  font-size: 12px;
}
.list-group-item i {
  margin-right: 4px;
}
.offcanvas-body { overflow-y: auto; }

/* Ensure the modal overlays everything */
.modal {
  z-index: 10500 !important;
}
 .modal-backdrop {
  z-index: 10400 !important;
 }

/* Responsive layout */
@media (max-width: 767px) {
  /* Mobile-specific responsive adjustments */
  .header-container {
    flex-direction: column;
    align-items: center;
  }

  .instance-details-row,
  .instance-info-details,
  .instance-info-actions {
    flex-direction: column;
    align-items: stretch;
  }

  /* Adjust button sizing for mobile */
  button {
    font-size: 12px;
    padding: 8px;
    width: 100%;
    margin-bottom: 10px;
  }

  .instance-button {
    flex: 1 1 auto;
    max-width: 100%;
    width: 100%;
    margin-bottom: 10px;
  }

  /* Ensure text truncation fills available width */
  .truncate-text {
    max-width: 100%;
  }

  .full-screen-btn-container {
    top: 0;
    left: 0;
    width: 100%;
    transform: none;
  }

  #frame-container {
    /* Dynamic height: 60% of viewport for mobile */
    height: 60vh;
  }
  /* Fullscreen modal on mobile for better UX */
  .modal-dialog {
    max-width: 100% !important;
    margin: 0;
  }
  .modal-content {
    border-radius: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
  }
  .modal-body {
    overflow-y: auto;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  /* Use grid layout for detail rows on tablet for better alignment */
  .instance-details-row,
  .instance-info-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--margin);
  }
  button, .instance-button {
    width: auto;
  }
  .full-screen-btn-container {
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
  }
  #frame-container {
    /* Dynamic height: 75% of viewport for tablet */
    height: 75vh;
  }
}

@media (min-width: 1024px) {
  .instance-details-row,
  .instance-info-details,
  .instance-info-actions {
    justify-content: space-between;
  }
  button, .instance-button {
    width: auto;
  }
  .full-screen-btn-container {
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
  }
  #frame-container {
    /* Dynamic height: 80% of viewport for desktop */
    height: 80vh;
  }
}

