/* css/style.css */
:root {
    --primary: #499f88;          /* medium teal-green */
    --primary-light: #7fc5ad;    /* lighter tint */
    --primary-dark: #2f6f5f;     /* darker shade */
    --text-primary: #1f2937;
    --text-secondary: #374151;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --hover: #f3f4f6;
    --white: #ffffff;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --grad-1: #10b981;
    --grad-2: #059669;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gold: #fbbf24;
    --online: #10b981;
    --online-dark: #059669;
    --typing: #499f6a;
    --offline: #6b7280;
    --accent: #499f88;           /* Added accent color */
    --radius: 12px;              /* Added default border-radius */
    --radius-lg: 1.5rem;         /* Large border-radius for specific cards */
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Added default shadow */
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.08); /* Larger shadow for specific cards */
    --input-bg: var(--bg-primary); /* Define input background variable */
    --primary-rgb: 73, 159, 136; /* RGB values for --primary */
    --info: #3b82f6; /* Define an info color for allocated status */
    --success-text-rgb: 5, 150, 105; /* RGB for --success-text */
    --danger-text-rgb: 220, 38, 38; /* RGB for --danger-text */
    --try: #005555;

    /* Status & Action Button Colors */
    --success-bg: #e7f7f3;
    --success-text: #059669;
    --warning-bg: #fffbeb;
    --warning-text: #d97706;
    --danger-bg: #fee2e2;
    --danger-text: #dc2626;
    --action-view-bg: #eff6ff;
    --action-view-text: #2563eb;
    --action-edit-bg: #f0fdf4;
    --action-edit-text: #16a34a;
    --action-delete-bg: #fef2f2;
    --action-delete-text: #ef4444;
}

[data-theme="dark"] {
    --primary: #2f6f5f;
    --primary-light: #1e293b;
    --primary-dark: #14532d;
    --text-primary: #f3f4f6;
    --text-muted: #9ca3af;
    --border: #374151;
    --hover: #1f2937;
    --white: #f9fafb;
    --bg-primary: #111827;
    --bg-secondary: #0f172a;
    --grad-1: #059669;
    --grad-2: #047857;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gold: #fbbf24;
    --online: #10b981;
    --online-dark: #045967;
    --typing: #499f6a;
    --offline: #6b7280;
    --accent: #4F46E5;           /* Darker accent for dark mode */
    --input-bg: #1f2937; /* Dark mode input background */
    --primary-rgb: 47, 111, 95; /* RGB values for --primary in dark mode */
    --info: #60a5fa; /* Dark mode info color */
    --success-text-rgb: 52, 211, 153; /* RGB for --success-text in dark mode */
    --danger-text-rgb: 248, 113, 113; /* RGB for --danger-text in dark mode */

    /* Status & Action Button Colors */
    --success-bg: #062a22;
    --success-text: #34d399;
    --warning-bg: #422006;
    --warning-text: #fbbf24;
    --danger-bg: #450a0a;
    --danger-text: #f87171;
    --action-view-bg: #1e293b;
    --action-view-text: #60a5fa;
    --action-edit-bg: #1e293b;
    --action-edit-text: #4ade80;
    --action-delete-bg: #1e293b;
    --action-delete-text: #f87171;
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    line-height: 1.6;
}

