/* ===============================================
   Academic Styling for Marginal Reputation Demo
   =============================================== */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --text-color: #333;
    --bg-color: #ffffff;
    --light-gray: #f8f9fa;
    --border-color: #dee2e6;
    --code-bg: #f5f5f5;
}

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

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

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

/* Header Styles */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 2rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.subtitle {
    font-size: 1.1rem;
    font-style: italic;
    opacity: 0.9;
}

/* Navigation Tabs */
.tab-navigation {
    background-color: var(--light-gray);
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.tabs {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
}

.tabs li {
    margin: 0;
}

.tab-link {
    display: block;
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: var(--primary-color);
    font-family: 'Helvetica', 'Arial', sans-serif;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-link:hover {
    background-color: rgba(52, 152, 219, 0.1);
    border-bottom-color: var(--secondary-color);
}

.tab-link.active {
    background-color: white;
    border-bottom-color: var(--accent-color);
    color: var(--accent-color);
}

/* Main Content Area */
main {
    padding: 3rem 0;
    min-height: 60vh;
}

/* Typography */
h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin: 2rem 0 1rem;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

h3 {
    font-size: 1.4rem;
    color: var(--primary-color);
    margin: 1.5rem 0 1rem;
    font-weight: 600;
}

h4 {
    font-size: 1.2rem;
    color: var(--text-color);
    margin: 1rem 0 0.5rem;
    font-weight: 600;
}

p {
    margin-bottom: 1rem;
    text-align: justify;
}

/* Math Equations */
.equation-block {
    background-color: var(--code-bg);
    border-left: 4px solid var(--secondary-color);
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
}

.equation-label {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* Interactive Controls */
.controls {
    background-color: var(--light-gray);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.control-group {
    margin-bottom: 1rem;
}

.control-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-family: 'Helvetica', 'Arial', sans-serif;
    color: var(--primary-color);
}

.control-group input[type="range"] {
    width: 100%;
    margin: 0.5rem 0;
}

.control-group input[type="number"] {
    width: 100px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

.slider-value {
    display: inline-block;
    min-width: 60px;
    text-align: right;
    font-weight: bold;
    color: var(--secondary-color);
    font-family: 'Courier New', monospace;
}

/* Plot Containers */
.plot-container {
    margin: 2rem 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    background-color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Lists */
ul, ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.5rem;
}

/* Boxes for Key Results */
.theorem-box {
    background-color: #e3f2fd;
    border-left: 4px solid var(--secondary-color);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 4px;
}

.result-box {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 4px;
}

.extension-box {
    background-color: #d4edda;
    border-left: 4px solid #28a745;
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 4px;
}

.box-title {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--light-gray);
    font-weight: 600;
    color: var(--primary-color);
}

tr:hover {
    background-color: rgba(52, 152, 219, 0.05);
}

/* Code/Formulas */
code {
    background-color: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

/* Footer */
footer {
    background-color: var(--light-gray);
    border-top: 2px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 4rem;
    font-size: 0.9rem;
}

footer p {
    margin-bottom: 0.5rem;
}

/* Comparison Grid */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.comparison-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.comparison-card h4 {
    color: var(--secondary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tabs {
        flex-direction: column;
    }
    
    .comparison-grid {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 2rem;
}

.mb-2 {
    margin-bottom: 2rem;
}

.bold {
    font-weight: bold;
}

.italic {
    font-style: italic;
}

/* ===============================================
   Prompt History Styles
   =============================================== */

.prompt-history-container {
    max-width: 1400px;
    margin: 0 auto;
}

.prompt-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.prompt-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.prompt-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    border-color: var(--secondary-color);
}

.prompt-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.prompt-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.prompt-card-id {
    font-size: 0.75rem;
    color: #999;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

.prompt-card-size {
    font-size: 0.85rem;
    color: var(--secondary-color);
    font-weight: 600;
    white-space: nowrap;
}

.prompt-card-summary {
    color: var(--text-color);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.prompt-card-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: #666;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 1rem;
}

.prompt-card-stat {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.prompt-card-stat-icon {
    font-weight: bold;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0,0,0,0.6);
    animation: fadeIn 0.3s ease;
}

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

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

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--border-color);
    background-color: var(--light-gray);
    border-radius: 12px 12px 0 0;
}

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

.modal-close {
    font-size: 2rem;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.3s;
    line-height: 1;
}

.modal-close:hover,
.modal-close:focus {
    color: var(--accent-color);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

/* Chat Message Styles */
.chat-message {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid;
}

.chat-message.user {
    background-color: #e3f2fd;
    border-left-color: var(--secondary-color);
}

.chat-message.assistant {
    background-color: #f5f5f5;
    border-left-color: #4caf50;
}

.chat-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.chat-role {
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-message.user .chat-role {
    color: var(--secondary-color);
}

.chat-message.assistant .chat-role {
    color: #4caf50;
}

.chat-content {
    line-height: 1.6;
    font-size: 0.95rem;
}

.chat-thinking {
    background-color: #fff9e6;
    border-left: 3px solid #ffc107;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
}

.chat-thinking-header {
    font-weight: 600;
    color: #f57c00;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.chat-tool-call {
    background-color: #e8f5e9;
    border: 1px solid #4caf50;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.tool-call-header {
    font-weight: 600;
    color: #2e7d32;
    margin-bottom: 0.5rem;
}

.tool-call-params {
    color: #555;
    margin-left: 1rem;
}

.chat-tool-result {
    background-color: #fff3e0;
    border: 1px solid #ff9800;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.tool-result-header {
    font-weight: 600;
    color: #e65100;
    margin-bottom: 0.5rem;
}

.file-change-badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    margin: 0.2rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.file-created {
    background-color: #c8e6c9;
    color: #2e7d32;
}

.file-modified {
    background-color: #bbdefb;
    color: #1565c0;
}

.file-read {
    background-color: #f0f0f0;
    color: #616161;
}

.files-changed-section {
    margin: 1.5rem 0;
    padding: 1rem;
    background-color: #fafafa;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.files-changed-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* Responsive Design for Modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
        margin: 2.5% auto;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .prompt-cards-grid {
        grid-template-columns: 1fr;
    }
}
