/* =============================================================================
   RESET & BASE STYLES
   ============================================================================= */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* =============================================================================
   NAVIGATION STYLES
   ============================================================================= */

.navbar {
    background-color: #1f2937 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-icon {
    font-size: 1.2rem;
    padding: 0.5rem !important;
}

.nav-icon:hover,
.nav-icon.active {
    background-color: #374151 !important;
}

/* Simple Icons styling in navbar */
.navbar-dark > .container-fluid .nav-link > span img[src^="/images/"] {
    filter: brightness(0) invert(1) opacity(0.6);
}

/* =============================================================================
   HERO SECTION
   ============================================================================= */

.hero-section {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
    margin: -2rem -1rem 2rem -1rem;
    border-radius: 8px;
}

.hero-section h1 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.hero-section p {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    opacity: 0.9;
    line-height: 1.4;
}

.hero-section .build-info {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    opacity: 0.7;
    font-style: italic;
}

.hero-section img[src^="/images/"] {
    filter: brightness(0) invert(1);
    width: 1em;
    height: 1em;
}

/* =============================================================================
   CARD STYLES
   ============================================================================= */

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* =============================================================================
   DEMO-SPECIFIC STYLES
   ============================================================================= */

/* Parameter demo color classes */
.🔵 { border-color: #0d6efd !important; }
.🔵 .card-header { background-color: #0d6efd !important; color: white !important; }

.🟢 { border-color: #198754 !important; }
.🟢 .card-header { background-color: #198754 !important; color: white !important; }

.🟡 { border-color: #ffc107 !important; }
.🟡 .card-header { background-color: #ffc107 !important; color: #212529 !important; }

.🔴 { border-color: #dc3545 !important; }
.🔴 .card-header { background-color: #dc3545 !important; color: white !important; }

/* Demo sections */
.demo-section {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.demo-section h2 {
    color: #1f2937;
    margin-bottom: 1rem;
    border-bottom: 2px solid #3b82f6;
    padding-bottom: 0.5rem;
}

.demo-controls {
    margin: 1.5rem 0;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.demo-output {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1rem;
    margin: 1rem 0;
    min-height: 100px;
}

/* =============================================================================
   CHAT INTERFACE STYLES
   ============================================================================= */

.chat-container {
    background: linear-gradient(to bottom, #f8f9fa 0%, #e9ecef 100%);
}

.chat-message {
    animation: fadeIn 0.3s ease-in;
}

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

.chat-container::-webkit-scrollbar {
    width: 8px;
}

.chat-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Message bubbles */
.chat-message .bg-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%) !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.chat-message .bg-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%) !important;
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.3);
}

/* =============================================================================
   CODE DISPLAY STYLES
   ============================================================================= */

.code-block {
    background-color: #1f2937;
    color: #f9fafb;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.code-block pre {
    margin: 0;
}

/* =============================================================================
   CHUNKING DEMO STYLES
   ============================================================================= */

.chunking-table {
    font-size: 0.9rem;
}

.chunking-table td {
    vertical-align: top;
    text-align: left !important;
}

.chunking-table .col-number {
    width: 6%;
}

.chunking-table .col-text {
    width: 76%;
}

.overlap-legend {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.overlap-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.overlap-legend-color {
    width: 20px;
    height: 16px;
    border-radius: 3px;
    display: inline-block;
}

/* =============================================================================
   REACT & FUNCTION CALLING STEP STYLES
   ============================================================================= */

.react-steps, .function-steps {
    margin: 2rem 0;
}

.step-item {
    margin: 1rem 0;
    border-left: 4px solid #dee2e6;
    padding-left: 1rem;
    animation: fadeIn 0.5s ease-in;
}

.step-content {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.step-number {
    background: #6c757d;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

.step-body {
    font-family: 'Courier New', monospace;
    background: white;
    padding: 0.75rem;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    white-space: pre-wrap;
    line-height: 1.4;
}

/* ReAct specific step styles */
.step-thought {
    border-left-color: #0066cc;
}

.step-thought .step-number {
    background: #0066cc;
}

.step-action {
    border-left-color: #28a745;
}

.step-action .step-number {
    background: #28a745;
}

.step-observation {
    border-left-color: #ffc107;
}

.step-observation .step-number {
    background: #ffc107;
    color: #000;
}

.step-final_answer {
    border-left-color: #6f42c1;
}

.step-final_answer .step-number {
    background: #6f42c1;
}

/* Function Calling specific step styles */
.step-user_query {
    border-left-color: #17a2b8;
}

.step-user_query .step-number {
    background: #17a2b8;
}

.step-ai_response {
    border-left-color: #0066cc;
}

.step-ai_response .step-number {
    background: #0066cc;
}

.step-function_call {
    border-left-color: #28a745;
}

.step-function_call .step-number {
    background: #28a745;
}

.step-function_result {
    border-left-color: #ffc107;
}

.step-function_result .step-number {
    background: #ffc107;
    color: #000;
}

.function-args {
    color: #6c757d;
    font-style: italic;
    white-space: nowrap;
    font-family: 'Courier New', monospace;
}

/* =============================================================================
   FUNCTION CARD STYLES
   ============================================================================= */

.function-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    height: 100%;
}

.function-card h5 {
    color: #495057;
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
}

.function-card p {
    color: #6c757d;
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* =============================================================================
   SYSTEM PROMPT STYLES
   ============================================================================= */

.system-prompt-section {
    margin: 3rem 0;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.system-prompt-container {
    background: white;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.system-prompt-preview, .system-prompt-full {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #495057;
    white-space: pre-wrap;
}

.functions-section {
    margin: 3rem 0;
}

/* =============================================================================
   PROMPT ENGINEERING DEMO STYLES
   ============================================================================= */

.response-box {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    min-height: 150px;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* =============================================================================
   FOOTER STYLES
   ============================================================================= */

.footer {
    background-color: #1f2937;
    color: #d1d5db;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* =============================================================================
   RESPONSIVE DESIGN - TABLET (992px - 577px)
   ============================================================================= */

@media (max-width: 991px) {
    /* Navigation adjustments */
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
    }
    
    .dropdown-menu {
        margin-top: 0.25rem;
    }
    
    /* Fix navbar scrolling */
    .navbar-collapse {
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }
}

@media (max-width: 992px) and (min-width: 577px) {
    /* Hero section */
    .hero-section {
        padding: 2rem 1rem;
    }
    
    .hero-section h1 {
        font-size: 1.6rem;
    }
    
    .hero-section p {
        font-size: 0.9rem;
    }
    
    /* Demo controls */
    .demo-controls {
        flex-direction: column;
    }
    
    /* Chat messages */
    .chat-message .bg-primary,
    .chat-message .bg-secondary {
        max-width: 85% !important;
    }
}

/* =============================================================================
   RESPONSIVE DESIGN - PHONE (576px and below)
   ============================================================================= */

@media (max-width: 576px) {
    /* Hero section */
    .hero-section {
        padding: 1rem 0.5rem;
        margin: -0.5rem -0.5rem 1rem -0.5rem;
    }
    
    .hero-section h1 {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
        line-height: 1.3;
    }
    
    .hero-section p {
        font-size: 0.8rem;
        margin-bottom: 0.75rem;
        line-height: 1.5;
    }
    
    .hero-section .build-info {
        font-size: 0.7rem;
    }
    
    /* Demo controls */
    .demo-controls {
        flex-direction: column;
    }
    
    /* Chat messages */
    .chat-message .bg-primary,
    .chat-message .bg-secondary {
        max-width: 90% !important;
    }
    
    /* Card spacing and layout */
    .card {
        margin-bottom: 1rem;
    }
    
    .mb-5 {
        margin-bottom: 0.625rem !important; /* Reduce space between card groups */
    }
    
    .card-title {
        font-size: 0.95rem;
        line-height: 1.3;
    }
    
    .card-text {
        font-size: 0.85rem;
        line-height: 1.4;
        margin-bottom: 0.5rem !important;
    }
    
    /* Buttons and badges - smaller on phones */
    .btn {
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
        margin-bottom: 0.25rem;
    }
    
    .badge {
        font-size: 0.65rem;
        padding: 0.15rem 0.35rem;
    }
    
    /* Card body - remove bottom padding to eliminate space below buttons */
    .card-body {
        padding: 1rem 1rem 0 1rem;
    }
}