[data-theme="dark"] body { background: #0f172a; }

/* General Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', serif;
    color: var(--text-primary);
    margin-bottom: 0.8rem;
    line-height: 1.2;
}
h1 { font-size: 3rem; }
h2 { font-size: 2.5rem; }
h3 { font-size: 2rem; }
h4 { font-size: 1.5rem; }
p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}
a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s ease;
}
a:hover {
    color: var(--primary-light);
}

.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    grid-template-rows: 5rem 1fr;
    grid-template-areas:
        "sidebar header"
        "sidebar main";
    height: 100vh;
    transition: grid-template-columns 0.3s ease;
}

body.sidebar-collapsed .layout {
    grid-template-columns: 80px 1fr;
}
body.sidebar-collapsed .sidebar { width: 80px; }
body.sidebar-collapsed .header { left: 0px; width: calc(100% - 0px); }
body.sidebar-collapsed .logo img { opacity: 0; width: 0; margin: 0; }
body.sidebar-collapsed .theme-toggle { display: none !important; }
body.sidebar-collapsed .sidebar-footer { display: none !important; }
body.sidebar-collapsed .dropdown-arrow { display: none; }

.sidebar {
    grid-area: sidebar;
    background: var(--bg-primary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 100;
    position: relative;
    transition: all 0.3s ease;
    height: 100vh;
}

.header {
    grid-area: header;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 90;
    transition: all 0.3s ease;
}

.main-content {
    grid-area: main;
    background: var(--bg-secondary);
    padding: 2rem;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s ease;
}
[data-theme="dark"] .main-content { background: #0f172a; }

@media (max-width: 768px) {
    .main-content { padding: 1rem; }
}

@media (max-width: 992px) {
    .layout {
        grid-template-columns: 1fr;
        grid-template-areas: "header" "main";
    }
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        transition: left 0.3s ease;
        z-index: 999;
    }
    .sidebar.open { left: 0; }
    .header { padding: 0 1rem; flex-wrap: wrap; height: auto; min-height: 5rem; }
    .sidebar { width: 80vw; left: -80vw; }
}

@media (max-width: 480px) {
    h1 { font-size: 2.2rem; }
    h2 { font-size: 1.8rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.2rem; }
    .page-header h1 { font-size: 1.8rem; }
    .filters {
        grid-template-columns: 1fr; /* Stack filters vertically on very small screens */
        padding: 0.8rem; /* Reduce padding for filters on very small screens */
    }
    .record-payment-card {
        padding: 1.5rem; /* Reduced padding for smaller screens */
    }
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    border: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: var(--bg-primary); color: var(--text-primary); border: 1px solid var(--border); }
.btn-whatsapp { background: #25d366; color: white; width: 100%; padding: 1rem; border-radius: var(--radius); font-weight: 700; margin-top: 1rem; }
.btn-whatsapp:hover { background: #1da851; }
.btn-pay { background: var(--accent); color: white; width: 100%; padding: 1rem; border-radius: var(--radius); font-weight: 700; }
.btn-pay:hover { background: var(--primary); }
.action-buttons-container {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.action-buttons-container .action-btn {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.action-buttons-container .action-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
/* Badges */
.badge { display: inline-flex; align-items: center; padding: 0.4em 0.8em; border-radius: 9999px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; margin-right: 0.5rem; }
.badge-sale { background-color: var(--gold); color: #fff; }
.badge-status { background-color: var(--primary); color: #fff; }
.badge-info { background-color: var(--action-view-bg); color: var(--action-view-text); }
.modal-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Ensure it's on top of other content */
}
/* Page header */
.page-header {
  margin-bottom: 3rem;
  animation: fadeIn 0.8s ease;
}
.page-header h1 {
  font-size: 2.4rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
}
.page-header p {
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 750px;
}
/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}
.stat-card {
  background: var(--bg-primary);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  animation: fadeIn 1s ease;
}
.stat-icon {
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 1rem;
}
.stat-value {
  font-size: 2rem;
  font-weight: 900;
}
.stat-label {
  margin-top: 0.3rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.main-stat-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
}
.main-stat-card .stat-label {
    color: var(--white);
}
/* Table Section */
.table-section {
  background: var(--bg-primary);
  border-radius: 0.5rem;
  padding: 1rem;
  animation: fadeIn 1.1s ease;
}
.table-title {
  font-size: 1.7rem;
  font-weight: 800;
  margin-bottom: 1.3rem;
}
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}
.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--border);
}
.empty-state h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}
.empty-state p {
  font-size: 1rem;
  margin: 0;
  color: var(--text-muted);
}
/* Table */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-primary);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  border: 1px solid var(--border);
  margin-bottom: 2rem;
}
.table thead {
  background: var(--primary);
  color: var(--white);
}
.table th {
    padding: 1.2rem 1.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--white);
}
.table td {
    padding: 1.4rem 1.5rem;
    border-bottom: 1px solid var(--border);
}
.table tbody tr {
  transition: all 0.25s var(--trans);
}
.table tbody tr:hover {
  background: var(--hover);
  transform: scale(1.01);
  box-shadow: 0 8px 25px var(--shadow);
}
.table tbody tr td img {
    border-radius: 8px;
    max-width: 60px;
    height: auto;
}
.table-responsive {
    overflow-x: auto;
    /* Add padding to the bottom to ensure scrollbar is visible and doesn't cut off content */
    padding-bottom: 1rem;
    margin-bottom: 1rem; /* Ensure space below for the scrollbar */
}
/* Custom Scrollbar Styles for .table-responsive */
.table-responsive::-webkit-scrollbar {
    height: 8px; /* Make scrollbar more prominent */
}
.table-responsive::-webkit-scrollbar-track {
    background: var(--bg-secondary); /* Match track with background */
    border-radius: 10px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: var(--primary-light); /* Use a lighter primary color for thumb */
    border-radius: 10px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--primary); /* Darker on hover */
}
/* Firefox scrollbar styling */
.table-responsive {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-light) var(--bg-secondary);
}
html[data-theme="dark"] .table tbody tr:hover {
  background: #1f2937;
}

