:root {
    /* Kolory UWB */
    --primary-color: #532272;      /* Czerwony UWB */
    --secondary-color: #5482c4;    /* Niebieski akcent */
    --bg-color: #f8f9fa;           /* Tło aplikacji */
    --chat-bg: #ffffff;            /* Tło czatu */
    --text-color: #212529;         /* Kolor tekstu */
    --light-text: #6c757d;         /* Jaśniejszy tekst */
    --success-color: #28a745;      /* Kolor sukcesu */
    --warning-color: #ffc107;      /* Kolor ostrzeżenia */
    --error-color: #dc3545;        /* Kolor błędu */
    --user-msg-bg: #e6f2ff;        /* Tło wiadomości użytkownika */
    --bot-msg-bg: #f0f7ff;         /* Tło wiadomości bota */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Section */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.logo-container {
    display: flex;
    align-items: center;
    margin-right: 1rem;
    background-color: white;
    padding: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.university-logo {
    height: 50px;
    width: auto;
    margin-right: 0.5rem;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    margin-right: 1rem;
}

.title {
    font-size: 1.4rem;
    flex-grow: 1;
}

.header-right {
    display: flex;
    align-items: center;
}

/* Main Content Area */
main {
    flex: 1;
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Chat Container */
.chat-container {
    background-color: var(--chat-bg);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    height: calc(100vh - 180px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Chat Messages Display */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Message Bubbles */
.message {
    margin-bottom: 1rem;
    max-width: 80%;
    clear: both;
}

.message-content {
    padding: 0.8rem 1rem;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
}

.user-message {
    float: right;
}

.user-message .message-content {
    background-color: var(--secondary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message {
    float: left;
}

.bot-message .message-content {
    background-color: var(--primary-color);
    color: white;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 0.75rem;
    color: var(--light-text);
    margin-top: 0.3rem;
    display: block;
}

.user-message .message-time {
    text-align: right;
}

.bot-message .message-time {
    text-align: left;
}

/* Input Area */
.chat-input-container {
    padding: 1rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    background-color: var(--chat-bg);
    position: relative;
}

.chat-input {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 1px solid #ced4da;
    border-radius: 20px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s ease-in-out;
}

.chat-input:focus {
    border-color: var(--primary-color);
}

/* Autocomplete Suggestions */
.autocomplete-container {
    position: absolute;
    bottom: 100%;
    left: 1rem;
    right: 80px;
    max-height: 250px;
    overflow-y: auto;
    background-color: white;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    margin-bottom: 5px;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background-color: #f8f9fa;
}

.autocomplete-text {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-color);
}

.autocomplete-category {
    font-size: 0.75rem;
    color: var(--light-text);
    background-color: #e9ecef;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    margin-left: 10px;
}

.autocomplete-icon {
    margin-right: 8px;
    color: var(--secondary-color);
    font-size: 0.85rem;
}

/* Ikony dla różnych typów dopasowania */
.autocomplete-icon.icon-exact {
    color: var(--success-color); /* Zielony - dokładne dopasowanie */
}

.autocomplete-icon.icon-full {
    color: var(--secondary-color); /* Niebieski - zaczyna się od tekstu */
}

.autocomplete-icon.icon-partial {
    color: var(--warning-color); /* Żółty - zawiera tekst */
}

.autocomplete-icon.icon-fuzzy {
    color: #9b59b6; /* Fioletowy - dopasowanie z literówkami */
}

/* Opcjonalne: subtelne podświetlenie dla różnych typów */
.autocomplete-item.match-exact {
    border-left: 3px solid var(--success-color);
}

.autocomplete-item.match-full {
    border-left: 3px solid var(--secondary-color);
}

.autocomplete-item.match-partial {
    border-left: 3px solid var(--warning-color);
}

.autocomplete-item.match-fuzzy {
    border-left: 3px solid #9b59b6;
}

.autocomplete-empty {
    padding: 1rem;
    text-align: center;
    color: var(--light-text);
    font-size: 0.9rem;
}

.send-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease-in-out;
}

.send-button:hover {
    background-color: var(--secondary-color);
}

.send-icon {
    font-size: 1.2rem;
}

/* Footer */
footer {
    background-color: var(--bg-color);
    border-top: 1px solid #e9ecef;
    padding: 1rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--light-text);
}

/* Help Button */
.help-button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease-in-out;
}

.help-button:hover {
    background-color: var(--primary-color);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--chat-bg);
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    width: 80%;
    max-width: 600px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.modal-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px;
    border-radius: 8px 8px 0 0;
    margin: -20px -20px 20px -20px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.4rem;
}

.modal-close {
    color: white;
    float: right;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
}

.modal-body {
    padding-bottom: 10px;
}

.modal-body h3 {
    color: var(--primary-color);
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 5px;
}

.example-question {
    color: var(--secondary-color);
    cursor: pointer;
    transition: color 0.15s ease-in-out;
}

.example-question:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 20px;
    margin-bottom: 20px;
}

.welcome-message h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.welcome-message p {
    color: var(--text-color);
    font-size: 1rem;
    line-height: 1.5;
}

/* Admin Styles */
.admin-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
}

.admin-tabs {
    display: flex;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 1rem;
}

.admin-tab {
    padding: 10px 15px;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 4px 4px 0 0;
    margin-right: 5px;
}

.admin-tab.active {
    border-color: #dee2e6 #dee2e6 #fff;
    background-color: white;
    border-bottom: none;
}

.admin-content {
    flex: 1;
    background-color: white;
    border-radius: 0 0 8px 8px;
    padding: 1rem;
    overflow: auto;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Table Styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

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

.data-table th {
    background-color: var(--primary-color);
    color: white;
}

.data-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #a8002f;
    border-color: #a8002f;
}

