/* Global Font Definitions */
@font-face {
  font-family: 'MyFont';
  src: url('fonts/myfont.woff') format('woff');
  font-weight: 100 900; /* Enabled variable font weights */
  font-style: normal;
}

@font-face {
  font-family: 'Material Symbols Outlined';
  font-style: normal;
  font-weight: 100 700;
  src: url('fonts/material-symbols-outlined.woff2') format('woff2');
}

/* Global Body and Element Styling with Variable Font Weights */
body, html, input, textarea, select {
  font-family: 'MyFont', sans-serif !important;
  font-weight: 400; /* Regular */
  -webkit-user-select: none; /* Safari */
  -moz-user-select: none;    /* Firefox */
  -ms-user-select: none;     /* IE10+/Edge */
  user-select: none;         /* Standard */
}

button, a {
  font-family: 'MyFont', sans-serif !important;
  font-weight: 500; /* Medium */
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700; /* Bold */
}

/* Monochrome Color Palette & Theme */
.text-primary {
    color: #1f2937; /* text-gray-800 */
}
.dark .text-primary {
    color: #f9fafb; /* dark:text-gray-50 */
}

.bg-primary {
    background-color: #1f2937; /* bg-gray-800 */
}
.hover\:bg-primary-dark:hover {
    background-color: #111827; /* hover:bg-gray-900 */
}
.focus\:ring-primary:focus {
    --tw-ring-color: #9ca3af; /* focus:ring-gray-400 */
}

/* Active link in sidebar */
.nav-link.active-link {
    background-color: #f3f4f6; /* bg-gray-100 */
    color: #111827; /* text-gray-900 */
    font-weight: bold;
}
.dark .nav-link.active-link {
    background-color: #374151; /* dark:bg-gray-700 */
    color: #f9fafb; /* dark:text-gray-50 */
}

/* Active link in bottom navigation */
.nav-link-bottom.active-link-bottom {
    background-color: #eef2ff; /* indigo-100 */
    color: #4f46e5; /* indigo-600 */
    font-weight: 700; /* bold */
}
.dark .nav-link-bottom.active-link-bottom {
    background-color: #3730a3; /* indigo-800 */
    color: #a5b4fc; /* indigo-300 */
}

/* Custom styles for status tabs */
.status-tab-btn {
    border-radius: 0.5rem; /* rounded-lg */
    transition: all 0.2s ease-in-out;
}
.status-tab-btn.active-tab {
    background-color: #4f46e5; /* indigo-600 */
    color: #ffffff; /* text-white */
    font-weight: 700;
}
.dark .status-tab-btn.active-tab {
    background-color: #6366f1; /* indigo-500 */
    color: #ffffff;
}

/* Icon System */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined' !important;
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  display: inline-block;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  word-wrap: normal;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'liga';
}

/* Custom spin animation for loading icons */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.spin {
  animation: spin 1s linear infinite;
}

@media (min-width: 1024px) {
    .report-card-body {
        max-height: initial !important;
        overflow: visible !important;
    }
}

/* Utility for better user selection appearance */
.user-select-all {
    -webkit-user-select: all;
    -moz-user-select: all;
    -ms-user-select: all;
    user-select: all;
}

/* Active tab in management sidebar - Monochrome Dark Mode */
.management-tab.active-tab {
    background-color: #e5e7eb; /* bg-gray-200 */
    color: #1f2937; /* text-gray-800 */
    font-weight: bold;
}
.dark .management-tab.active-tab {
    background-color: #4b5563; /* dark:bg-gray-600 */
    color: #f9fafb; /* dark:text-gray-50 */
}

/* Safe Area Padding for general content */
.pb-safe {
  padding-bottom: calc(env(safe-area-inset-bottom, 0rem) + 5rem); /* Default to 5rem for the nav, plus iOS safe area */
}

/* Safe Area Padding specifically for the bottom nav bar itself */
.pb-safe-nav {
    padding-bottom: env(safe-area-inset-bottom, 0rem);
}

@media (min-width: 768px) {
    .pb-safe {
        padding-bottom: 1.5rem; /* Revert to default padding on larger screens */
    }
    .pb-safe-nav {
        padding-bottom: 0rem; /* No extra padding needed on desktop */
    }
}

/* --- Modal Animation Styles --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Mobile-first: align to bottom */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s; /* Delay hiding visibility */
    z-index: 50;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