/* Status Badges */
.status-badge { padding: 0.4rem 0.8rem; border-radius: 12px; font-size: 0.8rem; font-weight: 700; text-transform: capitalize; display: inline-block; }
.status-paid, .status-completed, .status-approved, .status-available, .status-active, .status-success, .status-confirmed { background-color: var(--success-bg); color: var(--success-text); }
.status-pending, .status-processing, .status-under_offer { background-color: var(--warning-bg); color: var(--warning-text); }
.status-unpaid, .status-failed, .status-declined, .status-sold, .status-rejected, .status-cancelled, .status-banned { background-color: var(--danger-bg); color: var(--danger-text); }

/* Priority Badges (from tasks.php) */
.priority-badge { display: inline-block; padding: 0.4rem 0.8rem; border-radius: 12px; font-size: 0.8rem; font-weight: 700; text-transform: capitalize; color: white; }
.priority-critical { background-color: #dc2626; }
.priority-high { background-color: #f59e0b; }
.priority-medium { background-color: #3b82f6; }
.priority-low { background-color: #6b7280; }

/* Task-specific status badges */
.status-in_progress { background-color: var(--action-view-bg); color: var(--action-view-text); }
.status-on_hold { background-color: var(--bg-secondary); color: var(--text-muted); border: 1px solid var(--border); }

/* Table Footer and Bulk Actions */
.table-footer { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0; }
.bulk-actions { display: flex; gap: 0.75rem; align-items: center; }
.bulk-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.bulk-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.bulk-actions .btn i {
    margin-right: 0.5rem;
}

/* Custom Checkbox Styling */
.task-checkbox, #selectAll {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: var(--bg-primary);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    outline: none;
}

.task-checkbox:checked, #selectAll:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.task-checkbox:checked::after, #selectAll:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.task-checkbox:hover, #selectAll:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 99, 102, 241), 0.1);
}

.task-checkbox:checked:hover, #selectAll:checked:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Table Action Buttons */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px; /* Slightly increased gap */
    padding: 0.6rem 1rem; /* Increased padding for a more substantial feel */
    border-radius: 10px; /* Slightly increased border-radius */
    text-decoration: none;
    margin: 0 4px;
    border: none;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); /* Subtle default shadow */
}
.action-btn:hover {
    transform: translateY(-3px); /* More pronounced lift */
    box-shadow: 0 6px 18px rgba(0,0,0,0.15); /* Enhanced hover shadow */
}

