/* Global Styles */
:root {
    --bg-color: #ffffff;
    --text-color: #000000;
    --accent-color: #000000;
    --secondary-bg: #f9f9f9;
    --border-color: #e0e0e0;
    --success-color: #22c55e;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;

    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.text-success {
    color: var(--success-color) !important;
}

.text-danger {
    color: var(--danger-color) !important;
}

.text-warning {
    color: var(--warning-color) !important;
}

.text-info {
    color: var(--info-color) !important;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--accent-color);
    color: #fff;
    border: 1px solid var(--accent-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn:hover {
    background-color: #333;
    border-color: #333;
}

.btn-outline {
    background-color: transparent;
    color: var(--accent-color);
}

.btn-outline:hover {
    background-color: var(--secondary-bg);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

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

.btn-danger:hover {
    background-color: #dc2626;
    border-color: #dc2626;
}

/* Login Page */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background-color: var(--bg-color);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    background-color: #fff;
    text-align: center;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.login-header p {
    color: #666;
    font-size: 14px;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

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

.sidebar {
    width: 260px;
    background-color: #fff;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-item {
    margin-bottom: 5px;
}

.nav-link {
    display: block;
    padding: 12px 15px;
    border-radius: 8px;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background-color: #f5f5f5;
    color: #000;
}

.user-profile {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
    color: #555;
}

.logout-link {
    font-size: 12px;
    color: var(--danger-color);
    margin-top: 5px;
    display: block;
}

.main-content {
    flex: 1;
    background-color: var(--secondary-bg);
    padding: 30px;
    margin-left: 260px;
    min-height: 100vh;
}

/* Mobile Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 0 15px;
    align-items: center;
    z-index: 999;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

.mobile-title {
    font-size: 18px;
    font-weight: 700;
    margin-left: 15px;
}

/* Dashboard */
.page-header {
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
}

.current-date {
    font-size: 14px;
    color: #666;
}

.dashboard-grid,
.finance-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    max-height: 350px; /* Tambahkan batas tinggi */
    overflow-y: auto; /* Tambahkan scroll jika konten panjang */
}

canvas {
    max-width: 100% !important;
    height: auto !important;
}

.card-title {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-value {
    font-size: 28px;
    font-weight: 700;
    color: #000;
}

.chart-card {
    min-height: 280px;
    max-height: 320px; /* Kurangi tinggi chart */
}

.quick-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.section-title {
    font-size: 18px;
    margin-bottom: 15px;
    font-weight: 600;
}

/* Progress Bar */
.progress-bar {
    height: 8px;
    background: #eee;
    border-radius: 4px;
    margin-top: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success-color);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Recent List */
.recent-list {
    list-style: none;
    max-height: 300px; /* Batasi tinggi daftar transaksi */
    overflow-y: auto; /* Scroll jika banyak transaksi */
}

.recent-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.recent-item:last-child {
    border-bottom: none;
}

.recent-amount.income {
    color: var(--success-color);
}

.recent-amount.expense {
    color: var(--danger-color);
}

.empty-text {
    color: #888;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

/* Product Research - Enhanced Card Grid */
.research-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.research-item {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.research-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}

.research-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.research-item:hover::before {
    opacity: 1;
}

.research-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.research-date {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

.research-date i {
    color: var(--primary-color);
}

.research-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.btn-icon:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.btn-icon.btn-danger:hover {
    background: #dc3545;
    border-color: #dc3545;
}

.research-content h4 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
}

.research-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-category {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.badge-platform {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.research-link {
    margin: 12px 0;
}

.research-link .btn-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    padding: 6px 0;
    transition: all 0.2s ease;
}

.research-link .btn-link:hover {
    color: var(--secondary-color);
    gap: 10px;
}

.research-notes {
    background: #f8f9fa;
    border-left: 3px solid var(--primary-color);
    padding: 12px 15px;
    margin-top: 12px;
    border-radius: 0 8px 8px 0;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
}

.research-notes i {
    color: var(--primary-color);
    margin-right: 8px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h4 {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 20px;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
    max-width: 400px;
    margin: 0 auto;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Filter and Search Enhancements */
.research-filters {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.research-filters .form-group {
    margin: 0;
    flex: 1;
    min-width: 200px;
}

.research-filters input,
.research-filters select {
    margin: 0;
}

/* Habit Tracker */
.habit-container {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.add-habit-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.table-responsive {
    overflow-x: auto;
    margin: 0 -20px;
    padding: 0 20px;
}

.habit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 800px;
}

.habit-table th,
.habit-table td {
    border: 1px solid #eee;
    padding: 8px 6px;
    text-align: center;
}

.habit-table th {
    font-weight: 600;
    background-color: #fafafa;
    position: sticky;
    top: 0;
}

.habit-name-col {
    text-align: left !important;
    min-width: 120px;
    font-weight: 500;
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 1;
}

.habit-table th.habit-name-col {
    background: #fafafa;
    z-index: 2;
}

.check-btn {
    width: 26px;
    height: 26px;
    border: 2px solid #ddd;
    border-radius: 6px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    font-size: 14px;
}

.check-btn.checked {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.check-btn:hover {
    border-color: #aaa;
    transform: scale(1.05);
}

.legend {
    margin-top: 15px;
    font-size: 12px;
    color: #666;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-check {
    width: 14px;
    height: 14px;
    border: 2px solid #ddd;
    border-radius: 4px;
    display: inline-block;
}

.legend-check.checked {
    background: var(--success-color);
    border-color: var(--success-color);
}

.legend-timezone {
    margin-left: auto;
    color: #999;
}

/* Finance Tracker */
.transaction-list {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.transaction-item:last-child {
    border-bottom: none;
}

.t-info h4 {
    font-size: 14px;
    margin-bottom: 4px;
    font-weight: 500;
}

.t-info span {
    font-size: 12px;
    color: #888;
}

.t-amount {
    font-weight: 600;
    font-size: 14px;
}

.t-amount.income {
    color: var(--success-color);
}

.t-amount.expense {
    color: var(--danger-color);
}

.t-amount.debt {
    color: var(--warning-color);
}

.t-amount.receivable {
    color: #3b82f6;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
}

.modal.active {
    display: block;
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 92%;
    max-width: 900px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    animation: fadeIn 0.25s ease-out;
}

.modal-lg {
    max-width: 980px;
}

.modal-header,
.modal-footer {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
}

/* Enhanced Form Styling */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #999;
    font-style: italic;
}

.close {
    border: none;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
    color: #666;
    transition: transform 0.2s ease;
}

.close:hover {
    transform: scale(1.1);
    color: #000;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-close {
        display: block;
    }

    .mobile-header {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 80px 15px 20px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-title {
        font-size: 20px;
    }

    .card-value {
        font-size: 22px;
    }

    .dashboard-grid,
    .finance-summary {
        grid-template-columns: 1fr;
    }

    .card {
        max-height: 350px; /* Lebih kecil di mobile */
    }

    .chart-card {
        max-height: 280px; /* Lebih kecil di mobile */
    }

    .recent-list {
        max-height: 250px; /* Lebih kecil di mobile */
    }

    .quick-actions {
        flex-direction: column;
    }

    .quick-actions .btn {
        width: 100%;
        text-align: center;
    }

    .add-habit-form {
        flex-direction: column;
    }

    .add-habit-form input {
        max-width: 100% !important;
    }

    .legend {
        flex-direction: column;
        align-items: flex-start;
    }

    .legend-timezone {
        margin-left: 0;
    }

    .transaction-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* Product Research Page */
.research-form {
    max-width: 600px;
}

.research-form .form-group {
    margin-bottom: 20px;
}

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

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-category {
    background-color: #e3f2fd;
    color: #1976d2;
}

.badge-platform {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.btn-link {
    color: var(--info-color);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
}

.btn-link:hover {
    text-decoration: underline;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.table th {
    background-color: #fafafa;
    font-weight: 600;
    color: #555;
}

.table tbody tr:hover {
    background-color: #f9f9f9;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.card-actions {
    font-size: 14px;
    color: #666;
}

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}