/* PostyBot - Modern Premium Styles */

:root {
  --pstb-primary: #6366f1;
  --pstb-primary-dark: #4f46e5;
  --pstb-primary-light: #818cf8;
  --pstb-secondary: #8b5cf6;
  --pstb-success: #10b981;
  --pstb-error: #ef4444;
  --pstb-warning: #f59e0b;
  --pstb-bg: #f9fafb;
  --pstb-card-bg: #ffffff;
  --pstb-border: #e5e7eb;
  --pstb-text: #111827;
  --pstb-text-secondary: #6b7280;
  --pstb-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --pstb-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --pstb-radius: 8px;
  --pstb-transition: all 0.2s ease;
}

* {
  box-sizing: border-box;
}

.pstb-app {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--pstb-text);
  background: var(--pstb-bg);
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Header */
.pstb-header {
  text-align: center;
  margin-bottom: 32px;
  padding: 32px 20px;
  background: linear-gradient(135deg, var(--pstb-primary) 0%, var(--pstb-secondary) 100%);
  border-radius: var(--pstb-radius);
  color: white;
  box-shadow: var(--pstb-shadow-lg);
}

#postybot-root .pstb-title {
  color: #ddd;
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.pstb-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: inline-block;
  vertical-align: middle;
  transition: transform 0.3s ease;
}

.pstb-logo:hover {
  transform: scale(1.1) rotate(5deg);
}

.pstb-subtitle {
  margin: 12px 0 0;
  font-size: 1.1rem;
  opacity: 0.95;
  font-weight: 400;
}

/* Navigation */
.pstb-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
  background: var(--pstb-card-bg);
  padding: 10px;
  border-radius: var(--pstb-radius);
  box-shadow: var(--pstb-shadow);
}

.pstb-nav-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: 2px solid transparent;
  background: transparent;
  border-radius: var(--pstb-radius);
  font-size: 1rem;
  font-weight: 500;
  color: var(--pstb-text-secondary);
  cursor: pointer;
  transition: var(--pstb-transition);
}

.pstb-nav-item:hover {
  background: var(--pstb-bg);
  color: var(--pstb-primary);
}

.pstb-nav-item.active {
  background: var(--pstb-primary);
  color: white;
  box-shadow: var(--pstb-shadow);
}

.pstb-nav-icon {
  font-size: 1.2rem;
}

/* Card */
.pstb-card {
  background: var(--pstb-card-bg);
  border-radius: var(--pstb-radius);
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: var(--pstb-shadow);
  transition: var(--pstb-transition);
}

.pstb-card:hover {
  box-shadow: var(--pstb-shadow-lg);
}

.pstb-card-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 20px;
  color: var(--pstb-text);
  border-bottom: 2px solid var(--pstb-primary);
  padding-bottom: 10px;
}

.pstb-card-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Form Elements */
.pstb-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

.pstb-input-wrapper:first-child {
  margin-top: 0;
}

.pstb-label {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--pstb-text);
}

.pstb-input,
.pstb-select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--pstb-border);
  border-radius: var(--pstb-radius);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--pstb-transition);
  background: var(--pstb-card-bg);
  color: var(--pstb-text);
  line-height: 1.5;
  min-height: 48px;
}

.pstb-select {
  cursor: pointer;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1.41 0L6 4.59L10.59 0L12 1.41l-6 6l-6-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.pstb-input:hover,
.pstb-select:hover {
  border-color: #d1d5db;
}

.pstb-input:focus,
.pstb-select:focus {
  outline: none;
  border-color: var(--pstb-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.pstb-input-error {
  border-color: var(--pstb-error);
}

.pstb-help-text {
  font-size: 0.875rem;
  color: var(--pstb-text-secondary);
  margin-top: -4px;
}

.pstb-error-text {
  font-size: 0.875rem;
  color: var(--pstb-error);
  margin-top: -4px;
}

/* Buttons */
.pstb-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--pstb-radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--pstb-transition);
  position: relative;
}

.pstb-button-primary {
  background: linear-gradient(135deg, var(--pstb-primary) 0%, var(--pstb-secondary) 100%);
  color: white;
}

.pstb-button-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--pstb-shadow-lg);
}

.pstb-button-secondary {
  background: var(--pstb-bg);
  color: var(--pstb-text);
  border: 2px solid var(--pstb-border);
}

.pstb-button-secondary:hover:not(:disabled) {
  background: var(--pstb-card-bg);
  border-color: var(--pstb-primary);
  color: var(--pstb-primary);
}