.btn-secondary {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #4470b0;
    border-color: #4470b0;
}

.btn-danger {
    background-color: var(--error-color);
    border-color: var(--error-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Icon Button Styles */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.6rem;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    background-color: transparent;
    font-size: 0.9rem;
}

.btn-icon:hover {
    transform: translateY(-1px);
}

.btn-delete-log {
    color: var(--error-color);
    border-color: transparent;
}

.btn-delete-log:hover {
    background-color: rgba(220, 53, 69, 0.1);
    border-color: var(--error-color);
    color: var(--error-color);
}

.btn-delete-log i {
    font-size: 1rem;
}

/* Loader */
.loader {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 2s linear infinite;
    display: inline-block;
    margin-right: 5px;
}

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

/* Responsive Adjustments */
@media (max-width: 768px) {
    .chat-container {
        height: calc(100vh - 160px);
    }
    
    .message {
        max-width: 90%;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .university-logo {
        height: 40px;
    }
    
    .title {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .university-logo {
        height: 30px;
    }
    
    .title {
        font-size: 1rem;
    }
}

/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    padding: 20px;
}

.login-box {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

.login-header i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.login-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.login-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
    text-align: center;
    font-size: 0.875rem;
    color: var(--light-text);
}

.login-footer i {
    color: var(--secondary-color);
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-logout {
    background-color: transparent;
    border: 2px solid white;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.btn-logout:hover {
    background-color: white;
    color: var(--primary-color);
}

/* Import Tab Styles */
.import-section {
    max-width: 1000px;
    margin: 0 auto;
}

.import-step {
    background-color: #f8f9fa;
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
}

.import-step h4 {
    margin-top: 0;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 1rem;
}

.file-upload-area {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.selected-file-name {
    color: var(--light-text);
    font-style: italic;
}

.parse-status, .import-status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 4px;
    display: none;
}

.parse-status.success, .import-status.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.parse-status.error, .import-status.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.parse-status.info, .import-status.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    display: block;
}

.preview-stats {
    display: flex;
    gap: 2rem;
    margin: 1rem 0;
    padding: 1rem;
    background-color: white;
    border-radius: 4px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.stat-item i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.preview-table-container {
    max-height: 400px;
    overflow-y: auto;
    margin: 1rem 0;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.preview-table {
    margin-bottom: 0;
}

.preview-table td {
    font-size: 0.875rem;
    vertical-align: top;
}

/* Automatyczne słowa kluczowe w podglądzie */
.auto-keywords {
    margin-top: 0.75rem;
    padding: 0.5rem;
    background-color: #e7f3ff;
    border-left: 3px solid var(--secondary-color);
    border-radius: 3px;
    font-size: 0.8rem;
}

.auto-keywords strong {
    color: var(--secondary-color);
}

.import-options {
    background-color: white;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* Modal Large */
.modal-large {
    max-width: 900px;
}

.logs-content {
    max-height: 500px;
    overflow-y: auto;
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.logs-content p {
    margin: 0.25rem 0;
    padding: 0.25rem;
}

.log-info {
    color: #0c5460;
}

.log-warning {
    color: #856404;
    font-weight: bold;
}

.log-error {
    color: #721c24;
    font-weight: bold;
}

.log-success {
    color: #155724;
    font-weight: bold;
}

/* Enhanced Admin Tab Icons */
.admin-tab i {
    margin-right: 0.5rem;
}

/* Logs Table - No Answer Highlighting */
.log-row-no-answer {
    background-color: #ffe6e6 !important;
    border-left: 4px solid var(--error-color);
}

.log-row-no-answer:hover {
    background-color: #ffd6d6 !important;
}

.log-row-no-answer td {
    color: #721c24;
}

.logs-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 15px;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.logs-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logs-stats .stat-item i {
    font-size: 1.5rem;
}

/* Logs Table Specific Styles */
.logs-table {
    table-layout: fixed;
    width: 100%;
}

.logs-table td {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    vertical-align: top;
    padding: 12px 15px;
    max-height: 150px;
    overflow: auto;
}

/* Wrappers for scrollable content in table cells */
.logs-table td:nth-child(3) > div,
.logs-table td:nth-child(4) > div {
    max-height: 120px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom scrollbar for table cells */
.logs-table td::-webkit-scrollbar {
    width: 6px;
}

.logs-table td::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.logs-table td::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.logs-table td::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive Import Section */
@media (max-width: 768px) {
    .file-upload-area {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .preview-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .preview-table-container {
        max-height: 300px;
    }
    
    .import-step {
        padding: 1rem;
    }
}

/* ===== STYLE DLA OSTRZEŻEŃ O RATE LIMITING ===== */
.bot-message .message-content strong {
    font-weight: 600;
}

/* Ostrzeżenia - żółty akcent */
.bot-message .message-content:has(⚠️) {
    border-left: 4px solid var(--warning-color);
    background: linear-gradient(135deg, var(--primary-color) 0%, #d84315 100%);
}

/* Błędy - czerwony akcent */
.bot-message .message-content:has(❌) {
    border-left: 4px solid var(--error-color);
    background: linear-gradient(135deg, var(--primary-color) 0%, #c62828 100%);
}

/* Blokada - ciemny czerwony */
.bot-message .message-content:has(🚫) {
    border-left: 4px solid #b71c1c;
    background: linear-gradient(135deg, #b71c1c 0%, #880e4f 100%);
}

/* Animacja dla ostrzeżeń */
@keyframes warningPulse {
    0%, 100% {
        box-shadow: 0 2px 10px rgba(255, 152, 0, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(255, 152, 0, 0.6);
    }
}

.bot-message .message-content:has(⚠️) {
    animation: warningPulse 2s ease-in-out 3;
}