.modal-content-panel {
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    max-height: 90vh;
    width: 100%;
    max-width: 42rem;
    overflow-y: auto;
    background-color: #fff;
    border-radius: 1rem 1rem 0 0; /* Rounded top for bottom sheet */
}

/* --- Comprehensive Dark Mode Modal Fixes (Monochrome & True Dark) --- */
.dark .modal-content-panel {
    background-color: #1f2937 !important; /* bg-gray-800, a bit lighter than true black */
    color: #d1d5db; /* gray-300 as a base text color */
    border: 1px solid #374151; /* Add a subtle border */
}

.dark .modal-body-content {
    color: #d1d5db; /* gray-300 */
}

.dark .modal-body-content strong {
    color: #f9fafb; /* gray-50 */
}

/* Ensure modal titles are bright white */
.dark .modal-content-panel h1,
.dark .modal-content-panel h2,
.dark .modal-content-panel h3,
.dark .modal-content-panel h4 {
    color: #f9fafb; /* gray-50 */
}

/* Monochrome link styling for modals */
.dark .modal-content-panel a {
    color: #e5e7eb; /* gray-200 */
    text-decoration: underline;
    text-decoration-color: #9ca3af; /* gray-400 */
}
.dark .modal-content-panel a:hover {
    color: #ffffff;
}

/* Fix for the close button icon color */
.dark .modal-content-panel .close-modal-btn .material-symbols-outlined {
    color: #d1d5db; /* gray-300 */
}

/* Fallback for text colors inside the modal to ensure readability */
.dark .modal-content-panel .text-gray-800,
.dark .modal-content-panel .text-gray-700,
.dark .modal-content-panel .text-gray-600,
.dark .modal-content-panel .text-gray-900 {
    color: #f9fafb !important; /* Ensure high-contrast text */
}
.dark .modal-content-panel .text-gray-500 {
    color: #9ca3af !important;
}

/* Improved fallback for form element styling */
.dark .modal-content-panel input,
.dark .modal-content-panel select,
.dark .modal-content-panel textarea {
    background-color: #1f2937 !important; /* bg-gray-800 */
    color: #f3f4f6 !important; /* text-gray-100 */
    border-color: #4b5563 !important; /* border-gray-600 */
}

.dark .modal-content-panel input::placeholder,
.dark .modal-content-panel textarea::placeholder {
    color: #6b7280; /* gray-500 */
}

/* --- Specific Inner Modal Styling for Dark Mode --- */
.dark .modal-body-content .bg-gray-100 {
    background-color: #2d3748 !important; /* Slightly lighter gray */
    border: 1px solid #4a5568 !important; /* Subtle border */
}

.dark .modal-body-content .p-2,
.dark .modal-body-content .p-4 {
    border: 1px solid #4a5568;
    border-radius: 8px;
}

.modal-overlay.active .modal-content-panel {
    transform: translateY(0);
}

/* Desktop-specific adjustments */
@media (min-width: 768px) {
    .modal-overlay {
        align-items: center; /* Center vertically */
    }
    .modal-content-panel {
        transform: translateY(2rem) scale(0.95);
        opacity: 0;
        transition: transform 0.3s ease, opacity 0.3s ease;
        border-radius: 0.75rem; /* Fully rounded for centered modal */
        max-width: 32rem; /* A more standard modal width */
    }
    .modal-overlay.active .modal-content-panel {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* --- Responsive User/Team Management List --- */
@media (max-width: 767px) {
    .management-list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem; /* 12px */
    }
    .management-list-item .item-details {
        margin-bottom: 0.5rem; /* 8px */
    }
    .management-list-item .item-actions {
        width: 100%;
        justify-content: flex-end;
        border-top: 1px solid #e5e7eb; /* border-gray-200 */
        padding-top: 0.75rem; /* 12px */
    }
    .dark .management-list-item .item-actions {
        border-top-color: #374151; /* dark:border-gray-700 */
    }
}

/* Progress bar for buttons */
.progress-bar-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: transparent;
    border-radius: inherit;
    overflow: hidden;
}

.progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background-color: rgba(255, 255, 255, 0.3);
    animation: progress-animation 1.5s infinite linear;
    border-radius: inherit;
}

