/* CUSS1 Platform Tester - Theme Styles */

/* CSS Variables */
:root {
  /* Primary Colors */
  --primary-cyan: #64ffda;
  --secondary-blue: #48cae4;
  --dark-navy: #0f0f1e;
  --dark-purple: #1a1a2e;

  /* Text Colors */
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;

  /* Status Colors */
  --error-red: #ff6464;
  --warning-orange: #ffc864;
  --warning-yellow: #ffc107;
  --success-green: #64ff8f;

  /* Spacing */
  --spacing-xs: 5px;
  --spacing-sm: 10px;
  --spacing-md: 15px;
  --spacing-lg: 20px;
  --spacing-xl: 30px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Font */
  --font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background: var(--dark-navy);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-lg);
  background: var(--dark-purple);
  border-bottom: 2px solid var(--primary-cyan);
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

/* Buttons */
.btn-primary {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(
    135deg,
    var(--primary-cyan),
    var(--secondary-blue)
  );
  color: var(--dark-navy);
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(100, 255, 218, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-icon {
  padding: 10px;
  border: 1px solid var(--primary-cyan);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--primary-cyan);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-icon:hover {
  background: rgba(100, 255, 218, 0.1);
}

.play-icon {
  font-size: 14px;
}

.settings-icon {
  font-size: 20px;
}

/* Main Content */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Test Panel (Left) */
.test-panel {
  width: 40%;
  background: var(--dark-purple);
  border-right: 1px solid rgba(100, 255, 218, 0.2);
  overflow-y: auto;
  padding: var(--spacing-lg);
}

.test-tree {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

/* Test Item Styles */
.test-item {
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s ease;
}

.test-item:hover {
  background: rgba(100, 255, 218, 0.05);
}

.test-item.selected {
  background: rgba(100, 255, 218, 0.1);
  border-left: 3px solid var(--primary-cyan);
}

.test-item:focus {
  outline: 2px solid var(--primary-cyan);
  outline-offset: -2px;
}

.test-item:focus:not(:focus-visible) {
  outline: none;
}

.test-item:focus-visible {
  outline: 2px solid var(--primary-cyan);
  outline-offset: -2px;
}

.test-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.test-item.disabled:hover {
  background: transparent;
}

.test-item.skipped {
  opacity: 0.5;
}

.test-item.skipped .test-name {
  text-decoration: line-through;
}

/* Test Item Content */
.test-item-content {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.test-item-content input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-cyan);
}

.test-item-content input[type="checkbox"]:disabled {
  cursor: not-allowed;
}

.test-item-content .test-name {
  font-size: 14px;
  cursor: pointer;
}

.test-item.state-test {
  font-style: italic;
}

.test-item .status-icon {
  margin-left: auto;
  font-size: 16px;
}

.status-icon.pass {
  color: var(--success-green);
}

.status-icon.fail {
  color: var(--error-red);
}

.status-icon.pending {
  color: var(--text-muted);
}

/* Collapse/Expand chevron */
.test-item-container.has-children > .test-item .test-item-content::before {
  content: "▶";
  font-size: 10px;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
  margin-right: var(--spacing-xs);
}

.test-item-container.has-children:not(.collapsed) > .test-item .test-item-content::before {
  transform: rotate(90deg);
}

/* Nested Tests */
.test-children {
  margin-left: var(--spacing-lg);
  border-left: 1px solid rgba(100, 255, 218, 0.2);
  padding-left: var(--spacing-md);
  margin-top: var(--spacing-xs);
}

/* Collapsed state hides children */
.test-item-container.collapsed > .test-children {
  display: none;
}

/* Results Panel (Right) */
.results-panel {
  flex: 1;
  background: var(--dark-navy);
  overflow-y: auto;
  padding: var(--spacing-lg);
}

.results-panel h2 {
  font-size: 1.2rem;
  margin-bottom: var(--spacing-lg);
  color: var(--text-primary);
}

.results-container {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

/* Empty State */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* Test Result Card */
.test-result {
  background: var(--dark-purple);
  border: 1px solid rgba(100, 255, 218, 0.2);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
}

.test-result.pass {
  border-left: 4px solid var(--success-green);
}

.test-result.fail {
  border-left: 4px solid var(--error-red);
}

.test-result.pending {
  border-left: 4px solid var(--text-muted);
  opacity: 0.7;
}

.test-result-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

.test-result-header .status-icon {
  font-size: 18px;
}

.test-result-header h3 {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
}

.test-duration {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: normal;
}

.test-suite-header {
  font-size: 12px;
  color: var(--primary-cyan);
  font-weight: 600;
  padding: var(--spacing-sm) 0;
  margin-top: var(--spacing-md);
  border-bottom: 1px solid rgba(100, 255, 218, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.test-suite-header:first-child {
  margin-top: 0;
}

.test-result-title {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-sm);
}

/* Messages Section */
.messages-section {
  margin-top: var(--spacing-sm);
}

.messages-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xs);
  font-weight: 600;
}

.message-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(100, 255, 218, 0.1);
  border-radius: var(--radius-sm);
  padding: var(--spacing-sm);
  font-family: "Courier New", monospace;
  font-size: 12px;
  color: var(--text-primary);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.error-message {
  border-color: rgba(255, 100, 100, 0.3);
}

.log-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--warning-yellow);
  margin-top: var(--spacing-md);
  margin-bottom: var(--spacing-xs);
}