.btn-view {
    background-color: var(--action-view-bg);
    color: var(--action-view-text);
}
.btn-edit {
    background-color: var(--action-edit-bg);
    color: var(--action-edit-text);
}
.action-btn.btn-delete, .action-btn.btn-reject, .action-btn.btn-cancel, .action-btn.btn-decline {
    background-color: var(--action-delete-bg);
    color: var(--action-delete-text);
    box-shadow: 0 4px 10px rgba(var(--danger-text-rgb), 0.1);
}
.action-btn.btn-delete:hover, .action-btn.btn-reject:hover, .action-btn.btn-cancel:hover, .action-btn.btn-decline:hover {
    box-shadow: 0 6px 15px rgba(var(--danger-text-rgb), 0.2);
}
.action-btn.btn-approve, .action-btn.btn-confirm {
    background-color: var(--success-bg);
    color: var(--success-text);
    box-shadow: 0 4px 10px rgba(var(--success-text-rgb), 0.1);
}
.action-btn.btn-approve:hover, .action-btn.btn-confirm:hover {
    box-shadow: 0 6px 15px rgba(var(--success-text-rgb), 0.2);
}

/* Specific styling for btn-primary when used as action-btn */
.action-btn.btn-primary {
    background: linear-gradient(45deg, var(--primary), var(--primary-dark));
    color: var(--white);
    box-shadow: 0 4px 10px rgba(var(--primary-rgb), 0.2);
}
.action-btn.btn-primary:hover {
    background: linear-gradient(45deg, var(--primary-light), var(--primary));
    box-shadow: 0 6px 15px rgba(var(--primary-rgb), 0.3);
}

/* Specific styling for btn-secondary when used as action-btn */
.action-btn.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.action-btn.btn-secondary:hover {
    background: var(--hover);
    border-color: var(--primary);
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}

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

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

/* Responsive Table to Cards */
@media (max-width: 768px) {
  .table thead { display: none; }
  .table tr {
    display: block;
    margin-bottom: 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 1rem;
  }
  .table td {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
  }
  .table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-muted);
  }
  .table td:has(.action-btn) { /* Target td elements that contain action-btn */
    display: flex;
    flex-wrap: wrap; /* Allow buttons to wrap to the next line */
    gap: 0.5rem; /* Space between buttons */
  }

  /* Responsive Empty State */
  .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
  }
  .empty-state i {
    font-size: 2.5rem;
  }
  .empty-state h3 {
    font-size: 1.2rem;
  }
  .empty-state p {
    font-size: 0.9rem;
  }
}

/* Dashboard Form Card */
.form-card {
    background: var(--bg-primary);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    max-width: 700px;
    margin: 2rem auto;
    animation: fadeIn 0.8s ease forwards;
}

.form-group {
    margin-bottom: 1rem;
}
.form-group label { display: block; font-size: 0.95rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.6rem; }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group input[type="file"],
.form-group textarea {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.3s ease;
    outline: none;
}
.form-group textarea:focus,
.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2);
}
select {
    appearance: none;
    background: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyLjY2NyA1LjMzM0wxMy4zMzMgNi4wMDAwMDAxTDUuMzMzIDUuMzMzWiIgZmlsbD0iI0NDQyIvPgo8L2ZzZz4=') no-repeat right 1rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}
.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end; /* Align buttons to the right */
    margin-top: 2rem;
}

/* Alert Messages */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
}

.alert-danger {
    background: #fee2e2; /* light red */
    color: #991b1b; /* dark red */
    border: 1px solid #ef4444; /* red */
}
[data-theme="dark"] .alert-danger {
    background: #450a0a;
    color: #fca5a5;
    border-color: #7f1d1d;
}

.alert-success {
    background: #ecfdf5; /* light green */
    color: #065f46; /* dark green */
    border: 1px solid #10b981; /* green */
}
[data-theme="dark"] .alert-success {
    background: #064e3b;
    color: #a7f3d0;
    border-color: #047857;
}

/* Filters */
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    background: var(--bg-primary);
    padding: 1.2rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}