@keyframes progress-animation {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* --- New Modern Report Card Styles --- */
.report-card {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: none; /* Enforce flat design */
    border: 1px solid #e5e7eb; /* Subtle border for light mode */
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer;
    user-select: none;
}

.dark .report-card {
    background-color: #1f2937; /* A very dark gray */
    border-color: #374151; /* Darker border for dark mode */
}

.report-card:hover {
    transform: scale(1.01);
    border-color: #d1d5db;
}

.dark .report-card:hover {
    border-color: #4b5563;
}

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-picture {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.username {
    font-weight: 500; /* Medium */
    color: #111827;
}

.dark .username {
    color: #f9fafb;
}

.card-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    cursor: pointer;
    accent-color: #4f46e5; /* indigo-600 */
}

/* Card Body */
.card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-badge {
    align-self: flex-start;
    background-color: #eef2ff; /* indigo-100 */
    color: #4f46e5; /* indigo-600 */
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
}

.dark .category-badge {
    background-color: #3730a3;
    color: #e0e7ff;
}

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

.instagram-link {
    display: inline-block;
    transition: transform 0.2s;
}
.instagram-link:hover {
    transform: scale(1.1);
}

.identity-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
}
.dark .identity-info-grid {
    border: 1px solid #4a5568; /* A subtle border */
    padding: 8px; /* Add some padding */
    border-radius: 8px; /* Rounded corners */
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #4b5563;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dark .info-item {
    color: #9ca3af;
}

.info-item .material-symbols-outlined {
    font-size: 18px;
    color: #6b7280;
}

.dark .info-item .material-symbols-outlined {
    color: #9ca3af;
}

/* Card Footer */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f3f4f6;
    padding-top: 12px;
}

.dark .card-footer {
    border-top-color: #374151;
}

/* --- Custom Status Dropdown --- */
.status-dropdown {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #f3f4f6; /* gray-100 */
    border: 1px solid #e5e7eb; /* gray-200 */
    border-radius: 8px;
    padding: 8px 32px 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #374151; /* gray-700 */
    outline: none;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
}

.dark .status-dropdown {
    background-color: #374151; /* gray-700 */
    border-color: #4b5563; /* gray-600 */
    color: #f9fafb; /* gray-50 */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

.status-dropdown:hover {
    border-color: #d1d5db; /* gray-300 */
}

.dark .status-dropdown:hover {
    border-color: #6b7280; /* gray-500 */
}

.status-dropdown:focus {
    border-color: #4f46e5; /* indigo-600 */
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.3);
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
    color: #4b5563;
}

.dark .action-btn {
    color: #9ca3af;
}

.action-btn:hover {
    background-color: #f3f4f6;
}

.dark .action-btn:hover {
    background-color: #374151;
}

/* --- Modal Tab Styles --- */
.modal-tab-btn {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border: none;
    background-color: transparent;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease-in-out;
    color: #6b7280; /* gray-500 */
    font-weight: 500;
}

.dark .modal-tab-btn {
    color: #9ca3af; /* dark:gray-400 */
}

.modal-tab-btn.active-tab {
    color: #4f46e5; /* indigo-600 */
    border-bottom-color: #4f46e5;
    font-weight: 700;
}

.dark .modal-tab-btn.active-tab {
    color: #a5b4fc; /* indigo-300 */
    border-bottom-color: #a5b4fc;
}

/* --- Lightbox Stacking Fix --- */
#lightbox {
    z-index: 60 !important;
}

.action-btn .material-symbols-outlined {
    font-size: 20px;
}

/* --- Advanced Interactive Card Styles --- */

/* General clickable elements */
.clickable-avatar, .clickable-username, .clickable-page-id, .copy-btn, .attachment-item, .clickable-reporter {
    cursor: pointer;
    transition: filter 0.2s, color 0.2s, background-color 0.2s;
}
.clickable-avatar:hover {
    filter: brightness(1.1);
}
.clickable-username:hover, .clickable-reporter:hover {
    text-decoration: underline;
    color: #4f46e5;
}
.dark .clickable-username:hover, .dark .clickable-reporter:hover {
    color: #a5b4fc;
}

/* Description Section */
.description-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background-color: #f9fafb;
    padding: 8px 12px;
    border-radius: 8px;
}
.dark .description-section {
    background-color: #2d3748; /* A slightly lighter gray */
    border: 1px solid #4a5568; /* A subtle border */
}

.description-text {
    font-size: 13px;
    color: #4b5563;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dark .description-text {
    color: #d1d5db;
}

.copy-btn {
    background: none;
    border: none;
    color: #6b7280;
    padding: 4px;
    border-radius: 50%;
}
.dark .copy-btn {
    color: #9ca3af;
}
.copy-btn:hover {
    background-color: #e5e7eb;
}
.dark .copy-btn:hover {
    background-color: #374151;
}
.copy-btn .material-symbols-outlined {
    font-size: 18px;
}

