/*
 * This is a manifest file that'll be compiled into application.tailwind.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *
 *= require_tree .
 *= require_self
 */

 @tailwind base;
 @tailwind components;
 @tailwind utilities;
 @plugin "daisyui";
 
 /* Dialog styles */
 dialog {
   position: fixed;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   width: 100%;
   height: 100%;
   padding: 0;
   margin: 0;
   border: none;
   background-color: transparent;
   overflow: auto;
   z-index: 50;
 }
 
 dialog::backdrop {
   background-color: rgba(0, 0, 0, 0.5);
 }
 
 /* Button styles */
 .btn {
   @apply inline-flex items-center justify-center px-4 py-2 rounded-md font-medium focus:outline-none focus:ring-2 focus:ring-offset-2 transition-all duration-200;
   text-decoration: none !important;
 }
 
 .btn:hover {
   transform: translateY(-1px);
   box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
 }
 
 .btn-primary {
   @apply bg-primary text-gray-700 hover:bg-primary/85 focus:ring-primary/50;
 }
 
 .btn-secondary {
   @apply bg-gray-500 text-white hover:bg-gray-600 focus:ring-gray-400;
 }
 
 .btn-danger {
   @apply bg-red-600 text-white hover:bg-red-700 focus:ring-red-500;
 }
 
 .btn-sm {
   @apply px-3 py-1 text-sm;
 }
 
 /* Form styles */
 .form-group {
   @apply mb-4;
 }
 
 .form-label {
   @apply block text-sm font-medium text-gray-700 mb-1;
 }
 
 .form-control {
   @apply block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm text-gray-700 focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary focus:bg-primary/10;
 }
 
 /* Card styles */
 .card {
   @apply bg-white rounded-lg shadow-md overflow-hidden;
 }
 
 .card-header {
   @apply px-4 py-3 border-b border-gray-200 bg-gray-50 flex justify-between items-center;
 }
 
 .card-body {
   @apply p-4;
 }
 
 /* Table styles */
 .table-container {
   @apply overflow-x-auto rounded-lg shadow-md;
 }
 
 .table {
   @apply min-w-full divide-y divide-gray-200;
 }
 
 .table thead {
   @apply bg-gray-50;
 }
 
 .table th {
   @apply px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider;
 }
 
 .table tbody {
   @apply bg-white divide-y divide-gray-200;
 }
 
 .table td {
   @apply px-6 py-4 whitespace-nowrap text-sm text-gray-500;
 }
 
 /* Badge styles */
 .badge {
   @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
 }
 
 .badge-income {
   @apply bg-green-100 text-green-800;
 }
 
 .badge-expense {
   @apply bg-red-100 text-red-800;
 }
 
 .badge-system {
   @apply bg-blue-100 text-blue-800;
 }
 
 .badge-custom {
   @apply bg-green-100 text-green-800;
 }
 
 .badge-global {
   @apply bg-blue-100 text-blue-800;
 }
 
 .badge-personal {
   @apply bg-amber-100 text-amber-800;
 }
 
 .badge-primary {
   @apply bg-indigo-100 text-indigo-800;
 }
 
 .badge-neutral {
   @apply bg-gray-100 text-gray-800;
 }
 
 /* Sidebar styles */
 .sidebar {
   @apply fixed inset-y-0 left-0 w-64 bg-gray-800 text-white transition-all duration-300 ease-in-out z-10;
 }
 
 .sidebar-collapsed {
   @apply w-16;
 }
 
 .sidebar-header {
   @apply p-4 border-b border-gray-700;
 }
 
 .sidebar-user {
   @apply p-4 flex items-center border-b border-gray-700;
 }
 
 .sidebar-nav {
   @apply mt-2;
 }
 
 .sidebar-nav-item {
   @apply flex items-center px-4 py-3 text-gray-300 hover:bg-gray-700 hover:text-white transition-colors;
 }
 
 .sidebar-nav-item.active {
   @apply bg-primary text-gray-700;
 }
 
 /* User dropdown menu styling */
 [data-controller="dropdown"] {
   position: relative;
   z-index: 100;
 }
 
 [data-dropdown-target="menu"] {
   z-index: 100;
   position: absolute;
   transform-origin: top right;
   box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
 }
 
 /* Main content styles */
 .main-content {
   @apply transition-all duration-300 ease-in-out;
 }
 
 .main-content-with-sidebar {
   @apply ml-64;
 }
 
 .main-content-with-sidebar-collapsed {
   @apply ml-16;
 }
 
 /* Improved styling for all buttons with icons */
 a, button {
   text-decoration: none !important;
 }
 
 .inline-flex.items-center {
   display: inline-flex;
   align-items: center;
   text-decoration: none !important;
   transition: all 0.2s ease;
 }
 
 .inline-flex.items-center:hover {
   transform: translateY(-1px);
   box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
 }
 
 /* Icon buttons in tables and lists */
 .text-blue-600, .text-red-600, .text-primary {
   transition: all 0.2s ease;
 }
 
 .text-blue-600:hover, .text-red-600:hover, .text-primary:hover {
   transform: translateY(-1px);
   filter: brightness(0.9);
 }
 
 /* Dialog styles */
 dialog {
   padding: 0;
   border: none;
   border-radius: 0.5rem;
   box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
   max-width: 32rem;
   width: 100%;
 }
 
 dialog::backdrop {
   background-color: rgba(0, 0, 0, 0.5);
   backdrop-filter: blur(2px);
 }
 
 dialog[open] {
   animation: dialog-show 0.3s ease normal;
 }
 
 dialog.closing {
   animation: dialog-hide 0.3s ease normal;
 }
 
 @keyframes dialog-show {
   from {
     opacity: 0;
     transform: translateY(-10px);
   }
   to {
     opacity: 1;
     transform: translateY(0);
   }
 }
 
 @keyframes dialog-hide {
   from {
     opacity: 1;
     transform: translateY(0);
   }
   to {
     opacity: 0;
     transform: translateY(-10px);
   }
 }
 
 body {
   font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
 }
 h1, h2, h3, h4, h5, h6 {
   font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
   font-weight: 700;
 }
 .font-heading {
   font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
 }
 /* Sidebar styling fixes */
 .no-underline, .no-underline:hover, .no-underline:focus {
   text-decoration: none !important;
 }
 nav ul {
   list-style-type: none !important;
   padding: 0 !important;
   margin: 0 !important;
 }
 nav ul li {
   margin: 0 !important;
   padding: 0 !important;
 }
 
 /* Modal dropdown fixes */
 .z-60 {
   z-index: 60 !important;
 }
 
 .z-70 {
   z-index: 70 !important;
 }
 
 .z-80 {
   z-index: 80 !important;
 }
 
 .z-85 {
   z-index: 85 !important;
 }
 
 /* Make sure modal content is interactive */
 #modal select,
 #modal button,
 #modal input[type="submit"] {
   pointer-events: auto !important;
   cursor: pointer !important;
   position: relative !important;
 }
 
 #modal form {
   pointer-events: auto !important;
 }
 
 /* Ensure form elements appear above backdrop */
 [data-modal-backdrop] {
   pointer-events: none !important;
 }
 
 /* Make sure dialogs are above backdrop */
 #modal .inline-block.align-bottom,
 #modal .inline-block.align-bottom.bg-white,
 #modal .bg-white {
   z-index: 9500 !important;
   position: relative !important;
   pointer-events: auto !important;
 }
 
 /* Fix dialog positioning */
 dialog {
   position: fixed !important;
   top: 50% !important;
   transform: translateY(-50%) !important;
   margin: auto !important;
   max-height: 90vh !important;
   max-width: 500px !important;
   width: auto !important;
   border: none !important;
   border-radius: 8px !important;
   box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08) !important;
   z-index: 9999 !important;
   padding: 0 !important;
 }
 
 /* Add specific sizing for confirmation dialogs */
 dialog.confirm-dialog,
 dialog[id^="delete-transaction-dialog"] {
   max-width: 400px !important;
   width: 95% !important;
 }
 
 dialog::backdrop {
   background-color: rgba(0, 0, 0, 0.5) !important;
 }
 
 /* Ensure dropdown options appear above backdrop */
 select {
   position: relative;
 }
 
 select option {
   position: relative;
   z-index: 70;
 }
 
 /* Ensure sidebar stays behind the modal */
 .sidebar, #mobile-sidebar {
   z-index: 10 !important;
 }
 
 /* Override pointer-events for modal elements */
 #modal.pointer-events-none,
 #modal .pointer-events-none {
   pointer-events: none !important;
 }
 
 #modal.pointer-events-auto,
 #modal .pointer-events-auto,
 #modal button,
 #modal select,
 #modal input,
 #modal form,
 #modal .inline-block,
 #modal .sm\:flex-row-reverse {
   pointer-events: auto !important;
 }
 
 /* Mobile sidebar styles */
 @media (max-width: 767px) {
   .sidebar-mobile-hidden {
     transform: translateX(-100%);
   }
   .sidebar-mobile-visible {
     transform: translateX(0);
   }
   .ml-64 {
     margin-left: 0 !important;
   }
 }
 
 /* Responsive design mode specific styles */
 body.in-responsive-mode #mobile-sidebar {
   display: block !important;
   transform: translateX(-100%);
 }
 
 body.in-responsive-mode #mobile-sidebar.sidebar-mobile-visible {
   transform: translateX(0) !important;
 }
 
 /* Fix for Safari and Firefox */
 @media screen and (max-width: 767px) {
   #mobile-sidebar {
     width: 16rem !important;
     left: 0 !important;
     transform: translateX(-100%) !important;
     transition: transform 0.3s ease-in-out !important;
   }
   
   #mobile-sidebar.sidebar-mobile-visible {
     transform: translateX(0) !important;
   }
   
   .md\:ml-64 {
     margin-left: 0 !important;
   }
 }
 
 /* Fix modal interactions */
 #modal {
   isolation: isolate;
   position: fixed !important;
   z-index: 9999 !important;
 }
 
 /* Ensure backdrop stays below dialog */
 [data-modal-backdrop],
 #modal .fixed.inset-0.bg-gray-500,
 #modal .fixed.inset-0.bg-gray-500.bg-opacity-75 {
   z-index: 9000 !important;
   pointer-events: none !important;
 }

