/* Import Font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* Variabel Global */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --sidebar-bg: #2c3e50;
    --sidebar-text: #ecf0f1;
    --sidebar-hover: #34495e;
    --main-bg: #ecf0f1;
    --card-bg: #ffffff;
    --border-color: #dee2e6;
    --font-family: 'Poppins', sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--main-bg);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* --- Halaman Autentikasi --- */
#auth-container .auth-card {
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border-radius: 1rem;
    overflow: hidden;
}

#auth-container .bg-image {
    background: url('https://images.unsplash.com/photo-1554415707-6e8cfc93fe23?q=80&w=2070&auto=format&fit=crop') center center;
    background-size: cover;
}

#auth-container .auth-view {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 500px;
}

/* --- Layout Aplikasi Utama --- */
#app-container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    transition: transform 0.3s ease-in-out;
    flex-shrink: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    padding: 1rem 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    border-bottom: 1px solid var(--sidebar-hover);
}

.sidebar-header i {
    margin-right: 0.75rem;
}

.nav-menu {
    flex-grow: 1;
    margin-top: 1rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    transition: background-color 0.2s ease, color 0.2s ease;
    justify-content: space-between;
}

.nav-link:hover, .nav-link.active {
    background-color: var(--sidebar-hover);
    color: #ffffff;
}

.nav-link span, .nav-link i:first-child {
    margin-right: auto;
}

.nav-link i:first-child {
    font-size: 1.2rem;
    margin-right: 1rem;
    width: 20px;
    text-align: center;
}

.premium-lock-icon {
    font-size: 0.9rem;
    color: var(--warning-color);
    display: none; /* Disembunyikan secara default */
}

/* Smart Recommendation (recommendation-view) kini GRATIS */

.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--sidebar-hover);
}

.logout-btn {
    width: 100%;
    background: none;
    border: none;
    text-align: left;
}
.logout-btn:hover {
    background-color: #c0392b !important;
}

.main-content {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.main-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.mobile-nav-toggle {
    display: none;
    font-size: 1.8rem;
    background: none;
    border: none;
    color: var(--dark-color);
    margin-right: 1rem;
}

#view-title {
    margin: 0;
}

.view {
    display: none;
    flex-grow: 1;
    flex-direction: column;
}

.view.active {
    display: flex;
}

.view-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

/* --- Komponen Spesifik: Task & Todo --- */
.task-group {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
}
.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
}
.task-title {
    font-weight: 600;
    margin: 0;
}
.task-controls button {
    margin-left: 0.5rem;
}
.task-body {
    padding: 0;
}
.task-body .list-group-item:first-child {
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.uncategorized-todos-title {
    margin-bottom: 1rem;
    color: var(--secondary-color);
    font-weight: 500;
}

.todo-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    transition: background-color 0.2s ease;
    flex-wrap: nowrap;
    gap: 1rem;
}
.todo-item:hover {
    background-color: #f1f3f5;
}
.todo-item-main {
    flex-grow: 1;
}
.todo-title {
    margin-left: 0.5rem;
    font-weight: 500;
}
.todo-item-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.todo-details {
    font-size: 0.875rem;
    color: #495057;
    padding-left: 0.5rem;
}
.todo-details .detail-item {
    display: flex;
    align-items: center;
    color: var(--secondary-color);
    margin-top: 0.5rem;
}
.todo-details .detail-item i {
    margin-right: 0.75rem;
    width: 16px;
    text-align: center;
}

/* --- Profile & Subscription --- */
.premium-badge {
    background-color: var(--warning-color);
    color: var(--dark-color);
    font-weight: 600;
}

/* --- Chatbot --- */
#chatbot-view,
#chat-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

#chat-box {
    flex-grow: 1;
    overflow-y: auto;
    background-color: var(--card-bg);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.chat-message {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    margin-bottom: 0.5rem;
    max-width: 80%;
    word-wrap: break-word;
}

