:root {
    /* Chick-fil-A Brand Colors */
    --cfa-red: #E53E3E;
    --cfa-red-dark: #C53030;
    --cfa-red-light: #FED7D7;
    --cfa-gray-50: #F7FAFC;
    --cfa-gray-100: #EDF2F7;
    --cfa-gray-200: #E2E8F0;
    --cfa-gray-300: #CBD5E0;
    --cfa-gray-400: #A0AEC0;
    --cfa-gray-500: #718096;
    --cfa-gray-600: #4A5568;
    --cfa-gray-700: #2D3748;
    --cfa-gray-800: #1A202C;
    --cfa-gray-900: #171923;
    --cfa-white: #FFFFFF;
    --cfa-success: #38A169;
    --cfa-warning: #D69E2E;
    --cfa-info: #3182CE;
    --cfa-danger: #E53E3E;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #E53E3E 0%, #C53030 100%);
    --gradient-secondary: linear-gradient(135deg, #F7FAFC 0%, #EDF2F7 100%);
    --gradient-card: linear-gradient(145deg, #FFFFFF 0%, #F7FAFC 100%);

    /* Shadows */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

body {
    background: var(--gradient-secondary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--cfa-gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* Navigation */
.navbar {
    background: var(--gradient-primary);
    padding: 1rem 0;
    box-shadow: var(--shadow-lg);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    color: var(--cfa-white);
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-links a {
    color: var(--cfa-white);
    text-decoration: none;
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.nav-links a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-links a:hover::before {
    transform: translateX(0);
}

.nav-links a:hover {
    transform: translateY(-1px);
}

.nav-links a.active {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

/* Main Container */
.container {
    max-width: 900px;
    margin: 120px auto 40px;
    padding: 2rem;
    background: var(--gradient-card);
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    height: calc(100vh - 160px);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--cfa-gray-200);
}

/* Chat Header */
.chat-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--cfa-gray-200);
    position: relative;
}

.chat-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.chat-header h1 {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.subtitle {
    color: var(--cfa-gray-600);
    font-size: 1.1rem;
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
}

/* Chat Box */
.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--cfa-gray-50);
    border-radius: 16px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--cfa-gray-200);
}

/* Message Bubbles */
.bubble {
    padding: 1rem 1.25rem;
    border-radius: 20px;
    max-width: 85%;
    word-wrap: break-word;
    font-size: 15px;
    line-height: 1.5;
    position: relative;
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.user-msg {
    align-self: flex-end;
    background: var(--gradient-primary);
    color: var(--cfa-white);
    border-bottom-right-radius: 6px;
    box-shadow: var(--shadow-md);
}

.ai-msg {
    align-self: flex-start;
    background: var(--cfa-white);
    color: var(--cfa-gray-800);
    border-bottom-left-radius: 6px;
    border: 1px solid var(--cfa-gray-200);
    box-shadow: var(--shadow-md);
}

.ai-msg.error {
    background: var(--cfa-red-light);
    color: var(--cfa-red-dark);
    border-color: var(--cfa-red);
}

/* Enhanced Markdown Styling */
.bubble h1,
.bubble h2,
.bubble h3,
.bubble h4,
.bubble h5,
.bubble h6 {
    margin: 1rem 0 0.5rem;
    font-weight: 600;
    line-height: 1.3;
}

.bubble h1 {
    font-size: 1.5em;
    color: var(--cfa-red);
}

.bubble h2 {
    font-size: 1.3em;
    color: var(--cfa-red);
}

.bubble h3 {
    font-size: 1.1em;
    color: var(--cfa-gray-700);
}

.bubble p {
    margin: 0.75rem 0;
    line-height: 1.6;
}

.bubble ul,
.bubble ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.bubble li {
    margin: 0.5rem 0;
    line-height: 1.5;
}

.bubble strong,
.bubble b {
    font-weight: 600;
    color: var(--cfa-red);
}

.bubble code {
    background: var(--cfa-gray-100);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9em;
    border: 1px solid var(--cfa-gray-200);
}

.bubble pre {
    background: var(--cfa-gray-100);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
    border: 1px solid var(--cfa-gray-200);
}

.bubble blockquote {
    border-left: 4px solid var(--cfa-red);
    margin: 1rem 0;
    padding-left: 1rem;
    color: var(--cfa-gray-600);
    font-style: italic;
    background: var(--cfa-gray-50);
    padding: 1rem;
    border-radius: 0 8px 8px 0;
}

/* Tables */
.bubble table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
    background: var(--cfa-white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.bubble th,
.bubble td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--cfa-gray-200);
}

.bubble th {
    background: var(--cfa-gray-100);
    font-weight: 600;
    color: var(--cfa-gray-700);
}

.bubble tr:hover {
    background: var(--cfa-gray-50);
}

/* Controls */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--cfa-white);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--cfa-gray-200);
}

.chaco-guard-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    color: var(--cfa-gray-700);
}

