/* Premium edAgro Forest Green Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #f3ede0; /* Soft organic light brown canvas */
    --bg-sidebar: #ffffff; /* White Theme Sidebar */
    --bg-card: #ffffff; /* Pure white cards */
    --bg-card-hover: #ffffff;
    --border-color: #e2dbcd; /* Soft brown-tinted border */
    --text-primary: #834f30; /* edAgro organic brown text */
    --text-secondary: #64748b; /* Muted slate */
    
    --primary: #549352; /* edAgro Forest Green */
    --primary-glow: rgba(84, 147, 82, 0.08);
    --secondary: #f49900; /* edAgro Gold/Amber accent */
    --secondary-glow: rgba(244, 153, 0, 0.05);
    
    --success: #1ca215; /* Vibrant green FG2 */
    --warning: #93e25a; /* Light lime green FG3 */
    --danger: #ef4444;
    --info: #3b82f6;
    
    --sidebar-width: 260px;
    --transition-speed: 0.25s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar); /* White theme sidebar */
    border-right: 1px solid var(--border-color); /* Added soft border edge */
    padding: 2.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.01);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3.5rem;
    color: var(--text-primary); /* Dark brand text */
}

.brand-logo {
    width: 38px;
    height: 38px;
    background: transparent;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
}

.brand-name {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.65rem 1rem; /* px-4 py-2.5 equivalent */
    color: #4b5563; /* Slate dark gray for visibility on white background */
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition-speed) ease;
}

.nav-item a:hover {
    color: var(--primary); /* Hover to Forest Green brand color */
    background: rgba(30, 63, 32, 0.04); /* Light green touch */
}

.nav-item.active a {
    color: #ffffff; /* White text for active menu on dark green background */
    font-weight: 600;
    background: var(--primary); /* Forest Green active menu background */
    box-shadow: 0 4px 12px rgba(30, 63, 32, 0.15);
}

.nav-icon {
    font-size: 1.15rem;
}

.sidebar-footer {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color); /* Match border color */
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.btn-logout:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    color: var(--danger) !important;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 2.5rem;
    min-height: 100vh;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.page-title h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.page-title p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.2);
}

.btn-primary:hover {
    background: #11823b;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(22, 163, 74, 0.35);
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

/* Cards & Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.01), 0 2px 4px -1px rgba(0,0,0,0.01);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 20px -10px rgba(22, 163, 74, 0.15);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #4ade80);
    opacity: 0;
    transition: opacity var(--transition-speed);
}

.stat-card:hover::after {
    opacity: 1;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-title {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.icon-emerald { background: rgba(22, 163, 74, 0.08); color: var(--primary); }
.icon-indigo { background: rgba(30, 41, 59, 0.05); color: var(--secondary); }
.icon-blue { background: rgba(59, 130, 246, 0.08); color: var(--info); }
.icon-amber { background: rgba(245, 158, 11, 0.08); color: var(--warning); }

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Visualization Grid */
.viz-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

@media (max-width: 1024px) {
    .viz-grid {
        grid-template-columns: 1fr;
    }
}

.card-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px; /* Sudut halus rounded-2xl */
    padding: 2rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03); /* Thin shadow-sm */
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
}

.panel-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: #64748b; /* Muted gray-500 */
    font-weight: 500; /* Lighter header weight */
    font-size: 0.825rem; /* Smaller size text-sm */
    text-transform: capitalize; /* Clean look matching reference */
    background: transparent; /* Hilangkan background abu/gelap */
}

.custom-table td {
    padding: 1.1rem 1rem;
    border-bottom: 1px solid #f8fafc; /* divide-gray-100 equivalent */
    font-size: 0.875rem;
    color: var(--text-primary);
}

.custom-table tr:hover td {
    background: #f8fafc;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-new { background: rgba(59, 130, 246, 0.1); color: #2563eb; }
.badge-contacted { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.badge-qualified { background: rgba(16, 185, 129, 0.1); color: #059669; }
.badge-customer { background: rgba(22, 163, 74, 0.1); color: #16a34a; }
.badge-lost { background: rgba(239, 68, 68, 0.1); color: #dc2626; }

.badge-success { background: rgba(16, 185, 129, 0.1); color: #059669; }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.badge-info { background: rgba(59, 130, 246, 0.1); color: #2563eb; }

/* Forms */
.form-group {
    margin-bottom: 1.5rem; /* Lega dengan padding matematis */
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1.125rem; /* Lega dan presisi */
    background: #ffffff;
    border: 1px solid #cbd5e1; /* border-gray-300 */
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all var(--transition-speed);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15); /* Elegant blue ring */
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.show {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    padding: 2rem;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-backdrop.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Chat Log style (WhatsApp simulation) */
.chat-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.chat-bubble {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.chat-bubble.incoming {
    align-self: flex-start;
    background: #f1f5f9;
    color: var(--text-primary);
    border-bottom-left-radius: 2px;
    border: 1px solid #e2e8f0;
}

.chat-bubble.outgoing {
    align-self: flex-end;
    background: rgba(22, 163, 74, 0.08);
    color: #166534;
    border: 1px solid rgba(22, 163, 74, 0.15);
    border-bottom-right-radius: 2px;
}

.chat-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    text-align: right;
}

/* Login Page Custom styles */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}
