/* Apple Developer Integration Modal Styles */
.apple-developer-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.apple-developer-modal-content {
  background-color: #1a1a1a;
  margin: 5% auto;
  padding: 30px;
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
  position: relative;
  max-width: 580px; /* Reduced width for a cleaner look */
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  color: #fff;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Close Button */
.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #999;
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: all 0.2s ease;
  z-index: 1001;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  transform: scale(1.05);
}

/* Header */
.modal-header {
  text-align: center;
  margin-bottom: 25px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.apple-title {
  font-size: 1.8rem;
  margin: 0 0 10px 0;
  background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.apple-subtitle {
  color: #ccc;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 90%;
  text-align: center;
}

/* Status Section */
.apple-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #2a2a2a;
  border-radius: 10px;
  margin-bottom: 25px;
  border-left: 4px solid #007AFF;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #666;
  transition: all 0.3s ease;
}

.status-dot.connecting {
  background: #FF9500;
  animation: pulse 1.5s ease-in-out infinite;
}

.status-dot.connected {
  background: #34C759;
}

.status-dot.validating {
  background: #007AFF;
  animation: pulse 1.5s ease-in-out infinite;
}

.status-dot.error {
  background: #FF3B30;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-text {
  color: #fff;
  font-weight: 500;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ccc;
  font-size: 0.9rem;
}

/* Connection Steps */
.connection-steps {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 30px;
  width: 100%;
  background: #2a2a2a;
  border-radius: 12px;
  padding: 24px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
}

.step-number {
  color: #ffffff;
  font-size: 18px;
  font-weight: 600;
  min-width: 20px;
  flex-shrink: 0;
}

.step-icon {
  font-size: 18px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-title {
  color: #ffffff;
  font-size: 18px;
  font-weight: 500;
  flex: 1;
}

/* Form Styles */
.modal-section {
  margin-bottom: 25px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: #fff;
  font-weight: 500;
  font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  color: #fff;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  box-sizing: border-box;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #007AFF;
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.15);
  background-color: #2d2d2d;
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.4;
}

.help-text {
  display: block;
  margin-top: 4px;
  color: #999;
  font-size: 0.8rem;
  line-height: 1.4;
}

/* Buttons */
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 25px;
}

.primary-button {
  background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  position: relative;
}

.primary-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #0056CC 0%, #4A42C7 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 122, 255, 0.3);
}

.primary-button:disabled {
  background: #555;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.secondary-button {
  background: #333;
  color: #fff;
  border: 1px solid #555;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.secondary-button:hover {
  background: #444;
  transform: translateY(-1px);
}