/* Custom components can be added below */
@layer components {
  .btn-primary {
    @apply py-2 px-4 bg-primary text-gray-700 hover:bg-primary/85 focus:ring-primary/50 rounded-md;
  }
  .btn-secondary {
    @apply py-2 px-4 bg-gray-500 text-white hover:bg-gray-600 focus:ring-gray-400 rounded-md;
  }
  .btn-danger {
    @apply py-2 px-4 bg-red-600 text-white hover:bg-red-700 focus:ring-red-500 rounded-md;
  }
}

/* Custom focus ring overrides */
*:focus-visible {
  @apply outline-none ring-2 ring-primary/50 ring-offset-1;
}

input:focus, textarea:focus, select:focus {
  @apply border-primary ring-2 ring-primary/50 outline-none bg-primary/10;
}

/* Form control override to ensure consistent styling */
.form-control:focus {
  @apply border-primary ring-2 ring-primary/50 bg-primary/10;
}

/* Select field styling */
select {
  @apply appearance-none rounded-md border border-gray-300 px-3 py-2 bg-white text-gray-700 shadow-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/50 focus:bg-primary/10;
}

/* Ensure form inputs in various contexts get the same focus styling */
[type='text']:focus,
[type='email']:focus,
[type='url']:focus,
[type='password']:focus,
[type='number']:focus,
[type='date']:focus,
[type='datetime-local']:focus,
[type='month']:focus,
[type='search']:focus,
[type='tel']:focus,
[type='time']:focus,
[type='week']:focus,
[multiple]:focus,
textarea:focus,
select:focus {
  @apply border-primary ring-2 ring-primary/50 bg-primary/10 text-gray-700;
}

