/* Knowledge Tree Admin Panel - Minimal Custom Styles */
/* All other styles use Tailwind CSS + DaisyUI */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ========================================
   LOGIN PAGE - Custom Gradient Branding
   ======================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-title {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.login-subtitle {
    color: #666;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease;
}

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

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background-color: #fee;
    border: 1px solid #fcc;
    color: #c33;
}

/* ========================================
   SIDEBAR - Fixed Navigation
   ======================================== */
.sidebar {
    width: 260px;
    background-color: #2c3e50;
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-header {
    padding: 20px;
    background-color: #34495e;
    border-bottom: 1px solid #455a75;
}

.sidebar-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.sidebar-subtitle {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 4px;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: block;
    padding: 12px 20px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover,
.nav-link.active {
    background-color: #34495e;
    color: white;
    border-left-color: #3498db;
}

.nav-link i {
    width: 20px;
    margin-right: 10px;
}

/* ========================================
   MAIN LAYOUT
   ======================================== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    background-color: #f8f9fa;
}

.top-navbar {
    background-color: white;
    padding: 16px 24px;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    color: #666;
    font-size: 14px;
}

.btn-logout {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.btn-logout:hover {
    background-color: #c0392b;
}

.content-area {
    padding: 24px;
}

.content-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 24px;
    margin-bottom: 24px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 14px;
    opacity: 0.8;
}

/* ========================================
   TABLE STYLES - Proper Spacing
   ======================================== */
table td,
table th {
    padding: 12px 16px;
    vertical-align: middle;
}

table thead th {
    font-weight: 600;
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

table tbody tr {
    border-bottom: 1px solid #e9ecef;
}

table tbody tr:hover {
    background-color: #f8f9fa;
}

/* File name link spacing */
.file-name-link {
    margin-left: 8px;
}

/* File metadata spacing */
.file-metadata {
    margin-left: 8px;
}

/* ========================================
   PAGINATION STYLES
   ======================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.pagination button {
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination button:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.pagination button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.6;
}

.pagination-info {
    font-size: 14px;
    color: #2c3e50;
    padding: 8px 16px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
}

.pagination-info strong {
    color: #3498db;
    font-weight: 600;
}

/* ========================================
   CONVERSATION MODAL STYLES
   ======================================== */
.conversation-message {
    margin-bottom: 20px;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid #bdc3c7;
    background: #f8f9fa;
}

.conversation-message.user {
    border-left-color: #3498db;
    background: #e8f4fd;
}

.conversation-message.ai {
    border-left-color: #9b59b6;
    background: #f4ecf7;
}

.conversation-message.thumbs-down {
    border-left-color: #e74c3c;
    background: #fdecea;
}

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

.message-sender {
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 6px;
}

.message-sender.ai {
    color: #9b59b6;
}

.message-sender i {
    font-size: 16px;
}

.message-time {
    font-size: 12px;
    color: #7f8c8d;
}

.message-text {
    color: #2c3e50;
    line-height: 1.6;
    font-size: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.thumbs-down-indicator {
    margin-top: 12px;
    padding: 8px 12px;
    background: #e74c3c;
    color: white;
    border-radius: 4px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.thumbs-down-comment {
    margin-top: 10px;
    padding: 10px;
    background: #fff5f5;
    border-left: 3px solid #e74c3c;
    border-radius: 4px;
    font-size: 13px;
    color: #2c3e50;
}

.thumbs-down-comment strong {
    color: #e74c3c;
}

/* ========================================
   MODALS - Z-index Override
   ======================================== */
.custom_modal,
.custom-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 1200px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    animation: slideDown 0.3s ease;
}

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

.modal-header {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px 8px 0 0;
    border-bottom: 2px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 20px;
}

.close-modal {
    color: #95a5a6;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #e74c3c;
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */
@media (max-width: 768px) {
    .sidebar {
        width: 220px;
    }

    .main-content {
        margin-left: 220px;
    }

    .content-area {
        padding: 16px;
    }
}

@media (max-width: 576px) {
    .sidebar {
        width: 100%;
        position: absolute;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar.show {
        transform: translateX(0);
    }
}
