:root {
    --primary-color: #2000ff;
    --secondary-color: #2a5298;
}

/* Override Bootstrap focus ring on form controls used in modals */
.form-control:focus {
    border-color: var(--primary-color) !important;
    box-shadow: none !important;
    outline: none !important;
}

.navbar {
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 0;
}

.navbar-brand {
    font-size: 4rem;
    font-weight: bold;
    color: var(--primary-color) !important;
}

.nav-link {
    color: #4a4a4a !important;
    font-weight: 500;
    font-size: 1.2rem;
    padding: 0.5rem 1rem !important;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color) !important;
    text-decoration: underline !important;
}

.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 100px 0;
}

.auth-buttons .btn {
    margin-left: 10px;
    padding: 8px 20px;
    border-radius: 5px;
}

.auth-buttons .btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.auth-buttons .btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    font-weight: 500;
}

.dropdown-menu {
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.dropdown-item {
    padding: 8px 20px;
    color: #333;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: var(--primary-color);
}

.dropdown-item i {
    margin-right: 8px;
    color: #666;
}

.container-fluid {
    max-width: 1600px;
    margin: 0 auto;
}

/* WhatsApp Floating Button */
.whatsapp-float {
    position: fixed;
    width: 60px;
    height: 60px;
    bottom: 20px;
    right: 20px;
    background-color: #25d366;
    color: #FFF;
    border-radius: 50px;
    text-align: center;
    font-size: 30px;
    box-shadow: 2px 2px 3px #9b9b9b;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s ease;
}

.whatsapp-float:hover {
    background-color: #20ba5a;
    color: #FFF;
    transform: scale(1.1);
    box-shadow: 2px 2px 8px #666;
}

.whatsapp-float i {
    margin-top: 0;
}

@media (max-width: 768px) {
    .whatsapp-float {
        width: 50px;
        height: 50px;
        font-size: 25px;
        bottom: 80px;
        right: 15px;
    }
}

/* Messaging Floating Button */
.message-float {
    position: fixed;
    width: 60px;
    height: 60px;
    bottom: 90px;
    right: 20px;
    background-color: var(--secondary-color);
    color: #FFF;
    border-radius: 50px;
    text-align: center;
    font-size: 30px;
    box-shadow: 2px 2px 3px #9b9b9b;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

.message-float:hover {
    background-color: var(--secondary-color);
    color: #FFF;
    transform: scale(1.1);
    box-shadow: 2px 2px 8px #666;
}

.message-float i {
    margin-top: 0;
}

.message-float .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Messaging Modal Styles */
.message-modal .modal-dialog {
    max-width: 800px;
    width: 800px;
    position: fixed;
    bottom: 160px;
    right: 20px;
    margin: 0;
    height: calc(100vh - 180px);
    max-height: calc(100vh - 180px);
}

.message-modal.admin-modal .modal-dialog {
    max-width: 1000px;
    width: 1000px;
}

.message-modal .modal-content {
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    border: none;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.message-modal .modal-backdrop {
    background-color: rgba(0, 0, 0, 0.3);
}

.message-modal .modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    padding: 0;
}

/* Instructor List Sidebar (for admin) */
.instructor-sidebar {
    width: 300px;
    border-right: 1px solid #e0e0e0;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

.instructor-sidebar-header {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    background-color: white;
}

.instructor-sidebar-header h6 {
    margin: 0;
    font-weight: 600;
    color: #333;
}

.instructor-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.instructor-item {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background-color 0.2s;
    background-color: white;
    position: relative;
}

.instructor-item:hover {
    background-color: #f0f0f0;
}

.instructor-item.active {
    background-color: #e3f2fd;
    border-left: 3px solid var(--primary-color);
}

.instructor-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
}

.instructor-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.instructor-unread-badge {
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

.instructor-last-message {
    font-size: 12px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 250px;
}

.instructor-time {
    font-size: 11px;
    color: #999;
    margin-top: 3px;
}

/* Chat area (right side for admin) */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: white;
}

.chat-header {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    background-color: white;
}

.chat-header h6 {
    margin: 0;
    font-weight: 600;
    color: #333;
}

.message-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background-color: #f8f9fa;
    min-height: 300px;
    height: 100%;
}

.message-item {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.message-item.sent {
    align-items: flex-end;
}

.message-item.received {
    align-items: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 18px;
    word-wrap: break-word;
}

.message-item.sent .message-bubble {
    background-color: var(--primary-color);
    color: white;
}

.message-item.received .message-bubble {
    background-color: white;
    color: #333;
    border: 1px solid #e0e0e0;
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
}

.message-input-container {
    border-top: 1px solid #e0e0e0;
    padding: 15px;
    background-color: white;
}

/* Refresh button animation */
#refreshMessagesBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinner-border-sm {
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* Instructor single-column layout */
.message-modal.instructor-modal .modal-dialog {
    max-width: 800px;
    width: 800px;
    position: fixed;
    bottom: 160px;
    right: 20px;
    margin: 0;
    height: calc(100vh - 180px);
    max-height: calc(100vh - 180px);
}

.message-modal.instructor-modal .modal-body {
    flex-direction: column;
}

.message-modal.instructor-modal .message-container {
    flex: 1;
    height: 100%;
}

.message-modal.instructor-modal .message-input-container {
    border-top: 1px solid #e0e0e0;
    padding: 15px;
    background-color: white;
}

@media (max-width: 768px) {
    .message-float {
        width: 50px;
        height: 50px;
        font-size: 25px;
        bottom: 150px;
        right: 15px;
    }

    .message-modal .modal-dialog {
        max-width: calc(100vw - 30px) !important;
        width: calc(100vw - 30px) !important;
        bottom: 30px !important;
        right: 15px !important;
        left: auto !important;
        height: calc(100vh - 100px) !important;
        max-height: calc(100vh - 100px) !important;
    }

    .message-modal.admin-modal .modal-dialog {
        max-width: calc(100vw - 30px) !important;
        width: calc(100vw - 30px) !important;
        bottom: 30px !important;
        right: 15px !important;
        left: auto !important;
        height: calc(100vh - 100px) !important;
        max-height: calc(100vh - 100px) !important;
    }

    .message-modal.instructor-modal .modal-dialog {
        max-width: calc(100vw - 30px) !important;
        width: calc(100vw - 30px) !important;
        bottom: 30px !important;
        right: 15px !important;
        left: auto !important;
        height: calc(100vh - 100px) !important;
        max-height: calc(100vh - 100px) !important;
    }

    .message-modal.admin-modal .modal-body {
        flex-direction: column !important;
    }

    .message-modal.admin-modal .instructor-sidebar {
        width: 100% !important;
        border-right: none !important;
        border-bottom: 1px solid #e0e0e0 !important;
        max-height: none !important;
    }

    .message-modal.admin-modal .instructor-list {
        display: none !important;
    }

    .message-modal.admin-modal .chat-area {
        width: 100% !important;
        flex: 1 !important;
    }
}