/* Attachments Section */
.attachments-section {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid #f3f4f6;
}
.dark .attachments-section {
    border-top-color: #374151;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #f3f4f6;
    padding: 6px 10px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
}
.dark .attachment-item {
    background-color: #374151;
    color: #d1d5db;
}
.attachment-item:hover {
    background-color: #e5e7eb;
}
.dark .attachment-item:hover {
    background-color: #4b5563;
}
.attachment-item .material-symbols-outlined {
    font-size: 16px;
}

/* --- V2 Design System: Unified Header & Bottom Navigation --- */

/* Unified Header */
.header-v2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    height: 4.5rem; /* 72px */
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 30;
}
.dark .header-v2 {
    background-color: #111827; /* Darker than body */
    border-bottom-color: #374151;
}

.header-v2 .title {
    font-size: 1.25rem; /* 20px */
    font-weight: 700;
    color: #111827;
}
.dark .header-v2 .title {
    color: #f9fafb;
}

.header-v2 .action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: #4b5563;
    transition: background-color 0.2s;
}
.dark .header-v2 .action-btn {
    color: #9ca3af;
}
.header-v2 .action-btn:hover {
    background-color: #f3f4f6;
}
.dark .header-v2 .action-btn:hover {
    background-color: #374151;
}

/* V2 Bottom Navigation Bar */
.bottom-nav-v2 {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 5rem; /* 80px, reduced from 5.5rem */
    background-color: #ffffff;
    border-top: 1px solid #e5e7eb;
    padding-bottom: env(safe-area-inset-bottom, 0rem);
    z-index: 40;
    transition: background-color 0.3s, border-color 0.3s;
}
.dark .bottom-nav-v2 {
    background-color: #1f2937;
    border-top-color: #374151;
}

.nav-item-v2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: #6b7280; /* text-gray-500 */
    text-decoration: none;
    transition: color 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}
.dark .nav-item-v2 {
    color: #9ca3af; /* dark:text-gray-400 */
}

.nav-item-v2 .icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 2rem;
    border-radius: 1rem;
    transition: background-color 0.3s ease;
}

.nav-item-v2 .icon {
    font-size: 24px;
    transition: color 0.3s ease;
    color: #6b7280; /* text-gray-500 */
}
.dark .nav-item-v2 .icon {
    color: #9ca3af; /* dark:text-gray-400 */
}

.nav-item-v2 .label {
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 4px;
    transition: color 0.3s ease;
}

/* Active State with Purple Theme */
.nav-item-v2.active .icon-container {
    background-color: #eef2ff; /* indigo-100 */
}
.dark .nav-item-v2.active .icon-container {
    background-color: #3730a3; /* indigo-800 */
}

.nav-item-v2.active .icon {
    color: #4f46e5; /* indigo-600 */
}
.dark .nav-item-v2.active .icon {
    color: #a5b4fc; /* indigo-300 */
}

.nav-item-v2.active .label {
    color: #4f46e5; /* indigo-600 */
    font-weight: 700;
}
.dark .nav-item-v2.active .label {
    color: #a5b4fc; /* indigo-300 */
}

/* --- Styles moved from dashboard.php --- */

/* Custom styles for the dashboard */
.bottom-nav {
}

/* Ensure the main content area is scrollable */
.main-content-area {
    height: calc(100vh - 68px); /* Full height minus header */
}

/* Unified button styles for filters */
.sort-btn, .status-btn {
    background-color: #f3f4f6; /* bg-gray-100 */
    color: #1f2937; /* text-gray-800 */
}
.dark .sort-btn, .dark .status-btn {
    background-color: #374151; /* dark:bg-gray-700 */
    color: #f9fafb; /* dark:text-gray-100 */
}
.sort-btn:hover, .status-btn:hover {
    background-color: #e5e7eb; /* bg-gray-200 */
}
.dark .sort-btn:hover, .dark .status-btn:hover {
    background-color: #4b5563; /* dark:bg-gray-600 */
}

/* Active filter style */
.active-filter {
    background-color: #4f46e5 !important; /* bg-indigo-600 */
    color: #ffffff !important; /* text-white */
    font-weight: 600;
}
.dark .active-filter {
     background-color: #6366f1 !important; /* dark:bg-indigo-500 */
}