:root {
    --primary-color: #4361ee;
    --secondary-color: #3a0ca3;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --border-color: #dee2e6;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f5f7fb;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: var(--primary-color);
}

.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: var(--dark-color);
    opacity: 0.7;
    transition: all 0.3s;
}

.tab-btn.active {
    opacity: 1;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: -2px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block;
}

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

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    align-items: center;
}

select, button, input[type="text"] {
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    font-size: 14px;
    font-family: inherit;
}

select {
    width: 250px;
}

button {
    cursor: pointer;
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-weight: 500;
    transition: background-color 0.2s;
}

button:hover {
    background-color: var(--secondary-color);
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.playback-controls, .record-controls {
    display: flex;
    gap: 10px;
}

.speed-control {
    display: flex;
    flex-direction: column;
    min-width: 180px;
}

input[type="range"] {
    width: 100%;
    margin-top: 5px;
}

.text-box {
    border: 1px solid var(--border-color);
    padding: 20px;
    min-height: 150px;
    max-height: 500px;
    overflow-y: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
    background-color: white;
    border-radius: 4px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.text-box:focus {
    outline: none;
    border-color: var(--primary-color);
}

.cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background-color: var(--primary-color);
    animation: blink 1s infinite;
    vertical-align: middle;
}

@keyframes blink {
    50% { opacity: 0; }
}

.analysis {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    margin-top: 30px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.analysis h2 {
    margin-bottom: 20px;
    color: var(--secondary-color);
    font-size: 1.4rem;
}

.metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.metric {
    flex: 1;
    min-width: 120px;
    text-align: center;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
}

.metric h3 {
    font-size: 1rem;
    color: #666;
    margin-bottom: 10px;
}

.metric p {
    font-size: 1.5rem;
    font-weight: 500;
}

.score-meter {
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    margin: 10px 0;
    overflow: hidden;
}

.score-meter-value {
    height: 100%;
    width: 50%;
    background-color: var(--warning-color);
    transition: width 0.5s, background-color 0.5s;
}

.chart-container {
    width: 100%;
    height: 250px;
    margin-bottom: 20px;
    position: relative;
}

.table-container {
    width: 100%;
    margin-bottom: 20px;
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
    min-height: 200px; /* Ensure minimum height */
}

.chart-progress-indicator {
    position: absolute;
    top: 32px;
    width: 3px;
    height: calc(100% - 90px);
    background-color: rgba(255, 0, 0, 0.6);
    pointer-events: none;
    z-index: 10;
    transition: left 0.1s linear;
}

.gemini-details {
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.gemini-meta {
    display: flex;
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.gemini-model {
    flex: 1;
}

.gemini-usage {
    flex: 1;
    padding-left: 15px;
}

.explanation-container h3 {
    margin-bottom: 10px;
    font-size: 16px;
    color: #444;
}

.explanation-text {
    background-color: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    font-size: 14px;
    line-height: 1.6;
}

.explanation-text ol {
    padding-left: 2em;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

.explanation-text li {
    margin-bottom: 0.5em;
}

.explanation-text ul {
    padding-left: 2em;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    list-style-type: disc;
}

.explanation-text code {
    font-family: 'Courier New', monospace;
    background-color: #f0f0f0;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 13px;
}

.record-form {
    margin-top: 20px;
}

.record-form p {
    margin-bottom: 10px;
}

.save-section {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.save-section input {
    flex: 1;
}

.full-height {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Submission Tab Styles */
.submission-section {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.submission-section h2 {
    margin-bottom: 15px;
    color: var(--secondary-color);
    font-size: 1.4rem;
}

.format-options {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    margin-bottom: 10px;
}

.format-options.simplified {
    margin-bottom: 0;
}

.submission-predict {
    margin-top: 40px;
}

.format-btn {
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 4px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
}

.format-btn:hover {
    background-color: var(--secondary-color);
}

.file-upload-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.file-upload-container.simplified {
    margin-top: 0;
}

input[type="file"] {
    max-width: 100%;
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: 4px;
    background-color: #f5f7fb;
}

#upload-predictions-btn {
    padding: 10px 20px;
}

/* Results Table Styles */
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 14px;
    display: table !important;
    visibility: visible !important;
}

.results-table th,
.results-table td {
    padding: 10px;
    text-align: left;
    border: 1px solid var(--border-color);
}

.results-table th {
    background-color: var(--light-color);
    font-weight: 600;
    color: var(--dark-color);
}

.results-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.results-table tr:hover {
    background-color: #e9ecef;
}

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
  }

  .toast {
    min-width: 250px;
    margin-bottom: 10px;
    padding: 15px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s ease-in-out;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  }

  .toast.show {
    opacity: 1;
    transform: translateX(0);
  }

  .toast.hide {
    opacity: 0;
    transform: translateX(100%);
  }

  .toast-success {
    background-color: #4caf50;
  }

  .toast-error {
    background-color: #f44336;
  }

  .toast-warning {
    background-color: #ff9800;
  }

  .toast-info {
    background-color: var(--primary-color);
  }

  .json-content-container {
    position: relative;
    border: 2px dashed var(--border-color);
    padding: 20px;
    min-height: 200px;
    margin-bottom: 15px;
    transition: background-color 0.3s, border-color 0.3s;
    display: flex;
    flex-direction: column;
}

.json-content-container.drag-over {
    background-color: #f0f0f0;
    border-color: var(--primary-color);
}

.json-content {
    width: 100%;
    flex-grow: 1;
    min-height: 300px;
    font-family: 'Courier New', monospace;
    outline: none;
    margin-bottom: 20px;
}

.upload-button {
    margin-top: auto;
    display: block;
    background-color: var(--primary-color);
    color: white;
    padding: 12px 30px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    border: none;
    cursor: pointer;
    align-self: center;
    transition: background-color 0.2s;
}

.upload-button:hover {
    background-color: var(--secondary-color);
}

.auth-container {
    position: absolute;
    right: 20px;
    top: 20px;
  }

  .login-btn, .logout-btn {
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
  }

  .login-btn {
    background-color: #4285F4;
    color: white;
    border: none;
  }

  .logout-btn {
    background-color: #f5f5f5;
    color: #757575;
    border: 1px solid #ddd;
  }