.danger-button {
  background: linear-gradient(135deg, #FF3B30 0%, #D70015 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.danger-button:hover {
  background: linear-gradient(135deg, #D70015 0%, #FF3B30 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 59, 48, 0.3);
}

/* Connected State */
.connected-info {
  text-align: center;
  margin-bottom: 30px;
}

.success-icon {
  font-size: 3rem;
  margin-bottom: 15px;
}

.connected-info h3 {
  color: #34C759;
  margin: 0 0 10px 0;
  font-size: 1.5rem;
}

.connected-info p {
  color: #ccc;
  margin: 0 0 20px 0;
}

.credential-summary {
  background: #2a2a2a;
  border-radius: 12px;
  padding: 20px;
  margin-top: 20px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #444;
}

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

.summary-item .label {
  color: #999;
  font-size: 0.9rem;
}

.summary-item .value {
  color: #fff;
  font-weight: 500;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.85rem;
}

.connected-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.connected-actions .danger-button {
  grid-column: 1 / -1;
}

/* Apps List */
.apps-list {
  max-height: 400px;
  overflow-y: auto;
}

.app-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: #2a2a2a;
  border-radius: 12px;
  margin-bottom: 12px;
  transition: all 0.3s ease;
}

.app-item:hover {
  background: #333;
  transform: translateY(-1px);
}

.app-item:last-child {
  margin-bottom: 0;
}

.app-info h4 {
  margin: 0 0 5px 0;
  color: #fff;
  font-size: 1.1rem;
}

.app-bundle-id {
  margin: 0 0 5px 0;
  color: #007AFF;
  font-size: 0.9rem;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.app-sku {
  margin: 0;
  color: #999;
  font-size: 0.85rem;
}

.app-meta {
  text-align: right;
}

.app-locale {
  background: #444;
  color: #fff;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* Validation Results */
.validation-success,
.validation-error {
  text-align: center;
  padding: 30px;
  border-radius: 12px;
  margin-bottom: 20px;
}

.validation-success {
  background: linear-gradient(135deg, rgba(52, 199, 89, 0.1) 0%, rgba(52, 199, 89, 0.05) 100%);
  border: 1px solid rgba(52, 199, 89, 0.2);
}

.validation-error {
  background: linear-gradient(135deg, rgba(255, 59, 48, 0.1) 0%, rgba(255, 59, 48, 0.05) 100%);
  border: 1px solid rgba(255, 59, 48, 0.2);
}

.validation-success .success-icon,
.validation-error .error-icon {
  font-size: 3rem;
  margin-bottom: 15px;
}

.validation-success h3 {
  color: #34C759;
  margin: 0 0 10px 0;
}

.validation-error h3 {
  color: #FF3B30;
  margin: 0 0 10px 0;
}

.validation-success p,
.validation-error p {
  color: #ccc;
  margin: 0 0 10px 0;
}

.validation-success small,
.validation-error small {
  color: #999;
  font-size: 0.85rem;
}

/* Loading Spinner */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #444;
  border-radius: 50%;
  border-top-color: #007AFF;
  animation: spin 1s ease-in-out infinite;
}

.apple-logo-icon {
  width: 24px;
  height: 24px;
  vertical-align: middle;
  margin-bottom: 2px;
  filter: brightness(0) invert(1);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

.empty-state p {
  margin: 0 0 10px 0;
  line-height: 1.5;
}

/* Notifications */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  z-index: 10000;
  animation: slideIn 0.3s ease;
  max-width: 400px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.notification.success {
  background: linear-gradient(135deg, #34C759 0%, #28A745 100%);
}

.notification.error {
  background: linear-gradient(135deg, #FF3B30 0%, #DC3545 100%);
}

.notification.info {
  background: linear-gradient(135deg, #007AFF 0%, #0056CC 100%);
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Build Styles */
.build-config {
  margin-bottom: 20px;
}

.form-group-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.build-status {
  background: #2a2a2a;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

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

.build-id-tag {
  background: #444;
  color: #fff;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

.build-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  color: #ccc;
  font-size: 0.9rem;
}

.progress-bar {
  background: #444;
  border-radius: 8px;
  height: 8px;
  margin-bottom: 20px;
  overflow: hidden;
}

.progress-fill {
  background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 8px;
}

.build-steps {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.build-step {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #333;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.build-step:hover {
  background: #3a3a3a;
}

.step-icon {
  font-size: 1.2rem;
  margin-right: 12px;
  width: 24px;
  text-align: center;
}

.build-step-content {
  flex: 1;
  width: 100%;
}

.build-step span {
  color: #fff;
  font-weight: 500;
}

.step-status {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

.step-status.pending {
  background: #555;
  color: #ccc;
}

.step-status.running {
  background: #FF9500;
  color: #fff;
  animation: pulse 1.5s ease-in-out infinite;
}

.step-status.completed {
  background: #34C759;
  color: #fff;
}

.step-status.failed {
  background: #FF3B30;
  color: #fff;
}

.build-logs {
  margin-bottom: 20px;
}

.build-logs h4 {
  color: #fff;
  margin: 0 0 10px 0;
  font-size: 1rem;
}

.log-content {
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 12px;
  max-height: 200px;
  overflow-y: auto;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.4;
}

.log-entry {
  margin-bottom: 4px;
  color: #ccc;
}

.log-entry:last-child {
  margin-bottom: 0;
}

.log-entry.info {
  color: #ccc;
}

.log-entry.success {
  color: #34C759;
}

.log-entry.warning {
  color: #FF9500;
}

.log-entry.error {
  color: #FF3B30;
}

.log-time {
  color: #666;
  margin-right: 8px;
}

.log-message {
  color: inherit;
}

/* Connected actions grid update */
.connected-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.connected-actions .danger-button {
  grid-column: 1 / -1;
}

/* Responsive Design */
@media (max-width: 768px) {
  .apple-developer-modal-content {
    margin: 5% auto;
    padding: 20px;
    width: 92%;
  }

  .apple-title {
    font-size: 1.4rem;
  }

  .connection-steps {
    gap: 16px;
    padding: 20px;
  }

  .step-item {
    font-size: 16px;
  }

  .connected-actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .form-group-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .form-actions {
    flex-direction: column;
    gap: 10px;
  }

  .primary-button,
  .secondary-button,
  .danger-button {
    width: 100%;
    justify-content: center;
  }

  .notification {
    left: 20px;
    right: 20px;
    max-width: none;
  }

  .build-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
}

/* Build Actions */
.build-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.build-actions button,
.build-actions a {
  flex: 1;
  min-width: 140px;
}

/* Upload Button Specific Styling */
#start-upload-btn {
  background: linear-gradient(135deg, #007AFF 0%, #0056CC 100%);
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

#start-upload-btn:hover {
  background: linear-gradient(135deg, #0056CC 0%, #003D99 100%);
  transform: translateY(-1px);
}

#start-upload-btn:active {
  transform: translateY(0);
}

/* App Store Connect Link */
#appstore-connect-link {
  background: linear-gradient(135deg, #34C759 0%, #28A745 100%);
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

#appstore-connect-link:hover {
  background: linear-gradient(135deg, #28A745 0%, #1E7E34 100%);
  transform: translateY(-1px);
}

/* Upload Steps Styling */
.build-step.upload-step {
  border-left: 3px solid #007AFF;
  background: rgba(0, 122, 255, 0.05);
}

.build-step.upload-step .step-icon {
  color: #007AFF;
}

/* Upload Progress Animation */
.upload-progress-bar {
  position: relative;
  overflow: hidden;
}

.upload-progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%; 
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.2) 50%, transparent 100%);
  animation: upload-shimmer 2s infinite;
}

@keyframes upload-shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Upload Status Indicators */
.upload-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 12px;
  background: rgba(0, 122, 255, 0.1);
  border-radius: 6px;
  border-left: 3px solid #007AFF;
}

.upload-status.success {
  background: rgba(52, 199, 89, 0.1);
  border-left-color: #34C759;
}

.upload-status.error {
  background: rgba(255, 59, 48, 0.1);
  border-left-color: #FF3B30;
}

/* Upload Time Remaining */
.upload-time-remaining {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
  font-style: italic;
}

/* Upload Log Entries */
.build-log-entry.upload {
  border-left-color: #007AFF;
  background: rgba(0, 122, 255, 0.02);
}

.build-log-entry.upload .log-level {
  color: #007AFF;
}

/* Success States */
.upload-complete {
  background: linear-gradient(135deg, #34C759 0%, #28A745 100%);
  color: white;
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
  text-align: center;
}

.upload-complete .success-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.upload-complete .success-message {
  font-weight: 600;
  margin-bottom: 4px;
}

.upload-complete .success-details {
  font-size: 14px;
  opacity: 0.9;
}

/* Loading spinner animation */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.loading-spinner {
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
}

.primary-button .loading-spinner {
  margin-right: 8px;
}

.primary-button .connect-icon {
  margin-right: 8px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .build-actions {
    flex-direction: column;
  }
  
  .build-actions button,
  .build-actions a {
    min-width: auto;
  }
} 