.filters input, .filters select { width: 100%; padding: 1rem 1.4rem; border: 1px solid var(--border); border-radius: 16px; background: var(--bg-secondary); font-size: 1rem; transition: all 0.3s ease; }
.filters input:focus, .filters select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 5px rgba(99,102,241,0.1); background: var(--bg-primary); }
.btn-search { background: var(--primary); color: white; border: none; padding: 1rem 2rem; border-radius: 16px; font-weight: 700; cursor: pointer; transition: all 0.4s; display: flex; align-items: center; justify-content: center; gap: 0.6rem; box-shadow: 0 8px 25px rgba(99,102,241,0.3); }
.btn-clear-filters { background: var(--bg-secondary); color: var(--text-muted); border: 1px solid var(--border); padding: 1rem 2rem; border-radius: 16px; font-weight: 700; cursor: pointer; transition: all 0.3s ease; box-shadow: var(--shadow); }
.btn-clear-filters:hover { background: var(--hover); color: var(--text-primary); border-color: var(--primary); }

/* Record Payment Card */
.record-payment-card {
    background: var(--bg-primary);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    max-width: 650px;
    margin: auto;
    animation: fadeIn 0.7s ease-out;
}
.record-payment-card h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--primary-dark); }
.record-payment-card h2 { font-size: 1rem; font-weight: 500; margin-bottom: 2rem; color: var(--text-muted); }
.btn-submit-payment { background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; font-weight: 600; border: none; cursor: pointer; transition: 0.3s; padding: 1rem; border-radius: var(--radius); }
.btn-submit-payment:hover { background: linear-gradient(135deg, var(--primary-light), var(--primary)); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.25); }
.btn-payment-action { display: inline-block; padding: 0.8rem 1.4rem; background: var(--primary-dark); color: var(--white); font-weight: 600; border-radius: var(--radius); margin-top: 1rem; text-decoration: none; transition: 0.3s; }
.btn-payment-action:hover { background: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.25); }

/* Custom Scrollbars */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

/* Allocated Badge (my_properties.php) */
.badge-allocated {
    position: absolute;
    top: 16px;
    left: 16px;
    background: linear-gradient(135deg, var(--info), #60a5fa);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(96, 165, 250, 0.4);
}
.payment-status-pending {
    background: rgba(96, 165, 250, 0.1);
    color: var(--info);
    border: 1px solid rgba(96, 165, 250, 0.2);
}

/* Pagination Styling */
.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    border-radius: var(--radius);
    margin-top: 1.5rem;
    margin-bottom: 0;
    justify-content: flex-end; /* Align to the right */
}

.page-item {
    margin: 0 2px;
}

.page-link {
    position: relative;
    display: block;
    padding: 0.75rem 1rem;
    line-height: 1.25;
    color: var(--primary);
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.3s ease;
    text-decoration: none;
}

.page-link:hover {
    color: var(--white);
    background-color: var(--primary-light);
    border-color: var(--primary-light);
    cursor: pointer;
}

.page-item.active .page-link {
    z-index: 1;
    color: var(--white);
    background-color: var(--primary);
    border-color: var(--primary);
}

.page-item.disabled .page-link {
    color: var(--text-muted);
    pointer-events: none;
    background-color: var(--bg-secondary);
    border-color: var(--border);
}

/* Dark mode adjustments for pagination */
[data-theme="dark"] .page-link {
    background-color: var(--bg-primary);
    border-color: var(--border);
    color: var(--primary);
}

[data-theme="dark"] .page-link:hover {
    color: var(--white);
    background-color: var(--primary-light);
    border-color: var(--primary-light);
}

[data-theme="dark"] .page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