.log-message {
  border-color: rgba(255, 201, 7, 0.3);
  max-height: 300px;
  overflow-y: auto;
}

.log-entry {
  padding: var(--spacing-xs) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.log-entry:last-child {
  border-bottom: none;
}

/* Scrollbar Styling */
.test-panel::-webkit-scrollbar,
.results-panel::-webkit-scrollbar,
.message-box::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.test-panel::-webkit-scrollbar-track,
.results-panel::-webkit-scrollbar-track,
.message-box::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.test-panel::-webkit-scrollbar-thumb,
.results-panel::-webkit-scrollbar-thumb,
.message-box::-webkit-scrollbar-thumb {
  background: rgba(100, 255, 218, 0.3);
  border-radius: 4px;
}

.test-panel::-webkit-scrollbar-thumb:hover,
.results-panel::-webkit-scrollbar-thumb:hover,
.message-box::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 255, 218, 0.5);
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--dark-purple);
  border: 2px solid var(--primary-cyan);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-lg);
  border-bottom: 1px solid rgba(100, 255, 218, 0.2);
}

.modal-header h2 {
  font-size: 1.5rem;
  color: var(--primary-cyan);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 32px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

/* User Prompt Modal */
.prompt-modal .prompt-content {
  background: var(--dark-purple);
  border: 3px solid var(--primary-cyan);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  min-width: 400px;
  max-width: 600px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(100, 255, 218, 0.2);
}

.prompt-modal .prompt-close {
  position: absolute;
  top: var(--spacing-sm);
  right: var(--spacing-sm);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 36px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  line-height: 1;
}

.prompt-modal .prompt-close:hover {
  color: var(--error-red);
}

.prompt-modal .prompt-message {
  font-size: 2rem;
  color: var(--text-primary);
  text-align: center;
  padding: var(--spacing-xl) var(--spacing-lg);
  line-height: 1.4;
}

.modal-close:hover {
  color: var(--error-red);
}

.modal-body {
  padding: var(--spacing-lg);
}

.modal-footer {
  padding-top: var(--spacing-lg);
  display: flex;
  justify-content: flex-end;
}

/* Form Styles */
.form-group {
  margin-bottom: var(--spacing-md);
}

.form-group label {
  display: block;
  margin-bottom: var(--spacing-xs);
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
}

.form-group input {
  width: 100%;
  padding: 12px;
  background: var(--dark-navy);
  border: 1px solid rgba(100, 255, 218, 0.2);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-cyan);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.input-with-button {
  display: flex;
  gap: var(--spacing-sm);
}

.input-with-button input {
  flex: 1;
}

.btn-secondary {
  padding: 10px 16px;
  border: 1px solid var(--primary-cyan);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--primary-cyan);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: rgba(100, 255, 218, 0.1);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .main-content {
    flex-direction: column;
  }

  .test-panel {
    width: 100%;
    max-height: 50vh;
    border-right: none;
    border-bottom: 1px solid rgba(100, 255, 218, 0.2);
  }

  .modal-content {
    width: 95%;
    margin: var(--spacing-lg);
  }
}