/* Add base styles to override Tailwind Forms plugin defaults */
@layer base {
  [type='text'],
  [type='email'],
  [type='url'],
  [type='password'],
  [type='number'],
  [type='date'],
  [type='datetime-local'],
  [type='month'],
  [type='search'],
  [type='tel'],
  [type='time'],
  [type='week'],
  [multiple],
  textarea,
  select {
    @apply text-gray-700 focus:border-primary focus:ring-primary/50;
  }
  
  [type='checkbox'],
  [type='radio'] {
    @apply border-gray-300 text-primary focus:ring-primary/50;
  }
}

/* Placeholder styling */
::placeholder {
  @apply text-gray-400;
}

/* Input styling */
input, textarea, select {
  @apply text-gray-700;
}

/* Landing page styles */
html {
  overflow-x: hidden;
  max-width: 100%;
}

/* Prose content text color fixes */
.prose {
  color: #111827 !important;
}
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  color: #111827 !important;
}
.prose p, .prose ul, .prose ol, .prose li {
  color: #111827 !important;
}
.prose strong {
  color: #111827 !important;
}
.prose a {
  color: #1F30C2 !important;
}

/* Responsive fixes */
@media (max-width: 640px) {
  /* Prevent content overflow on small screens */
  .overflow-x-hidden {
    overflow-x: hidden;
  }
  
  /* Improve image scaling on small screens */
  img {
    max-width: 100%;
    height: auto;
  }
  
  /* Improve button layout on small screens */
  .flex-col {
    row-gap: 0.75rem;
  }
  
  /* Ensure mobile menu doesn't overflow */
  #mobile-menu {
    max-height: 80vh;
    overflow-y: auto;
  }
}

/* Global overflow fixes */
.max-w-7xl {
  max-width: 100%;
  box-sizing: border-box;
}

section {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.container-fluid {
  width: 100%;
  padding-right: 1rem;
  padding-left: 1rem;
  margin-right: auto;
  margin-left: auto;
  overflow-x: hidden;
}

/* Fix for header dropdown on landing page */
header .dropdown-menu {
  z-index: 100 !important;
}

/* Mobile dropdown menu fixes */
@media (max-width: 767px) {
  [data-controller="dropdown"] {
    position: static;
  }
  
  [data-dropdown-target="menu"] {
    position: absolute;
    top: auto;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    margin-top: 0.5rem;
  }
}

/* Make sure dropdown is always on top regardless of screen size */
#mobile-menu {
  z-index: 100;
}