:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: rgba(255, 255, 255, 0.9);
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    /** Dimatikan sementara background: var(--bg-gradient); **/
    background-attachment: fixed;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: hidden;
}

.mobile-container {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    background: #f9fafb;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
}

.header {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: white;
    padding: 1.5rem 1.5rem 1.5rem 1.5rem;
    text-align: center;
    border-bottom-left-radius: 40px;
    border-bottom-right-radius: 40px;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.header p {
    font-size: 0.95rem;
    opacity: 0.9;
}

.content {
    padding: 2rem 1.5rem;
    flex-grow: 1;
}

.card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

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

.form-input {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1.05rem;
    background-color: white;
    transition: all 0.2s;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

/* Ensure date inputs have consistent height and behavior on mobile */
input[type="date"].form-input {
    min-height: 2.8rem;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn {
    width: 100%;
    padding: 0.875rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: #f3f4f6;
    color: var(--text-main);
}

.btn-secondary:hover {
    color: #ffffff;
}

.link-text {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.link-text a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 1.25rem 0;
    cursor: pointer;
    user-select: none;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
    margin: 0;
    -webkit-appearance: checkbox;
    appearance: checkbox;
}

.checkbox-group label {
    font-size: 0.9rem;
    color: var(--text-main);
    cursor: pointer;
    margin-bottom: 0;
    font-weight: 500;
}

/* Dashboard Styles */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
}

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

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.history-table th {
    text-align: left;
    padding: 0.75rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid #e5e7eb;
}

.history-table td {
    padding: 1rem 0.75rem;
    font-size: 0.95rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: 8px;
    transition: background 0.2s;
}

.action-btn:active {
    background: #f3f4f6;
}

.action-btn.edit {
    color: var(--primary);
}

.action-btn.delete {
    color: #ef4444;
}

.diff-positive {
    color: #059669;
    font-weight: 600;
}

.diff-negative {
    color: #ef4444;
    font-weight: 600;
}

.diff-positive::before {
    content: '+';
}

.footer-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.5rem 0.25rem 0.5rem;
    padding-top: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    position: sticky;
    bottom: 0;
    z-index: 100;
    overflow: visible;
}

.nav-item {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.3rem 0.5rem;
    border-radius: 10px;
    transition: all 0.2s;
    position: relative;
    min-width: 48px;
}

.nav-item i {
    font-size: 1.15rem;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active i {
    transform: scale(1.1);
}

/* FAB center button */
.nav-fab-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    margin-top: -22px;
    /* lift above nav bar */
}

.nav-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: white;
    font-size: 1.4rem;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.45);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
    border: 3px solid white;
}

.nav-fab:hover,
.nav-fab:active {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.55);
}

.nav-fab.active {
    background: linear-gradient(135deg, #4338ca, #4f46e5);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.6);
}


/* Notification badge on nav icon */
.nav-badge {
    position: absolute;
    top: 0;
    right: 4px;
    background: #ef4444;
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Notification & Dialog Overlay */
.toast-container,
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.toast-container.active,
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.toast,
.modal-card {
    background: white;
    padding: 30px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 90%;
    width: 320px;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast-container.active .toast,
.modal-overlay.active .modal-card {
    transform: scale(1);
}

.toast-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
}

.toast.success .toast-icon {
    background-color: #d1fae5;
    color: #10b981;
}

.toast.error .toast-icon {
    background-color: #fee2e2;
    color: #ef4444;
}

.toast-msg {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.modal-footer {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
}

.modal-footer .btn {
    flex: 1;
    padding: 0.75rem;
    font-size: 0.95rem;
}

.edit-mode-highlight {
    border: 2px solid var(--primary) !important;
    background-color: #f5f3ff !important;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.toast.hiding {
    animation: fadeOut 0.3s ease-in forwards;
}

.toast.form-modal,
.modal-card.form-modal {
    max-width: 420px;
    width: 92%;
    padding: 24px;
    align-items: stretch;
    max-height: 88vh;
    overflow-y: auto;
}

/* Reminder card hover */
.reminder-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.reminder-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.1);
}

/* Textarea as form-input */
textarea.form-input {
    min-height: 80px;
    resize: vertical;
    font-size: 0.95rem;
}

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

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
}

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

.animate-fade {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.12);
        opacity: 0.85;
    }
}

/* Pagination Styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.pagination-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    background: #f3f4f6;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.pagination-item:hover {
    background: #e5e7eb;
    color: var(--text-main);
}

.pagination-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.pagination-item.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.pagination-arrow {
    background: white;
    border: 1px solid #e5e7eb;
}

.pagination-arrow:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Deep Linking Highlight */
@keyframes highlightPulse {
    0% { background-color: white; transform: scale(1); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); }
    50% { background-color: #f5f3ff; transform: scale(1.02); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2); }
    100% { background-color: white; transform: scale(1); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); }
}

.target-highlight {
    animation: highlightPulse 1.5s ease-in-out 2;
    border-color: var(--primary) !important;
    z-index: 10;
}