/* ==========================================================================
   License Designer - Custom Styles
   SoftActivate Licensing SDK Interactive Demo
   ========================================================================== */

/* ==========================================================================
   Variables - Using main site colors
   ========================================================================== */

:root {
  --ld-primary: #1976D2;
  --ld-primary-light: #42A5F5;
  --ld-primary-dark: #1565C0;
  --ld-accent: #8BC34A;
  --ld-text: #212529;
  --ld-text-muted: #6c757d;
  --ld-bg: #ffffff;
  --ld-bg-subtle: #f8f9fa;
  --ld-border: #dee2e6;
}

/* ==========================================================================
   Key Preview Bar
   ========================================================================== */

#key-preview-bar {
  background: var(--ld-bg-subtle);
  border: none;
  border-left: 4px solid var(--ld-primary);
}

#key-preview-bar .card-body {
  padding: 1rem 1.25rem;
}

.key-preview-text {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 1.25rem;
  letter-spacing: 0.12em;
  font-weight: 500;
  color: var(--ld-text);
}

@media (max-width: 768px) {
  .key-preview-text {
    font-size: 0.9rem;
    letter-spacing: 0.08em;
  }
}

/* ==========================================================================
   Designer Header
   ========================================================================== */

.designer-header {
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, var(--ld-primary) 0%, var(--ld-primary-dark) 100%);
  border: none;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.designer-header-logo {
  width: 48px;
  height: auto;
  filter: brightness(0) invert(1);
}

.designer-header-title {
  font-size: 1.5rem;
  font-weight: 500;
  color: #ffffff;
}

.designer-header-subtitle {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.85);
}

/* ==========================================================================
   Step Navigation
   ========================================================================== */

.step-nav-item {
  border: none;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
  padding: 0.75rem 1rem;
}

.step-nav-item:hover {
  background-color: rgba(25, 118, 210, 0.05);
}

.step-nav-item.active {
  border-left-color: var(--ld-primary);
  background-color: rgba(25, 118, 210, 0.1);
}

.step-nav-item.active h6,
.step-nav-item.active small {
  color: var(--ld-text) !important;
}

.step-nav-item.active small {
  color: var(--ld-text-muted) !important;
}

.step-nav-item.completed {
  border-left-color: #4CAF50;
}

.step-nav-item.completed .step-number {
  background-color: #4CAF50;
  color: white;
}

/* Locked step state */
.step-nav-item.locked {
  opacity: 0.6;
}

.step-nav-item.locked .step-number {
  position: relative;
}

.step-nav-item.locked .step-number::after {
  content: '\\F47A'; /* Bootstrap lock icon */
  font-family: 'bootstrap-icons';
  position: absolute;
  font-size: 0.5rem;
  bottom: -2px;
  right: -2px;
  background: #6c757d;
  color: white;
  border-radius: 50%;
  width: 12px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Previewing state */
.step-nav-item.previewing {
  border-left-color: #ffc107;
  background-color: rgba(255, 193, 7, 0.1);
}

.step-nav-item.previewing .step-number {
  background-color: #ffc107;
  color: #212529;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: #e9ecef;
  color: var(--ld-text-muted);
  font-weight: 600;
  font-size: 0.8rem;
}

.step-nav-item.active .step-number {
  background-color: var(--ld-primary);
  color: white;
}

.step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: #e9ecef;
  color: var(--ld-text-muted);
  font-size: 0.9rem;
}

.step-nav-item.active .step-icon {
  background-color: var(--ld-primary);
  color: white;
}

/* ==========================================================================
   Step Content Cards
   ========================================================================== */

.step-content {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.step-content .card-header {
  background-color: transparent;
  border-bottom: 1px solid #e9ecef;
}

.step-content .card-header h4 {
  color: var(--ld-text);
  font-weight: 600;
}

.step-content .card-header h4 i {
  color: var(--ld-primary);
}

/* Fix vertical scrollbar on nested card headers */
.step-content .card .card-header {
  overflow: hidden;
}

/* ==========================================================================
   Capacity Meter
   ========================================================================== */

.capacity-meter {
  height: 20px;
  background-color: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
}

.capacity-signature {
  background-color: var(--ld-primary);
  height: 100%;
  transition: width 0.3s ease;
}

.capacity-data {
  background-color: var(--ld-accent);
  height: 100%;
  transition: width 0.3s ease;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
}

.legend-dot.signature {
  background-color: var(--ld-primary);
}

.legend-dot.data {
  background-color: var(--ld-accent);
}

/* ==========================================================================
   Security Indicator
   ========================================================================== */

.security-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 4px;
  font-weight: 500;
  font-size: 0.95rem;
}

