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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

/* Login Page Styles */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group input,
.form-group textarea {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    font-family: inherit;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.help-text {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    font-style: italic;
}

.btn-submit,
.btn-generate {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-submit:hover,
.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-gamma {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
}

.btn-gamma:hover {
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

/* Rotating animation for loading buttons */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.btn-generate.loading,
.btn-gamma.loading {
    opacity: 0.7;
    pointer-events: none;
}

.btn-generate.loading::before,
.btn-gamma.loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

/* Gamma-specific styles */
.gamma-info {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.5;
}

.gamma-info strong {
    color: #495057;
    display: block;
    margin-bottom: 8px;
}

.slides-count {
    color: #6c757d;
    font-size: 14px;
    margin-left: 10px;
}

.btn-view-gamma {
    background: #28a745;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    margin-left: 10px;
    display: inline-block;
    transition: background-color 0.2s;
}

.btn-view-gamma:hover {
    background: #218838;
    text-decoration: none;
    color: white;
}

.btn-copy-gamma {
    background: #17a2b8;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    margin-left: 5px;
    cursor: pointer;
    display: inline-block;
    transition: background-color 0.2s;
}

.btn-copy-gamma:hover {
    background: #138496;
    color: white;
}

.btn-view-drive {
    background: #4285f4;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    margin-right: 5px;
    display: inline-block;
    transition: background-color 0.2s;
}

.btn-view-drive:hover {
    background: #3367d6;
    text-decoration: none;
    color: white;
}

.btn-copy-drive {
    background: #34a853;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    margin-left: 5px;
    cursor: pointer;
    display: inline-block;
    transition: background-color 0.2s;
}

.btn-copy-drive:hover {
    background: #2d8f47;
    color: white;
}

/* Dashboard Styles */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: white;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.btn-logout {
    background: #dc3545;
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: #c82333;
    text-decoration: none;
    color: white;
}

header h1 {
    color: #667eea;
    font-size: 28px;
}

.btn-report-issue {
    background: #f44336;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.3s, transform 0.2s;
}

.btn-report-issue:hover {
    background: #d32f2f;
    transform: translateY(-2px);
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 0;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    animation: slideIn 0.3s ease-out;
}

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

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #333;
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.modal-body input,
.modal-body textarea,
.modal-body select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.modal-body input:focus,
.modal-body textarea:focus,
.modal-body select:focus {
    outline: none;
    border-color: #667eea;
}

.modal-body textarea {
    resize: vertical;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.btn-cancel,
.btn-submit-issue {
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s, transform 0.2s;
}

.btn-cancel {
    background: #e0e0e0;
    color: #333;
}

.btn-cancel:hover {
    background: #d0d0d0;
}

.btn-submit-issue {
    background: #667eea;
    color: white;
}

.btn-submit-issue:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-logout {
    padding: 8px 16px;
    background: #f44336;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: #d32f2f;
}

/* Messages */
.messages {
    margin-bottom: 20px;
}

.alert {
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 10px;
    font-weight: 500;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #f44336;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #4caf50;
}

/* GitHub Issue Button */
.github-issue-btn {
    background: #24292e;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 10px;
    transition: background-color 0.3s;
}

.github-issue-btn:hover {
    background: #1a1e22;
}

.github-issue-btn i {
    margin-right: 8px;
}

/* Input Section */
.input-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.input-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
}

#input_text,
#gamma_instructions {
    width: 100%;
    min-height: 300px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

/* History Section */
.history-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.history-section h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 24px;
}

.history-note {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}

.no-jobs {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 16px;
}

/* Job Cards */
.jobs-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.job-card {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    background: #fafafa;
    transition: box-shadow 0.3s;
}

.job-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.job-card.job-completed {
    border-color: #4caf50;
}

.job-card.job-failed {
    border-color: #f44336;
}

.job-card.job-processing {
    border-color: #2196f3;
}

.job-card.job-pending {
    border-color: #ff9800;
}

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

.job-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.job-id {
    font-weight: 600;
    color: #333;
}

.job-date {
    font-size: 12px;
    color: #666;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-completed {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-failed {
    background: #ffebee;
    color: #c62828;
}

.status-processing {
    background: #e3f2fd;
    color: #1565c0;
}

.status-pending {
    background: #fff3e0;
    color: #e65100;
}

.job-body {
    margin-bottom: 15px;
}

.job-preview {
    background: white;
    padding: 15px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #555;
    margin-bottom: 15px;
    border-left: 3px solid #667eea;
}

.job-result {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-download {
    padding: 10px 20px;
    background: #4caf50;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 500;
    transition: background 0.3s;
}

.btn-download:hover {
    background: #388e3c;
}

.answers-count {
    color: #666;
    font-size: 14px;
}

.manus-indicator {
    background: #4caf50;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 8px;
}

.job-error {
    padding: 15px;
    background: #ffebee;
    color: #c62828;
    border-radius: 5px;
    border-left: 3px solid #f44336;
}

.job-processing,
.job-pending {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #e3f2fd;
    border-radius: 5px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #e3f2fd;
    border-top-color: #2196f3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.job-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

.btn-delete {
    padding: 8px 16px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-delete:hover {
    background: #d32f2f;
}

.btn-refresh {
    padding: 8px 12px;
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
    margin-right: 10px;
}

.btn-refresh:hover {
    background: #f57c00;
}

.btn-refresh:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Copy to Clipboard Button */
.btn-copy {
    padding: 6px 10px;
    background: #2196f3;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-copy:hover {
    background: #1976d2;
}

.btn-copy-icon {
    padding: 4px;
    background: #2196f3;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.btn-copy-icon:hover {
    background: #1976d2;
}

.copy-icon {
    font-size: 14px;
    line-height: 1;
}

/* Textarea and Job Preview Containers */
.textarea-container {
    position: relative;
}

.textarea-container textarea {
    padding-right: 35px; /* Make room for the copy button */
}

.textarea-container .btn-copy-icon {
    position: absolute;
    top: 5px;
    right: 5px;
}

.job-preview-container {
    position: relative;
}

.job-error-container {
    position: relative;
    padding-bottom: 40px;
}

.job-error-container .job-error {
    padding-right: 5px;
    padding-bottom: 10px;
}

.error-actions {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 8px;
    align-items: center;
}

.job-error-container .btn-copy-icon {
    padding: 6px 10px;
    background: #2196f3;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.job-error-container .btn-copy-icon:hover {
    background: #1976d2;
}

.btn-report-error {
    padding: 6px 12px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
    white-space: nowrap;
}

.btn-report-error:hover {
    background: #d32f2f;
}

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

    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .user-info {
        flex-direction: column;
        gap: 10px;
    }

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

    .job-result {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Environment Label Styles */
.env-label {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
    font-size: 0.75em;
    text-transform: uppercase;
    color: white;
}

.env-localhost {
    background-color: #007bff; /* Blue */
}

.env-prod {
    background-color: #dc3545; /* Red */
}

/* System Status Tables */
.system-status-section {
    margin-top: 40px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.system-status-section h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5em;
}

.status-tables {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.status-table-container {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 20px;
}

.status-table-container h3 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 1.1em;
    font-weight: 600;
}

.table-responsive {
    overflow-x: auto;
}

.status-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.status-table th,
.status-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.status-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-table tbody tr:hover {
    background: #f8f9fa;
}

.status-table tbody tr:last-child td {
    border-bottom: none;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
    text-transform: uppercase;
}

.status-completed {
    background: #d4edda;
    color: #155724;
}

.status-failed {
    background: #f8d7da;
    color: #721c24;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-processing {
    background: #cce7ff;
    color: #004085;
}

.btn-delete-small,
.btn-download-small {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s;
}

.btn-delete-small {
    background: #dc3545;
    color: white;
}

.btn-delete-small:hover {
    background: #c82333;
}

.btn-download-small {
    background: #28a745;
    color: white;
}

.btn-download-small:hover {
    background: #218838;
}

.storage-link {
    color: #007bff;
    text-decoration: none;
}

.storage-link:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .status-tables {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .status-table th,
    .status-table td {
        padding: 8px 10px;
        font-size: 0.9em;
    }
}