.chat-message.user {
    background-color: var(--primary-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 0.25rem;
}

.chat-message.bot {
    background-color: #e9ecef;
    color: var(--dark-color);
    align-self: flex-start;
    border-bottom-left-radius: 0.25rem;
}

.chat-message.bot p {
    margin: 0;
}

.typing-indicator {
    display: flex;
    align-items: center;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #6c757d;
    border-radius: 50%;
    margin: 0 2px;
    animation: bounce 1s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.1s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.2s;
}

@keyframes bounce {
    0%,
    80%,
    100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1.0);
    }
}

/* --- Smart Recommendation --- */
#recommendation-result {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.loading-spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    min-height: 200px;
}

.recommendation-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    flex-grow: 1;
    padding: 2rem;
}

.recommendation-placeholder i {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    color: #ced4da;
}

/* --- Mobile Overlay --- */
#mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

#mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* --- PERUBAHAN: Task Detail View Styles (Menggantikan Modal) --- */

/* Hapus style modal */
/* #taskDetailModal .modal-dialog { ... } */

.collaboration-section {
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1rem;
    /* PERUBAHAN: Pastikan tinggi 100% agar sejajar di layout kolom */
    height: 100%; 
}

.member-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-left: 0;
    margin-bottom: 1rem;
}

.member-item {
    list-style: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
}

.member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.member-name {
    font-size: 0.8rem;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.comment-list {
    /* PERUBAHAN: Perbesar max-height untuk view penuh */
    max-height: 450px; 
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: var(--card-bg);
}

.comment-item {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.comment-item:last-child {
    margin-bottom: 0;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    background-color: var(--secondary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 0.9rem;
}

.comment-content {
    flex-grow: 1;
    /* Tambahkan position relative */
    position: relative; 
}

.comment-header {
    font-weight: 600;
    font-size: 0.9rem;
}

.comment-header .comment-date {
    font-weight: 400;
    color: var(--secondary-color);
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

/* CSS BARU */
.comment-actions {
    position: absolute;
    top: 0;
    right: 0;
    display: none; /* Sembunyi by default */
}

/* Tampilkan actions HANYA jika user adalah pemilik */
.comment-item.is-owner .comment-actions {
    display: block;
}

.comment-actions .btn {
    padding: 0.1rem 0.4rem;
    font-size: 0.8rem;
    line-height: 1.2;
}

.comment-body {
    font-size: 0.95rem;
    margin: 0.25rem 0 0 0;
    word-wrap: break-word;
}

/* CSS BARU */
.comment-edit-form {
    display: none; /* Sembunyi by default */
}

.comment-edit-form textarea {
    font-size: 0.95rem;
}

/* Saat mode edit, sembunyikan body */
.comment-item.is-editing .comment-body,
.comment-item.is-editing .comment-actions {
    display: none;
}

/* Saat mode edit, tampilkan form */
.comment-item.is-editing .comment-edit-form {
    display: block;
}


.premium-feature-overlay-wrapper {
    position: relative;
}

.premium-feature-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(248, 249, 250, 0.8);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: 0.5rem;
    z-index: 10;
}

.premium-feature-overlay i {
    font-size: 1.5rem;
    color: var(--warning-color);
}

.premium-feature-overlay span {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.9rem;
}

.premium-feature-overlay .btn-warning {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    margin-top: 0.5rem;
}


/* --- Media Queries --- */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
    }
    .sidebar.is-open {
        transform: translateX(0);
    }
    .mobile-nav-toggle {
        display: block;
    }
    .main-content {
        padding: 1rem;
    }
    /* PERUBAHAN: Pastikan kolom di task detail view ditumpuk di mobile */
    #task-detail-view .col-lg-5 {
        margin-top: 1.5rem; 
    }
}

@media (min-width: 992px) {
    /* PERUBAHAN: Hapus margin-top di desktop */
    #task-detail-view .col-lg-5 {
        margin-top: 0;
    }
}


@media (max-width: 576px) {
    .todo-item {
        flex-direction: column;
        align-items: stretch;
    }
    .todo-item-actions {
        margin-top: 0.75rem;
        justify-content: flex-end;
    }
}
