@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap');

:root {
    --primary-color: #171717;
    /* Black/Dark Gray */
    --secondary-color: #525252;
    /* Medium Gray */
    --accent-color: #d1d5db;
    /* Light Gray */
    --bg-dark: #ffffff;
    /* White Background */
    --bg-card: #f3f4f6;
    /* Very Light Gray for cards */
    --text-light: #111827;
    /* Near Black Text */
    --text-dim: #6b7280;
    /* Gray Text */
    --success: #16a34a;
    /* Green 600 */
    --danger: #dc2626;
    /* Red 600 */
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.9);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Open Sans', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: calc(100vh - 4rem);
}

.app-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    /* Stack vertically */
    align-items: flex-start;
    /* Align left */
    gap: 0.2rem;
    margin-bottom: 2rem;
    line-height: 1.2;
}

.app-logo span {
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 400;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(79, 70, 229, 0.2);
    color: var(--text-light);
    border-left: 3px solid var(--primary-color);
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
    padding-right: 1rem;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.welcome-text h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.welcome-text p {
    color: var(--text-dim);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    position: relative;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: #d4d4d8;
}

.stat-title {
    color: var(--text-dim);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-light);
}

.stat-icon {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.5rem;
    opacity: 0.5;
}

/* Recent Transactions Table */
.recent-transactions {
    background: var(--bg-card);
    border-radius: 1rem;
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-dim);
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 1rem;
    color: var(--text-light);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

tr:last-child td {
    border-bottom: none;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main-content>* {
    animation: fadeIn 0.5s ease-out forwards;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #000000;
    /* Pure Black */
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    /* Pure Black Overlay */
    backdrop-filter: blur(2px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    position: relative;
    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.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: var(--danger);
}

/* Form Styles */
.form-group {
    margin-bottom: 0.75rem;
    /* Reduced from 1.25rem */
}

.form-label {
    display: block;
    margin-bottom: 0.25rem;
    /* Reduced from 0.5rem */
    color: var(--text-dim);
    font-size: 0.875rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: #ffffff;
    /* White */
    border: 1px solid #d4d4d8;
    /* Light Gray */
    border-radius: 0.5rem;
    color: var(--text-light);
    /* Dark Text */
    font-size: 16px;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: #525252;
    /* Dark Gray Focus */
    box-shadow: 0 0 0 2px rgba(82, 82, 82, 0.2);
    /* Gray Shadow */
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
}

.btn-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: rgba(16, 185, 129, 0.3);
}

/* Fix for Select Dropdown Options in Dark Mode */
option {
    background-color: var(--bg-card);
    /* Dark background so white text is visible */
    color: var(--text-light);
}

/* Custom Autocomplete */
.input-position-container {
    position: relative;
}

.suggestions-box {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    margin-top: 5px;
}

.suggestion-item {
    padding: 0.5rem 0.75rem;
    /* Reduced padding */
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-light);
    transition: background 0.2s;
    font-size: 0.9rem;
    /* Slightly smaller base font */
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: rgba(79, 70, 229, 0.2);
}

.suggestion-item strong {
    color: var(--primary-color);
    font-size: 0.95rem;
    /* Smaller strong text */
}

.suggestion-item small {
    color: var(--text-dim);
    display: block;
    font-size: 0.75rem;
    /* Smaller detail text */
    margin-top: 2px;
}

/* Transaction Type Toggle */
.transaction-type-toggle {
    display: flex;
    gap: 1rem;
}

.btn-toggle {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--glass-border);
    background: #ffffff;
    color: var(--text-dim);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
}

.btn-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-toggle.active[data-value="setoran"] {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-toggle.active[data-value="penarikan"] {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* Floating Alert Notification */
.floating-alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    min-width: 300px;
    text-align: center;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    background: var(--bg-card);
    /* Fallback */
    backdrop-filter: blur(12px);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        top: -100px;
        opacity: 0;
    }

    to {
        top: 20px;
        opacity: 1;
    }
}

/* =========================================
   RESPONSIVE MOBILE STYLES
   ========================================= */
@media (max-width: 768px) {

    /* Layout Reset */
    .container {
        display: flex;
        flex-direction: column;
        height: auto;
        padding: 0;
        /* Full width */
    }

    /* Transform Sidebar to Top Navigation */
    .sidebar {
        width: 100%;
        height: auto;
        padding: 1rem;
        border-radius: 0;
        border: none;
        border-bottom: 1px solid var(--glass-border);
        position: sticky;
        top: 0;
        z-index: 100;
        background: rgba(255, 255, 255, 0.95);
    }

    .app-logo {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 1rem;
        font-size: 1.1rem;
    }

    /* Horizontal Scrollable Menu */
    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
        gap: 0.5rem;
        /* Hide scrollbar */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .nav-menu::-webkit-scrollbar {
        display: none;
    }

    .nav-item {
        white-space: nowrap;
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
        border: 1px solid var(--glass-border);
    }

    .nav-item i {
        font-size: 1rem;
    }

    /* Main Content Adjustments */
    .main-content {
        padding: 1rem;
        overflow: visible;
        height: auto;
        gap: 1.5rem;
    }

    .header {
        flex-direction: column-reverse;
        align-items: flex-start;
        gap: 1rem;
    }

    .welcome-text {
        text-align: left !important;
        width: 100%;
    }

    .welcome-text h1 {
        font-size: 1.5rem;
    }

    /* Stats Grid to Single Column */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    /* Table Adjustments */
    .table-container {
        margin: 0 -0.5rem;
        /* Negative margin to let table breathe */
        padding-bottom: 1rem;
    }

    th,
    td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }

    /* Modal Mobile */
    .modal-content {
        width: 95%;
        margin: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Form Inputs */
    .form-control {
        font-size: 16px;
        /* Prevent zoom on iOS */
    }

    /* Hide standard logout in footer of sidebar to save space, rely on menu item */
    .sidebar>div:last-child {
        display: none !important;
    }
}