.pstb-button-danger {
  background: var(--pstb-error);
  color: white;
}

.pstb-button-small {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.pstb-button-large {
  padding: 16px 32px;
  font-size: 1.1rem;
}

.pstb-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pstb-button-loading {
  pointer-events: none;
}

.pstb-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Parameter Section */
.pstb-parameter-section {
  border: 2px solid var(--pstb-border);
  border-radius: var(--pstb-radius);
  overflow: hidden;
  margin-bottom: 15px;
}

.pstb-parameter-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: var(--pstb-bg);
  border: none;
  cursor: pointer;
  transition: var(--pstb-transition);
}

.pstb-parameter-header:hover {
  background: #f3f4f6;
}

.pstb-parameter-title {
  font-weight: 600;
  font-size: 1rem;
}

.pstb-parameter-icon {
  transition: transform 0.3s ease;
}

.pstb-parameter-icon.open {
  transform: rotate(180deg);
}

.pstb-parameter-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  animation: slideDown 0.3s ease;
}

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

/* Presets */
.pstb-presets {
  margin-bottom: 24px;
}

.pstb-presets > .pstb-label {
  display: block;
  margin-bottom: 12px;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--pstb-text);
}

.pstb-preset-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pstb-preset-button-active {
  background: var(--pstb-primary) !important;
  color: white !important;
  border-color: var(--pstb-primary) !important;
}

/* Actions */
.pstb-actions {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid var(--pstb-border);
}

/* Toast */
.pstb-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--pstb-card-bg);
  border-radius: var(--pstb-radius);
  box-shadow: var(--pstb-shadow-lg);
  z-index: 1000;
  animation: slideInBottom 0.3s ease;
  min-width: 300px;
}

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

.pstb-toast-success {
  border-left: 4px solid var(--pstb-success);
}

.pstb-toast-error {
  border-left: 4px solid var(--pstb-error);
}

.pstb-toast-info {
  border-left: 4px solid var(--pstb-primary);
}

.pstb-toast-icon {
  font-size: 1.5rem;
}

.pstb-toast-message {
  flex: 1;
  font-weight: 500;
}

.pstb-toast-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--pstb-text-secondary);
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* History */
.pstb-history-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.pstb-history-item {
  border: 2px solid var(--pstb-border);
  border-radius: var(--pstb-radius);
  padding: 20px;
  transition: var(--pstb-transition);
}

.pstb-history-item:hover {
  border-color: var(--pstb-primary);
  box-shadow: var(--pstb-shadow);
}

.pstb-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.pstb-history-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
}

.pstb-history-date {
  color: var(--pstb-text-secondary);
  font-size: 0.875rem;
}

.pstb-history-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pstb-history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.pstb-meta-item {
  font-size: 0.9rem;
  color: var(--pstb-text-secondary);
}

.pstb-history-actions {
  display: flex;
  gap: 15px;
  margin-top: 10px;
}

.pstb-link {
  color: var(--pstb-primary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--pstb-transition);
}

.pstb-link:hover {
  color: var(--pstb-primary-dark);
  text-decoration: underline;
}

/* Badges */
.pstb-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.pstb-badge-success {
  background: #d1fae5;
  color: #065f46;
}

.pstb-badge-error {
  background: #fee2e2;
  color: #991b1b;
}

.pstb-badge-pending {
  background: #fef3c7;
  color: #92400e;
}

/* Pagination */
.pstb-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid var(--pstb-border);
}

.pstb-page-info {
  font-weight: 500;
  color: var(--pstb-text-secondary);
}

/* Loading & Empty States */
.pstb-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--pstb-text-secondary);
  font-size: 1.1rem;
}

.pstb-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--pstb-text-secondary);
}

.pstb-empty-state p {
  font-size: 1.1rem;
  margin: 0;
}

/* API Keys Section */
.pstb-api-keys {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid var(--pstb-border);
}

.pstb-api-keys h4 {
  margin: 0 0 15px;
  font-size: 1.1rem;
  color: var(--pstb-text);
}

/* Error Message in History */
.pstb-error-message {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px 15px;
  border-radius: var(--pstb-radius);
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
  .pstb-app {
    padding: 10px;
  }

  .pstb-title {
    font-size: 2rem;
  }

  .pstb-nav {
    flex-direction: column;
  }

  .pstb-preset-buttons {
    flex-direction: column;
  }

  .pstb-history-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .pstb-actions {
    flex-direction: column;
  }

  .pstb-toast {
    left: 10px;
    right: 10px;
    min-width: auto;
  }
}
