/* ==========================================================================
   CLAVIUS LIVE CHAT WIDGET STYLES
   ========================================================================== */

/* Tombol Floating Launcher di Pojok Kanan Bawah */
#clavius-chat-launcher {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background-color: #0D0079;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(1, 24, 216, 0.35);
    cursor: pointer;
    z-index: 99999;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

#clavius-chat-launcher:hover {
    transform: scale(1.08);
    background-color: #0012a6;
}

#clavius-chat-launcher svg {
    width: 28px;
    height: 28px;
    fill: #ffffff;
}

/* Container Jendela Chat Window */
#clavius-chat-window {
    position: fixed;
    bottom: 95px;
    right: 25px;
    width: 360px;
    height: 500px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: none; /* Hidden by default */
    flex-direction: column;
    overflow: hidden;
    z-index: 99998;
    border: 1px solid #eef2ff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#clavius-chat-window.active {
    display: flex;
    animation: claviusSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes claviusSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header Chat */
.clavius-chat-header {
    background: #0D0079;
    color: #ffffff;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.clavius-chat-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
}

.clavius-chat-header small {
    display: block;
    font-size: 11px;
    opacity: 0.8;
}

.clavius-chat-close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

/* Area Isi Pesan (Chat Body) */
.clavius-chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.clavius-chat-placeholder {
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    margin: auto 0;
}

/* Footer & Input Chat */
.clavius-chat-footer {
    padding: 12px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    align-items: center;
}

.clavius-chat-footer input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    font-size: 13px;
    outline: none;
}

.clavius-chat-footer input[type="text"]:focus {
    border-color: #0D0079;
}

.clavius-chat-send-btn {
    background: #0D0079;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.clavius-chat-send-btn:hover {
    background: #0012a6;
}


/* ==========================================================================
   TAHAP 2: CHAT BUBBLES & TEACHER SELECTOR STYLES
   ========================================================================== */

/* Dropdown Pemilih Guru di Header */
.clavius-chat-teacher-select {
    width: 100%;
    padding: 8px 12px;
    background: #f1f5f9;
    border: none;
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    outline: none;
}

/* Chat Bubbles Container */
.clavius-chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.4;
    word-break: break-word;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Pesan Dikirim oleh User Aktif (Siswa) - Kanan */
.clavius-chat-message.sent {
    align-self: flex-end;
    background: #0D0079;
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

/* Pesan Diterima dari Balasan (Guru) - Kiri */
.clavius-chat-message.received {
    align-self: flex-start;
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 2px;
}

/* Timestamp Kecil di bawah Pesan */
.clavius-chat-time {
    display: block;
    font-size: 9.5px;
    margin-top: 4px;
    opacity: 0.7;
    text-align: right;
}

.clavius-chat-message.received .clavius-chat-time {
    color: #64748b;
}

.clavius-chat-message.sent .clavius-chat-time {
    color: #e0e7ff;
}


/* ==========================================================================
   TAHAP 3: ATTACHMENT & AWS MEDIA STYLES
   ========================================================================== */

/* Tombol Klip Lampiran File */
.clavius-chat-attach-btn {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.clavius-chat-attach-btn:hover {
    background: #f1f5f9;
    color: #0D0079;
}

.clavius-chat-attach-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Hidden File Input */
#clavius-chat-file-input {
    display: none;
}

/* Preview Gambar di dalam Chat Bubble */
.clavius-chat-message img.clavius-chat-img {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 6px;
    display: block;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.2);
}

/* Link Kartu PDF di dalam Chat Bubble */
.clavius-chat-pdf-card {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    margin-top: 6px;
    font-size: 12px;
}

.clavius-chat-message.received .clavius-chat-pdf-card {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}


/* ==========================================================================
   TAHAP 4: TEACHER INBOX LAYOUT STYLES
   ========================================================================== */

.clavius-inbox-container {
    display: flex;
    height: 600px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 20px 0;
}

