/* Modern Dashboard Styles (Reference Image Matched) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #2f5597;
    /* Dark blue sidebar from image */
    --primary-dark: #244376;
    --primary-light: #eff6ff;
    --primary-blue: #2f5597;
    --secondary: #f59e0b;
    /* Orange/Yellow */
    --success: #16a34a;
    /* Green */
    --danger: #dc2626;
    /* Red */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --bg-body: #f4f7fa;
    --card-border: #eaecf0;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--gray-700);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    font-size: 0.875rem;
}

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

/* Sidebar Styles - Managed mostly by Tailwind now, custom styles below */
.sidebar-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    color: rgba(255, 255, 255, 0.85);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: transparent;
    margin-bottom: 0.25rem;
}

.sidebar-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-item.active {
    background-color: white;
    color: var(--primary);
    font-weight: 600;
}

.sidebar-item.active-parent {
    color: white;
    font-weight: 600;
}

.sidebar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 2rem;
    flex-shrink: 0;
}

.sidebar-text {
    white-space: nowrap;
    overflow: hidden;
    padding: 0 10px;
    text-overflow: ellipsis;
}

.sidebar-subitem {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.5rem 0.5rem 2.85rem;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.875rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    text-decoration: none;
    margin-bottom: 0.125rem;
}

.sidebar-subitem:hover:not(.active-sub) {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-subitem.active-sub {
    background-color: white;
    color: var(--primary);
    font-weight: 600;
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Top Header */
.app-header {
    height: 4rem;
    background-color: white;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 20;
}

/* Main Content Area */
.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    /* Important to prevent flex items from overflowing */
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.main-content-inner {
    padding: 1.5rem 2rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Typography & Utilities */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    color: var(--gray-900);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

/* Card System */
.card {
    background-color: white;
    border-radius: var(--radius);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

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

.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
}

.card-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 500;
    background-color: var(--gray-100);
    color: var(--gray-600);
}

/* Dashboard Grid Component */
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 1.5rem;
}

/* Responsive adjustment for dashboard grid */
@media (max-width: 1280px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.main-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.side-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Stat Cards */
.stat-cards-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.stat-card {
    background-color: white;
    border-radius: var(--radius);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.stat-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.blue {
    background-color: #eff6ff;
    color: #3b82f6;
}

.stat-icon.yellow {
    background-color: #fef3c7;
    color: #d97706;
}

.stat-icon.red {
    background-color: #fef2f2;
    color: #dc2626;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 500;
}

.stat-chart-placeholder {
    margin-top: 1rem;
    height: 40px;
}

/* List Items (for Expense Breakdown or Notifications) */
.breakdown-list {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--gray-200);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
}

.breakdown-label {
    color: var(--gray-600);
}

.breakdown-value {
    font-weight: 600;
    color: var(--gray-900);
}

/* Notification Items */
.notification-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
    border-radius: 0.75rem;
    margin: 0.25rem 0.75rem;
}

.notification-item:hover {
    background-color: #f8fafc;
    border-color: #e2e8f0;
    transform: translateY(-1px);
}

.notification-item:last-child {
    border-bottom: 1px solid #f1f5f9; /* Keep border or remove? Removed in next rule */
}

.notification-item:last-child {
    border-bottom-color: transparent;
}

@keyframes pulse-soft {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

.notification-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    transition: transform 0.2s ease;
}

.notification-item:hover .notification-icon {
    animation: pulse-soft 1.5s infinite ease-in-out;
}

.notification-icon.green {
    background: #ecfdf5;
    color: #059669;
}

.notification-icon.red {
    background: #fef2f2;
    color: #dc2626;
}

.notification-icon.blue {
    background: #eff6ff;
    color: #2563eb;
}

.notification-icon.yellow {
    background: #fffbeb;
    color: #d97706;
}

.notification-content p {
    margin: 0 0 0.25rem 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-800);
    line-height: 1.4;
}

.notification-content span {
    font-size: 0.7rem;
    color: var(--gray-400);
    font-weight: 500;
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background-color: rgb(236 241 255 / 1);
    padding: 1rem 1.25rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gray-900);
    border-bottom: 1px solid var(--card-border);
}

.data-table td {
    padding: 0.875rem 1.25rem;
    font-size: 0.8rem;
    color: var(--gray-800);
    border-bottom: 1px solid #f1f5f9;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* Total Due Card Alert */
.alert-card {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    padding: 1.25rem;
}

.alert-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 0.25rem;
}

.alert-card-subtitle {
    font-size: 0.875rem;
    color: #b45309;
}

.alert-button {
    margin-top: 1rem;
    background-color: #f59e0b;
    color: white;
    border: none;
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
}

/* Progress Bars */
.progress-group {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.progress-label {
    width: 100px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-600);
}

.progress-track {
    flex: 1;
    height: 0.5rem;
    background-color: var(--gray-100);
    border-radius: 0.25rem;
    overflow: hidden;
    margin: 0 1rem;
}

.progress-bar {
    height: 100%;
    border-radius: 0.25rem;
}

.progress-value {
    width: 60px;
    text-align: right;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-900);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-outline {
    background-color: white;
    border-color: var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background-color: var(--gray-50);
}

/* Form Elements */
.form-input,
.form-select {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--gray-700);
    background-color: white;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.form-select {
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    appearance: none;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--primary-blue);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

.bg-slate-50\/50 {
    background-color: rgb(236 241 255 / 1) !important;
}

.hover\:bg-slate-50\/50:hover {
    background-color: rgb(236 241 255 / 1) !important;
}

/* Filter Button Overrides */
.text-xs {
    font-size: 0.875rem !important;
    line-height: 1rem !important;
    font-weight: 500 !important;
}

.py-1 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

.px-3 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}