/* static/style.css */

/* Base Styles & Font */
body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* App Container */
.app-container {
    max-width: 960px; /* Equivalent to max-w-4xl in Tailwind */
    width: 100%;
    padding: 2rem; /* Equivalent to p-8 */
    background-color: #ffffff; /* bg-white */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); /* shadow-lg */
    border-radius: 0.75rem; /* rounded-xl */
}

/* Headings */
h1 {
    font-size: 2.25rem; /* text-3xl */
    font-weight: 700; /* font-bold */
    text-align: center; /* text-center */
    color: #1f2937; /* text-gray-800 */
    margin-bottom: 2rem; /* mb-8 */
}

h2 {
    font-size: 1.5rem; /* text-2xl */
    font-weight: 600; /* font-semibold */
    color: #374151; /* text-gray-700 */
    margin-bottom: 1.5rem; /* mb-6 */
    text-align: center; /* text-center */
}

/* Tab Buttons */
.tab-button {
    padding: 0.75rem 1.5rem; /* py-3 px-6 */
    border-radius: 0.5rem; /* rounded-lg */
    font-weight: 500; /* font-medium */
    color: #4b5563; /* text-gray-600 */
    background-color: #e5e7eb; /* bg-gray-200 */
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); /* shadow-sm */
}

.tab-button:hover {
    background-color: #d1d5db; /* bg-gray-300 */
    color: #1f2937; /* text-gray-800 */
}

.tab-button.active {
    background-color: #3b82f6; /* bg-blue-500 */
    color: #ffffff; /* text-white */
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.5), 0 2px 4px -1px rgba(59, 130, 246, 0.25); /* shadow-md with blue */
}

/* Tab Content */
.tab-content {
    animation: fadeIn 0.5s ease-out;
}

.tab-content.hidden {
    display: none;
}