[data-theme="dark"] .page-item.disabled .page-link {
    background-color: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-muted);
}
.record-payment-card {
            background: var(--bg-primary);
            border-radius: 20px;
            padding: 2.5rem;
            border: 1px solid var(--border);
            box-shadow: 0 10px 30px rgba(0,0,0,0.08);
            max-width: 600px;
            margin: 0 auto;
        }
        .form-group {
            margin-bottom: 1.5rem;
        }
        .form-group label {
            display: block;
            font-weight: 600;
            margin-bottom: 0.5rem;
            color: var(--text-primary);
        }
        .form-group input,
        .form-group select,
        .form-group textarea {
            width: 100%;
            padding: 0.9rem 1.2rem;
            border: 1px solid var(--border);
            border-radius: 14px;
            background: var(--bg-secondary);
            font-size: 1rem;
            color: var(--text-primary);
        }
        .btn-submit-payment {
            background: var(--primary);
            color: var(--white);
            padding: 1rem 2rem;
            border: none;
            border-radius: 12px;
            font-weight: 700;
            cursor: pointer;
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            transition: all 0.3s ease;
        }
        .btn-submit-payment:hover {
            background: var(--primary-dark);
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        }
        .user-info-card {
            background: var(--bg-secondary);
            border-radius: 15px;
            padding: 1.5rem;
            margin-bottom: 2rem;
            border-left: 4px solid var(--primary);
        }
        .user-info-card h3 {
            margin: 0 0 0.5rem 0;
            color: var(--text-primary);
        }
        .user-info-card p {
            margin: 0.25rem 0;
            color: var(--text-muted);
        }
        .error-message {
            background: var(--danger-bg);
            color: var(--danger-text);
            padding: 1.5rem;
            border-radius: 15px;
            text-align: center;
            margin-bottom: 2rem;
            border: 1px solid var(--danger-border);
        }
        .back-button {
            background: var(--bg-secondary);
            color: var(--text-primary);
            padding: 0.7rem 1.2rem;
            border-radius: 10px;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            transition: all 0.3s ease;
        }
        .back-button:hover {
            background: var(--border);
        }
        #property-loading-error {
            color: var(--danger);
            margin-top: 0.5rem;
            font-size: 0.9rem;
            padding: 0.5rem;
            border-radius: 8px;
            background: var;
            border: 1px solid var(--danger);
            display: none;
        }
        .loading-indicator {
            display: none;
            color: var(--text-muted);
            font-size: 0.9rem;
            margin-top: 0.5rem;
        }

/* Sidebar Styles */
.logo {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding: 20px;
}
.logo img {
    width: 140px;
    object-fit: contain;
}
.user-info {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}
.user-info .name { font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; }
.user-info .role { font-size: 0.9rem; color: var(--text-muted); }

.nav {
    flex: 1;
    overflow-y: auto;
}
.menu-item {
    padding: 13px 20px;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
}
.menu-item:hover { background: var(--hover); color: var(--text-primary); }
.menu-item i { width: 22px; text-align: center; font-size: 17px; }
.menu-item.active {
    background: var(--primary);
    color: var(--white);
    border-left: 5px solid var(--primary-light);
}
.menu-item.active i { color: var(--white); }
nav li{
    list-style: none;
}
nav li a {
    display: flex;
    align-items: center;
    width: 100%;
    color: inherit;
    text-decoration: none;
}
.menu-item .msg-badge {
    position: absolute;
    right: 20px;
}
.menu-item:hover .msg-badge {
    background: var(--danger);
}

/* New CSS for sidebar toggle and collapse */
.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
}

.sidebar {
    width: 280px; /* Default expanded width */
    transition: width 0.3s ease, transform 0.3s ease;
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: var(--shadow);
}

body.sidebar-collapsed .sidebar {
    width: 80px; /* Collapsed width */
}

body.sidebar-collapsed .sidebar .logo img {
    display: none; /* Hide logo image when collapsed */
}

body.sidebar-collapsed .sidebar .menu-item span {
    display: none; /* Hide menu item text when collapsed */
}

body.sidebar-collapsed .sidebar .section-divider {
    display: none; /* Hide section divider when collapsed */
}

body.sidebar-collapsed .sidebar .section-title {
    display: none; /* Hide section title when collapsed */
}

body.sidebar-collapsed .sidebar .theme-toggle {
    display: none; /* Hide theme toggle when collapsed */
}

body.sidebar-collapsed .sidebar .sidebar-footer {
    display: none; /* Hide footer when collapsed */
}