/* Sidebar Kiri: Daftar Siswa */
.clavius-inbox-sidebar {
    width: 300px;
    border-right: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
}

.clavius-inbox-sidebar-header {
    padding: 16px;
    background: #0D0079;
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
}

.clavius-student-list {
    flex: 1;
    overflow-y: auto;
}

.clavius-student-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.clavius-student-item:hover, .clavius-student-item.active {
    background: #eef2ff;
}

.clavius-student-name {
    font-weight: 600;
    font-size: 13.5px;
    color: #1e293b;
}

.clavius-unread-badge {
    background: #ef4444;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
}

/* Panel Kanan: Area Percakapan Utama */
.clavius-inbox-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

.clavius-inbox-chat-header {
    padding: 14px 20px;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 700;
    font-size: 15px;
    color: #0f172a;
    background: #ffffff;
}

.clavius-inbox-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.clavius-inbox-footer {
    padding: 15px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.clavius-inbox-footer input[type="text"] {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    font-size: 13.5px;
    outline: none;
}

.clavius-inbox-footer input[type="text"]:focus {
    border-color: #0D0079;
}


/* ==========================================================================
   MODERN MESSAGE PAGE & TABBED LAYOUT STYLES
   ========================================================================== */

.clavius-message-wrapper {
    max-width: 850px;
    margin: 30px auto;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    padding: 30px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.clavius-message-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
}

.clavius-teacher-avatar {
    width: 55px;
    height: 55px;
    background: #eef2ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    border: 2px solid #d0d7ff;
}

.clavius-message-header h3 {
    margin: 0 0 4px 0;
    color: #0f172a;
    font-size: 20px;
    font-weight: 700;
}

.clavius-message-header p {
    margin: 0;
    color: #64748b;
    font-size: 13.5px;
}

/* Tab Switcher */
.clavius-tab-switcher {
    display: flex;
    gap: 10px;
    background: #f8fafc;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-bottom: 25px;
}

.clavius-tab-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clavius-tab-btn.active {
    background: #0D0079;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(1, 24, 216, 0.25);
}

.clavius-tab-content {
    display: none;
    animation: claviusFadeIn 0.3s ease;
}

.clavius-tab-content.active {
    display: block;
}

@keyframes claviusFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Styling */
.clavius-form-group {
    margin-bottom: 20px;
}

.clavius-form-label {
    display: block;
    font-weight: 600;
    font-size: 13.5px;
    color: #1e293b;
    margin-bottom: 8px;
}

.clavius-form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    min-height: 120px;
}

.clavius-form-control:focus {
    border-color: #0D0079;
    box-shadow: 0 0 0 3px rgba(1, 24, 216, 0.1);
}

/* Upload Grid */
.clavius-upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 600px) {
    .clavius-upload-grid { grid-template-columns: 1fr; }
}

.clavius-upload-box {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    padding: 12px;
    border-radius: 10px;
}

.clavius-upload-box small {
    display: block;
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 6px;
}

.clavius-file-input {
    font-size: 12px;
    width: 100%;
}

.clavius-btn-submit {
    background: #0D0079;
    color: #ffffff !important;
    border: none;
    padding: 12px 28px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.clavius-btn-submit:hover {
    background: #0012a6;
    transform: translateY(-2px);
}

.clavius-chat-embed-notice {
    padding: 15px;
    background: #eef2ff;
    border-left: 4px solid #0D0079;
    border-radius: 8px;
    font-size: 13.5px;
    color: #1e293b;
    margin-bottom: 20px;
}


/* Embedded Chat Box Style */
.clavius-embedded-chat-box {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.clavius-embedded-chat-header {
    background: #0D0079;
    color: #ffffff;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 14px;
}


/* Button Clear Chat Style */
.clavius-btn-clear-chat {
    background: #f1f5f9;
    color: #e11d48;
    border: 1px solid #fecdd3;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clavius-btn-clear-chat:hover {
    background: #ffe4e6;
    color: #be123c;
    border-color: #fda4af;
}