/* Main Styles for Rafiki AI */

:root {
    --primary: #0a2351;
    --primary-dark: #071a3e;
    --secondary: #4cc9f0;
    --success: #4caf50;
    --info: #2196f3;
    --warning: #ff9800;
    --danger: #f44336;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --gray-light: #e9ecef;
    --body-bg: #ffffff;
    --body-color: #212529;
    --border-radius: 0.5rem;
    --box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease-in-out;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    color: var(--body-color);
    background-color: var(--body-bg);
    line-height: 1.6;
}

/* Navbar Styles */
.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: var(--transition);
}

.navbar-dark .navbar-nav .nav-link:hover {
    color: #ffffff;
}

/* Hero Section */
.hero {
    padding: 6rem 0;
    background-color: #f8f9fa;
    background-image: linear-gradient(135deg, #f5f7fa 0%, #e4e9f2 100%);
}

.hero-section {
    padding: 6rem 0;
    background-color: #f8f9fa;
}

.bg-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
}

/* Feature Icons */
.feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    font-size: 1.5rem;
}

/* How It Works Section */
.step-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    font-weight: bold;
    font-size: 1.25rem;
    margin: 0 auto;
}

/* Testimonial Styles */
.testimonial-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background-color: var(--primary);
    color: white;
    font-weight: bold;
}

/* Dashboard Styles */
.sidebar {
    min-height: 100vh;
    background-color: var(--primary);
    color: white;
    padding-top: 1rem;
    transition: all 0.3s ease-in-out;
}

/* Mobile sidebar positioning */
@media (max-width: 767.98px) {
    .sidebar {
        position: fixed;
        top: 56px; /* Height of mobile navbar */
        left: 0;
        width: 100%;
        height: calc(100vh - 56px);
        z-index: 1040;
        transform: translateX(-100%);
        min-height: calc(100vh - 56px);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar .nav-link {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
    }
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.75);
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    margin-bottom: 0.25rem;
    transition: var(--transition);
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link i {
    margin-right: 0.5rem;
}

/* Dashboard Cards */
.dashboard-card {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    height: 100%;
    border: 1px solid var(--gray-light);
    background-color: white;
}

.dashboard-card:hover {
    transform: translateY(-5px);
}

.dashboard-card .card-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.dashboard-card .card-footer {
    border-top: 1px solid var(--gray-light);
    padding: 1rem;
}

.dashboard-card .badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
}

.dashboard-card .card-text {
    margin-bottom: 1rem;
    min-height: 3rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.dashboard-card .btn {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.dashboard-card .card-footer .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.dashboard-card .card-footer {
    background-color: rgba(0, 0, 0, 0.03);
    padding: 0.75rem 1rem;
}

.dashboard-card .card-footer .d-flex {
    gap: 0.5rem;
}

.dashboard-card .btn-outline-primary:hover,
.dashboard-card .btn-outline-success:hover {
    color: white;
}

/* Chat Interface */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 400px;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: #f0f2f5;
}

#conversation-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background-color: #f0f2f5;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><defs><pattern id="chat-bg" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="%23e0e0e0" opacity="0.3"/></pattern></defs><rect width="100" height="100" fill="url(%23chat-bg)"/></svg>');
}

.chat-input {
    display: flex;
    padding: 1rem;
    background-color: white;
    border-top: 1px solid var(--gray-light);
}

.chat-input input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    margin-right: 0.5rem;
}

.message {
    margin-bottom: 1rem;
    max-width: 70%;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-out;
}

.user-message {
    align-self: flex-end;
    margin-left: auto;
}

.user-message .message-content {
    background-color: #dcf8c6;
    color: #000;
    border-radius: 18px 18px 4px 18px;
    padding: 8px 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
}

.ai-message {
    align-self: flex-start;
    margin-right: auto;
}

.ai-message .message-content {
    background-color: white;
    color: #000;
    border-radius: 18px 18px 18px 4px;
    padding: 8px 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
}

.message-info {
    margin-top: 4px;
    font-size: 0.75rem;
    color: #667781;
    text-align: right;
}

.ai-message .message-info {
    text-align: left;
}

.message-content p {
    margin: 0;
    line-height: 1.4;
}

.message-content a {
    color: #1976d2;
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}

/* Legacy message styles for backward compatibility */
.message-user {
    align-self: flex-end;
    background-color: var(--primary);
    color: white;
    border-radius: 1rem 1rem 0 1rem;
    padding: 0.75rem 1rem;
    margin-left: auto;
}

.message-ai {
    align-self: flex-start;
    background-color: white;
    border: 1px solid var(--gray-light);
    border-radius: 1rem 1rem 1rem 0;
    padding: 0.75rem 1rem;
}

/* Knowledge Base */
.document-card {
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    transition: var(--transition);
}

.document-card:hover {
    box-shadow: var(--box-shadow);
}

/* Forms */
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.25);
}

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

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

/* Auth Pages */
.auth-container {
    max-width: 400px;
    margin: 2rem auto;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .hero {
        padding: 3rem 0;
    }
    
    .message {
        max-width: 90%;
    }
    
    /* Dashboard responsive adjustments */
    .dashboard-card {
        margin-bottom: 1rem;
    }
    
    .dashboard-card .card-body {
        padding: 1rem;
    }
    
    .dashboard-card h2 {
        font-size: 1.5rem;
    }
    
    .dashboard-card h6 {
        font-size: 0.9rem;
    }
    
    /* Table responsive */
    .table-responsive {
        font-size: 0.875rem;
    }
    
    /* Button adjustments */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Main content padding */
    main {
        padding-top: 1rem !important;
    }
    
    /* Welcome card responsive */
    .card.dashboard-card.bg-primary {
        width: 100% !important;
        margin-bottom: 1rem;
    }
    
    .card.dashboard-card.bg-primary .card-body {
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 576px) {
    /* Extra small devices */
    .dashboard-card h2 {
        font-size: 1.25rem;
    }
    
    .dashboard-card .fa-3x {
        font-size: 2rem !important;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .d-flex.justify-content-between {
        flex-direction: column;
        align-items: stretch !important;
    }
    
    .table th,
     .table td {
         padding: 0.5rem 0.25rem;
         font-size: 0.8rem;
     }
     
     /* Chat page specific responsive adjustments */
     main[style*="height: 100vh"] {
         height: calc(100vh - 56px) !important; /* Account for mobile navbar */
     }
 }
 
 /* Chat responsive improvements */
 @media (max-width: 767.98px) {
     .chat-container {
         padding: 0.5rem;
     }
     
     .message {
         max-width: 95%;
         font-size: 0.9rem;
     }
     
     .chat-input {
         font-size: 1rem;
     }
     
     .btn-toolbar .btn {
         padding: 0.25rem 0.5rem;
         font-size: 0.8rem;
     }
 }

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

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

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