@media (max-width: 992px) {
    .sidebar-toggle-btn {
        display: none; /* Hide toggle button on mobile */
    }
    .sidebar .logo {
        justify-content: space-between;
    }
    .sidebar {
        width: 280px; /* Full width on mobile when active */
        transform: translateX(-100%);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    /* When mobile, we don't want desktop collapse rules to apply */
    body.sidebar-collapsed .sidebar {
        width: 280px; /* Override collapsed width for mobile */
    }
}

.msg-badge {
    margin-left: auto;
    background: var(--danger);
    color: var(--white);
    font-size: 0.7rem;
    padding: 3px 9px;
    border-radius: 50px;
    font-weight: 700;
    min-width: 22px;
}

.section-divider {
    margin: 24px 20px 12px;
    border-top: 1px solid var(--border);
    position: relative;
}
.section-title {
    position: absolute;
    top: -10px;
    left: 12px;
    background: var(--bg-primary);
    padding: 0 10px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--warning);
}

.theme-toggle {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
}
.theme-btn {
    flex: 1;
    padding: 11px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.theme-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: transparent;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.sidebar-footer span { color: var(--text-primary); font-weight: 600; }

/* Dropdown specific styles */

.dropdown-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.dropdown-toggle div{
    display: flex;
    align-items: center;
    gap: 10px;
}

.dropdown-arrow {
    transition: transform 0.2s ease;
}

.dropdown-toggle.expanded .dropdown-arrow {
    transform: rotate(90deg);
}

.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: var(--bg-secondary); /* Slightly different background for submenus */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.submenu.expanded {
    max-height: 500px; /* Adjust as needed for maximum submenu height */
    transition: max-height 0.3s ease-in;
}

.submenu .menu-item {
    padding-left: 45px; /* Indent submenu items */
    font-size: 14px;
}

body.sidebar-collapsed .has-submenu .dropdown-arrow {
    display: none;
}

body.sidebar-collapsed .submenu {
    position: absolute;
    left: 80px; /* Align with collapsed sidebar width */
    top: 0;
    background: var(--bg-primary); /* Use primary background for collapsed state popup */
    min-width: 200px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 100;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.2s ease-in-out;
    max-height: unset; /* Override max-height for collapsed state */
}

body.sidebar-collapsed .has-submenu:hover .submenu {
    visibility: visible;
    opacity: 1;
}

body.sidebar-collapsed .submenu.expanded {
    max-height: unset; /* Ensure submenu is visible */
}

body.sidebar-collapsed .submenu .menu-item span {
    display: inline; /* Show text for submenu items in collapsed state */
}

body.sidebar-collapsed .submenu .menu-item {
    padding-left: 20px; /* Reset indent for collapsed state */
}

@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
    .sidebar.active { transform: translateX(0); }
}

.search-container {
    position: relative;
    flex: 1;
    max-width: 460px;
    margin: 0 2rem;
}
.search-input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    font-size: 15px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    transition: all 0.25s ease;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}
.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 18px;
    pointer-events: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-btn {
    width: 44px; height: 44px;
    border-radius: 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 19px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-btn:hover {
    background: var(--hover);
    color: var(--text);
    border-color: transparent;
}
.icon-btn.primary {
    background: var(--primary);
    color: var(--white);
    border: none;
}
.icon-btn.primary:hover { background: var(--primary-dark); }

.notification-badge {
    position: relative;
}
.notification-badge.has-notifications::after {
    content: attr(data-count);
    position: absolute;
    top: 8px; right: 8px;
    background: var(--danger);
    color: var(--white);
    font-size: 10px;
    font-weight: 700;
    width: 18px; height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-menu {
    position: relative;
    font-size: 14px;
}
.user-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 14px;
    transition: background 0.2s;
}
.user-toggle:hover { background: var(--hover); }
.user-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    overflow: hidden;
    border: 2.5px solid var(--primary);
    box-shadow: 0 4px 12px var(--shadow);
}
.user-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.user-info {
    text-align: left;
    line-height: 1.3;
}
.user-name {
    font-weight: 600;
    font-size: 14.5px;
    color: var(--text-primary);
}
.user-role {
    font-size: 12.5px;
    color: var(--text-muted);
}
.dropdown-arrow {
    color: var(--text-muted);
    font-size: 14px;
    transition: transform 0.2s;
}
.user-menu.open .dropdown-arrow { transform: rotate(180deg); }

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0px);
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.18);
    min-width: 210px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s ease;
    z-index: 1000;
}
.user-menu.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}
.dropdown-menu a:hover { background: var(--hover); }
.dropdown-menu a:first-child { border-radius: 14px 14px 0 0; }
.dropdown-menu a:last-child { border-radius: 0 0 14px 14px; }
.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