.new-chat-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--cfa-white);
    color: var(--cfa-red);
    border: 2px solid var(--cfa-red);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.new-chat-button:hover {
    background: var(--cfa-red);
    color: var(--cfa-white);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--cfa-gray-300);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: var(--cfa-white);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

input:checked+.slider {
    background: var(--cfa-red);
}

input:checked+.slider:before {
    transform: translateX(26px);
}

/* Chat Form */
.chat-form {
    margin-top: auto;
}

.input-container {
    display: flex;
    gap: 12px;
    background: var(--cfa-white);
    padding: 1rem;
    border-radius: 16px;
    border: 2px solid var(--cfa-gray-200);
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-container:focus-within {
    border-color: var(--cfa-red);
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}

input[type="text"] {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    background: var(--cfa-gray-50);
    color: var(--cfa-gray-800);
    transition: background-color 0.3s;
}

input[type="text"]:focus {
    background: var(--cfa-white);
}

.send-button {
    padding: 0.75rem 1.5rem;
    background: var(--gradient-primary);
    color: var(--cfa-white);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.send-button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.send-button:active {
    transform: translateY(0);
}

.send-button:disabled {
    background: var(--cfa-gray-300);
    cursor: not-allowed;
    transform: none;
}

/* Loading Animation */
.loading-animation {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    margin: 0.5rem 0;
    background: var(--cfa-gray-100);
    border-radius: 20px;
    max-width: 85%;
    align-self: flex-start;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 1rem 1.25rem;
    background: var(--cfa-white);
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--cfa-gray-200);
}

.typing-dot {
    width: 10px;
    height: 10px;
    background: var(--cfa-red);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* Scrollbar */
.chat-box::-webkit-scrollbar {
    width: 8px;
}

.chat-box::-webkit-scrollbar-track {
    background: var(--cfa-gray-200);
    border-radius: 4px;
}

.chat-box::-webkit-scrollbar-thumb {
    background: var(--cfa-red);
    border-radius: 4px;
}

.chat-box::-webkit-scrollbar-thumb:hover {
    background: var(--cfa-red-dark);
}

/* Data Tables for Supply Chain Pages */
.page-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--cfa-gray-200);
}

.page-header h1 {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--gradient-card);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--cfa-gray-200);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card h3 {
    color: var(--cfa-gray-600);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--cfa-red);
    margin-bottom: 0.5rem;
}

.alert-number {
    color: var(--cfa-warning);
}

.data-table {
    background: var(--cfa-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--cfa-gray-200);
}

.data-table table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--cfa-gray-100);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--cfa-gray-700);
    border-bottom: 1px solid var(--cfa-gray-200);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--cfa-gray-200);
}

.data-table tr:hover {
    background: var(--cfa-gray-50);
}

.data-table tr.low-stock {
    background: rgba(214, 158, 46, 0.1);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-active {
    background: rgba(56, 161, 105, 0.2);
    color: var(--cfa-success);
}

.status-pending {
    background: rgba(214, 158, 46, 0.2);
    color: var(--cfa-warning);
}

.status-warning {
    background: rgba(214, 158, 46, 0.2);
    color: var(--cfa-warning);
}

.status-danger {
    background: rgba(229, 62, 62, 0.2);
    color: var(--cfa-red);
}

.priority-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-urgent {
    background: rgba(229, 62, 62, 0.2);
    color: var(--cfa-red);
}

.priority-high {
    background: rgba(214, 158, 46, 0.2);
    color: var(--cfa-warning);
}

.priority-normal {
    background: rgba(49, 130, 206, 0.2);
    color: var(--cfa-info);
}

.priority-low {
    background: rgba(160, 174, 192, 0.2);
    color: var(--cfa-gray-600);
}

.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-warning {
    background: rgba(214, 158, 46, 0.1);
    border-color: var(--cfa-warning);
    color: var(--cfa-gray-700);
}

.alert h3 {
    margin-bottom: 0.5rem;
    color: var(--cfa-warning);
}

.no-data {
    text-align: center;
    padding: 2rem;
    color: var(--cfa-gray-500);
    font-style: italic;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typing {

    0%,
    20%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    50% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        margin: 100px 1rem 20px;
        padding: 1rem;
        height: calc(100vh - 120px);
    }

    .nav-container {
        padding: 0 1rem;
    }

    .nav-links {
        gap: 0.25rem;
    }

    .nav-links a {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

    .chat-header h1 {
        font-size: 2rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }

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

/* Alert Styles for Blocked Requests */
.alert {
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    border-radius: 0.5rem;
    border-left: 4px solid;
    font-family: 'Inter', sans-serif;
}

.alert-danger {
    background-color: #FED7D7;
    border-left-color: var(--cfa-danger);
    color: #742A2A;
}

.alert h4 {
    margin: 0 0 0.5rem 0;
    color: var(--cfa-danger);
    font-weight: 600;
}

.alert p {
    margin: 0.25rem 0;
    line-height: 1.5;
}

.alert strong {
    font-weight: 600;
    color: #742A2A;
}