.security-indicator i {
  font-size: 1.25rem;
}

.security-indicator.security-low {
  background-color: #fef2f2;
  color: #b91c1c;
}

.security-indicator.security-medium {
  background-color: #fffbeb;
  color: #b45309;
}

.security-indicator.security-good {
  background-color: #f0fdf4;
  color: #15803d;
}

/* ==========================================================================
   Key Pair Generation (Ceremonious)
   ========================================================================== */

.keypair-section {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border-radius: 0.5rem;
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
}

.keypair-btn {
  padding: 0.75rem 2rem;
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

.keypair-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

.keypair-success-icon {
  font-size: 3rem;
  animation: keypairSuccess 0.5s ease;
}

@keyframes keypairSuccess {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

.keypair-success-header h5 {
  animation: slideUp 0.3s ease 0.2s both;
}

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

.keypair-card {
  border: 1px solid #e2e8f0;
  animation: fadeInCard 0.4s ease 0.3s both;
}

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

.keypair-card .card-header {
  background: #f8fafc;
  font-weight: 500;
  font-size: 0.9rem;
}

.keypair-public .card-header {
  border-left: 3px solid var(--ld-primary);
}

.keypair-private .card-header {
  border-left: 3px solid #f59e0b;
}

.keypair-private textarea {
  border-color: #fef3c7;
}

/* ==========================================================================
   Data Fields
   ========================================================================== */

.field-item {
  background-color: var(--ld-bg-subtle);
  border: none;
  border-radius: 4px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.field-item:hover {
  background-color: #e9ecef;
}

.field-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.field-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--ld-primary);
  color: white;
  border-radius: 4px;
}

.field-details h6 {
  margin: 0;
  font-weight: 600;
}

.field-details small {
  color: #666;
}

.field-size {
  background-color: rgba(25, 118, 210, 0.1);
  color: var(--ld-primary);
  padding: 3px 10px;
  border-radius: 3px;
  font-weight: 500;
  font-size: 0.8rem;
}

.field-actions button {
  opacity: 0.6;
  transition: opacity 0.2s;
}

.field-item:hover .field-actions button {
  opacity: 1;
}

/* ==========================================================================
   Validation Results
   ========================================================================== */

.validation-success {
  animation: successPulse 0.5s ease;
}

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.validation-failure {
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

/* ==========================================================================
   Activation Cards - Subtle borders
   ========================================================================== */

.card.border-primary {
  border: 1px solid var(--ld-primary) !important;
}

.card.border-success {
  border: 1px solid #4CAF50 !important;
}

.card.border-warning {
  border: 1px solid #FF9800 !important;
}

/* ==========================================================================
   Code Snippets
   ========================================================================== */

#codeTab .nav-link {
  color: var(--ld-text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

#codeTab .nav-link:hover {
  color: var(--ld-text);
}

#codeTab .nav-link.active {
  color: var(--ld-primary);
  border-bottom-color: var(--ld-primary);
  background-color: transparent;
}

.tab-content pre {
  margin-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.tab-content pre code {
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ==========================================================================
   Preset Buttons
   ========================================================================== */

.preset-btn {
  text-align: left;
  border: 1px solid #e9ecef;
  background: transparent;
}

.preset-btn:hover {
  border-color: var(--ld-primary);
  background-color: rgba(25, 118, 210, 0.04);
}

.preset-btn.active {
  background-color: var(--ld-primary);
  color: white;
  border-color: var(--ld-primary);
}

/* ==========================================================================
   Form Controls
   ========================================================================== */

.form-range::-webkit-slider-thumb {
  background-color: #1976D2;
}

.form-range::-moz-range-thumb {
  background-color: #1976D2;
}

.form-range:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(25, 118, 210, 0.25);
}

/* ==========================================================================
   Buttons - Override main site's green to use blue for this page
   ========================================================================== */

.btn-primary,
.btn-primary:hover,
.btn-primary:active,
.btn-primary:visited,
.btn-primary:focus {
  background-color: var(--ld-primary) !important;
  border-color: var(--ld-primary) !important;
}

.btn-primary:hover {
  background-color: var(--ld-primary-dark) !important;
  border-color: var(--ld-primary-dark) !important;
}

.btn-outline-primary {
  color: var(--ld-primary);
  border-color: var(--ld-primary);
}

.btn-outline-primary:hover {
  background-color: var(--ld-primary);
  border-color: var(--ld-primary);
  color: white;
}

/* ==========================================================================
   General Card Styling - Remove heavy borders
   ========================================================================== */

.step-content.card {
  border: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card.bg-light {
  background-color: var(--ld-bg-subtle) !important;
  border: none;
  box-shadow: none;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.font-monospace {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace !important;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

/* Help Panel Styling */
.help-panel {
  border: none;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.help-panel .card-header {
  border-bottom: 1px solid #e9ecef;
}

.help-panel .card-body {
  font-size: 0.9rem;
}

.help-content h6 {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.help-content ul {
  padding-left: 1.25rem;
}

.help-content .alert {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
}

/* Quick Presets Styling */
.preset-btn {
  text-align: left;
  padding: 0.5rem 0.75rem;
}

.preset-btn small {
  font-size: 0.7rem;
  opacity: 0.7;
}

.preset-btn:hover small {
  opacity: 1;
}

/* Large screens (desktop) - 3 column layout */
@media (min-width: 992px) {
  /* Make the step nav narrower */
  .step-nav-item {
    padding: 0.5rem 0.75rem;
  }
  
  .step-nav-item h6 {
    font-size: 0.85rem;
  }
  
  .step-number {
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
  }
}

/* Medium screens (tablet) - Single column with horizontal steps */
@media (max-width: 991.98px) {
  .step-nav-card {
    position: relative;
    top: 0;
  }
  
  #step-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  
  #step-nav .list-group-item {
    flex: 0 0 auto;
    width: auto;
    border: none;
    border-bottom: 3px solid transparent;
    border-left: none !important;
    padding: 0.5rem 1rem;
  }
  
  #step-nav .list-group-item.active {
    border-bottom-color: var(--ld-primary);
    border-left-color: transparent !important;
  }
  
  #step-nav .list-group-item.completed {
    border-bottom-color: #4CAF50;
    border-left-color: transparent !important;
  }
  
  .step-nav-item .ms-3 h6 {
    font-size: 0.85rem;
    white-space: nowrap;
  }
  
  /* Help content collapsible on tablet */
  .help-panel {
    margin-top: 1rem;
  }
  
  /* Quick presets as horizontal buttons on tablet */
  .preset-btn {
    text-align: center;
  }
  
  .preset-btn small {
    display: none;
  }
}

/* Small screens (mobile) */
@media (max-width: 575.98px) {
  .container-fluid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  
  .step-content .card-body {
    padding: 1rem;
  }
  
  .btn-next, .btn-prev {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  /* Horizontal scrollable steps on mobile */
  #step-nav {
    padding-bottom: 0.5rem;
  }
  
  #step-nav .list-group-item {
    padding: 0.5rem 0.75rem;
  }
  
  .step-number {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }
  
  /* Key preview more compact */
  .key-preview-text {
    font-size: 0.8rem;
    letter-spacing: 0.05em;
  }
  
  #key-preview-bar .card-body {
    padding: 0.75rem;
  }
  
  /* Help panel simplified */
  .help-panel .card-body {
    padding: 0.75rem;
    font-size: 0.85rem;
  }
  
  .help-content h6 {
    font-size: 0.9rem;
  }
  
  .help-content ul {
    padding-left: 1rem;
    margin-bottom: 0.5rem;
  }
  
  /* Quick presets grid on mobile */
  .preset-btn {
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
  }
}

/* Very small screens */
@media (max-width: 380px) {
  .key-preview-text {
    font-size: 0.7rem;
    letter-spacing: 0.03em;
  }
  
  #step-nav .list-group-item {
    padding: 0.4rem 0.5rem;
  }
  
  .step-nav-item .ms-3 h6 {
    font-size: 0.75rem;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  #key-preview-bar,
  .step-nav-card,
  .btn-next,
  .btn-prev,
  .preset-btn {
    display: none !important;
  }
  
  .step-content {
    display: block !important;
    page-break-inside: avoid;
  }
}

/* ==========================================================================
   Step Preview Overlay
   ========================================================================== */

.step-preview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(1px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: 0.5rem;
}

.step-preview-overlay.active {
  display: flex;
}

.step-preview-content {
  text-align: center;
  padding: 2rem;
}

.step-preview-content h5 {
  color: var(--ld-text);
  margin-bottom: 0.5rem;
}

/* Ensure step content cards have relative positioning for overlay */
.col-lg-7 {
  position: relative;
}