.mobile-sidebar-toggle {
    display: none; /* Hidden by default */
}

.notification-menu {
    position: relative;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 380px; /* Slightly wider for better content display */
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.notification-menu.open .notification-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.notification-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.mark-all-read {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.notification-list {
    max-height: 400px;
    overflow-y: auto;
    flex-grow: 1;
}

.notification-item {
    display: flex;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
    cursor: pointer;
}

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

.notification-item:hover {
    background: var(--hover);
}

.notification-item.unread {
    background: var(--active-bg);
}

.notification-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    color: var(--primary);
    font-size: 18px;
    margin-right: 16px;
    flex-shrink: 0;
}

.notification-item-content {
    flex: 1;
    min-width: 0;
}

.notification-item-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-primary);
}

.notification-item-content .time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.notification-footer {
    padding: 12px;
    text-align: center;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.notification-footer a {
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
}

.no-notifications {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.no-notifications i {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
}

@media (min-width: 993px) {
    .mobile-sidebar-toggle {
        display: none; /* Hide on desktop */
    }
}

@media (max-width: 1024px) {
    .search-container {
        max-width: 320px;
        margin: 0 1rem;
    }
}

@media (max-width: 992px) {
    .mobile-sidebar-toggle {
        display: flex; /* Show on tablets and mobile */
    }
    .header .search-container {
        margin: 0;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
    }

    .search-container {
        flex: 1;
        min-width: 150px;
        max-width: none;
        margin: 0 0.5rem;
    }

    .search-input {
        padding: 10px 16px 10px 40px;
        font-size: 14px;
    }

    .search-icon {
        left: 12px;
        font-size: 16px;
    }

    .header-actions {
        gap: 8px;
    }

    .icon-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    /* User menu responsive */
    .user-toggle {
        padding: 6px 8px;
        gap: 8px;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
    }

    .user-info {
        display: none; /* Hide user name/role on mobile */
    }

    .dropdown-menu {
        min-width: 180px;
        right: 0;
    }

    /* Notification dropdown responsive for mobile */
    .notification-dropdown {
        position: fixed;
        width: 90vw;
        max-width: 400px;
        top: 65px; /* Position below header */
        left: 50%;
        right: auto;
        transform: translateX(-50%) translateY(-10px);
        max-height: calc(100vh - 80px);
    }
    .notification-menu.open .notification-dropdown {
        transform: translateX(-50%) translateY(0);
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.5rem;
    }

    .search-container {
        display: none; /* Optionally hide search on very small screens */
    }
    
    .header-actions {
        gap: 4px;
    }

    .icon-btn {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }

    .user-toggle {
        padding: 4px;
    }

    .user-avatar {
        width: 34px;
        height: 34px;
    }

    .dropdown-menu {
        min-width: 160px;
    }
    
    .notification-dropdown {
        width: calc(100vw - 1rem);
        top: 60px;
        max-height: calc(100vh - 70px);
    }

    .notification-item {
        padding: 12px;
    }

    .notification-item-icon {
        width: 36px;
        height: 36px;
        margin-right: 12px;
    }
    
    .notification-item-content p {
        font-size: 13px;
    }
    
    .notification-item-content .time {
        font-size: 11px;
    }

    .notification-footer a, .mark-all-read {
        font-size: 13px;
    }
}