/* Form Elements */
.form-input,
.form-select,
.form-input-file {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem; /* py-3 px-4 */
    border: 1px solid #d1d5db; /* border-gray-300 */
    border-radius: 0.5rem; /* rounded-lg */
    font-size: 1rem; /* text-base */
    color: #374151; /* text-gray-700 */
    background-color: #ffffff; /* bg-white */
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

.form-input:focus,
.form-select:focus,
.form-input-file:focus {
    outline: none;
    border-color: #3b82f6; /* border-blue-500 */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25); /* ring-4 with blue */
}

textarea.form-input {
    resize: vertical;
}

.form-input-file {
    padding: 0.5rem 0.75rem; /* py-2 px-3 */
    cursor: pointer;
}

.quote-card.selected {
    outline: 2px solid #3b82f6; /* blue-500 */
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.chatbot-response-area {
    max-height: 300px;
    overflow-y: auto;
}

.chatbot-quote {
    border-left: 3px solid #007bff;
    padding-left: 15px;
    margin-top: 15px;
    margin-bottom: 15px;
}

.details-btn {
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 0.9em;
    cursor: pointer;
    margin-top: 10px;
}

.details-btn:hover {
    background-color: #e0e0e0;
}

.quote-details {
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 10px;
    margin-top: 10px;
    font-size: 0.9em;
}

/* Action Buttons */
.action-button {
    padding: 0.75rem 1.5rem; /* py-3 px-6 */
    border-radius: 0.5rem; /* rounded-lg */
    font-weight: 600; /* font-semibold */
    transition: all 0.2s ease-in-out;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.primary-button {
    background-color: #22c55e; /* bg-green-500 */
    color: #ffffff; /* text-white */
}

.primary-button:hover {
    background-color: #16a34a; /* bg-green-600 */
    box-shadow: 0 4px 8px rgba(34, 197, 94, 0.3);
}

.secondary-button {
    background-color: #60a5fa; /* bg-blue-400 */
    color: #ffffff; /* text-white */
}

.secondary-button:hover {
    background-color: #3b82f6; /* bg-blue-500 */
    box-shadow: 0 4px 8px rgba(96, 165, 250, 0.3);
}

.danger-button {
    background-color: #ef4444; /* bg-red-500 */
    color: #ffffff; /* text-white */
}

.danger-button:hover {
    background-color: #dc2626; /* bg-red-600 */
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

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

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db; /* gray-300 */
    transition: 0.4s;
    border-radius: 34px;
}

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

input:checked + .slider {
    background-color: #3b82f6; /* blue-500 */
}

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

/* Quote Card Display */
.quote-card {
    background-color: #f9fafb; /* bg-gray-50 */
    border: 1px solid #e5e7eb; /* border-gray-200 */
    border-radius: 0.75rem; /* rounded-xl */
    padding: 1.5rem; /* p-6 */
    margin-bottom: 1rem; /* mb-4 */
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); /* shadow-sm */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.quote-card h3 {
    font-size: 1.25rem; /* text-xl */
    font-weight: 600; /* font-semibold */
    color: #1f2937; /* text-gray-800 */
    margin-bottom: 0.75rem; /* mb-3 */
}

.quote-card p {
    font-size: 0.95rem; /* text-base */
    color: #4b5563; /* text-gray-600 */
    line-height: 1.6;
    margin-bottom: 1rem; /* mb-4 */
}

.quote-card .details {
    font-size: 0.875rem; /* text-sm */
    color: #6b7280; /* text-gray-500 */
    margin-top: 0.5rem;
}

.quote-card .tags span {
    display: inline-block;
    background-color: #dbeafe; /* bg-blue-100 */
    color: #1e40af; /* text-blue-800 */
    font-size: 0.75rem; /* text-xs */
    font-weight: 500; /* font-medium */
    padding: 0.25rem 0.6rem; /* px-2.5 py-0.5 */
    border-radius: 0.375rem; /* rounded-full */
    margin-right: 0.5rem; /* mr-2 */
    margin-bottom: 0.5rem; /* mb-2 */
}

.quote-card .status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.status-badge.used {
    background-color: #fef2f2; /* bg-red-50 */
    color: #b91c1c; /* text-red-700 */
    border: 1px solid #fca5a5; /* border-red-300 */
}

.status-badge.unused {
    background-color: #ecfdf5; /* bg-green-50 */
    color: #065f46; /* text-green-700 */
    border: 1px solid #a7f3d0; /* border-green-300 */
}

/* Message Box */
.message-box {
    padding: 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    opacity: 0; /* Initially hidden */
    transition: opacity 0.3s ease-in-out;
}

.message-box.show {
    opacity: 1;
}

.message-box.success {
    background-color: #d1fae5; /* bg-green-100 */
    color: #065f46; /* text-green-700 */
    border: 1px solid #a7f3d0; /* border-green-300 */
}

.message-box.error {
    background-color: #fee2e2; /* bg-red-100 */
    color: #b91c1c; /* text-red-700 */
    border: 1px solid #fca5a5; /* border-red-300 */
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #4b5563; /* text-gray-600 */
    font-size: 1rem;
    font-weight: 500;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top: 4px solid #3b82f6; /* blue-500 */
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

.modal-content {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

/* Utility Classes (mimicking Tailwind's spacing, flex, grid) */
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-6 { margin-top: 1.5rem; }
.mr-2 { margin-right: 0.5rem; }
.flex { display: flex; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.items-center { align-items: center; }
.space-x-4 > *:not(:first-child) { margin-left: 1rem; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.col-span-full { grid-column: 1 / -1; }
.hidden { display: none !important; } /* Use !important to ensure override */

/* Responsive adjustments */
@media (min-width: 768px) { /* md breakpoint */
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) { /* lg breakpoint */
    .lg\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Keyframe for fade-in effect */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Chatbot Page Layout */
#chatbot-page {
    /* Expanded width to utilize more horizontal space */
    width: 100%;
    max-width: 1100px; /* wider on large screens */
    margin: 0 auto;
}

/* Chatbot Styles */
.chatbot-message {
    margin-bottom: 1rem;
}
.chatbot-message.user {
    text-align: right;
}
.chatbot-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #6b7280; /* gray-500 */
    margin-bottom: 0.25rem;
}
.chatbot-response-area {
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.25rem;
    background-color: #f9fafb;
    margin-bottom: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
}

.formatted-response {
    line-height: 1.6;
}

.formatted-response pre {
    margin: 1rem 0;
    padding: 0.75rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    background-color: #1f2937;
    color: #f9fafb;
    font-family: monospace;
    font-size: 0.9rem;
}

.formatted-response code {
    background-color: #f1f5f9;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.9rem;
}

.formatted-response strong {
    font-weight: 700;
}

.formatted-response em {
    font-style: italic;
}

.quote-highlight {
    background-color: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: 0.75rem;
    margin: 0.75rem 0;
    border-radius: 0 0.5rem 0.5rem 0;
}

.quote-highlight p.italic {
    font-style: italic;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.quote-highlight p.text-sm {
    font-size: 0.875rem;
    color: #6b7280;
}
