/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

@import url("https://cdn.jsdelivr.net/npm/intl-tel-input@25.11.3/build/css/intlTelInput.css");

/*@import "https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/css/tom-select.css";*/

/*div[drawer-backdrop] {
    z-index: 1004;
}*/
img {
    color: transparent; /* Makes the text transparent */
    font-size: 0;       /* Makes the text size zero */
}

/* Notification bell swing animation */
@keyframes bell-swing {
  0%, 100% { transform: rotate(0deg); }
  15% { transform: rotate(12deg); }
  30% { transform: rotate(-10deg); }
  45% { transform: rotate(6deg); }
  60% { transform: rotate(-4deg); }
  75% { transform: rotate(2deg); }
}
.animate-bell {
  animation: bell-swing 2s ease-in-out infinite;
  transform-origin: top center;
}

/* Turbo Progress Bar - Use brand color */
.turbo-progress-bar {
    background-color: var(--color-brand) !important;
    height: 3px;
}

/* V3 layout: filter bars use sticky top-16 (designed for v1/v2 fixed navbar).
   In v3, the scroll container already starts below the navbar, so reset to 0. */
body[data-layout="v3"] .sticky.top-16 {
    top: 0;
}


/* V3 sidebar: HubSpot-style square icon tiles when collapsed.
   Targets ONLY the top-level nav item links/buttons (direct children of the
   scroll area's <ul>), plus the collapse-toggle button. Excludes flyout
   dropdown items which live inside [data-sidebar-flyout-target="menu"]. */
html[data-sidebar-v3-state="collapsed"] aside[data-sidebar-v3-target="sidebar"] nav > div > ul > li > a,
html[data-sidebar-v3-state="collapsed"] aside[data-sidebar-v3-target="sidebar"] nav > div > ul > li > button,
html[data-sidebar-v3-state="collapsed"] aside[data-sidebar-v3-target="sidebar"] > div:last-child > button {
    width: 2.25rem;       /* w-9 */
    height: 2.25rem;      /* h-9 */
    margin-left: auto;
    margin-right: auto;
    padding: 0;
    gap: 0;
    justify-content: center;
    border-left-width: 0;
    border-right-width: 0;
}

/* ===========================================================================
   V3 sidebar FOUC prevention — driven by data-sidebar-v3-state on <html>
   set by an inline <head> script before first paint. The Stimulus controller
   continues to manage state via class toggles AND the data attribute.
   =========================================================================== */

/* Sidebar width based on state */
html[data-sidebar-v3-state="collapsed"] aside[data-sidebar-v3-target="sidebar"] {
    width: 4rem;  /* w-16 */
}
html[data-sidebar-v3-state="expanded"] aside[data-sidebar-v3-target="sidebar"] {
    width: 14rem;  /* w-56 */
}

/* Labels hidden when collapsed */
html[data-sidebar-v3-state="collapsed"] aside[data-sidebar-v3-target="sidebar"] [data-sidebar-v3-target="label"] {
    display: none;
}

/* Logo swap based on state */
html[data-sidebar-v3-state="collapsed"] aside[data-sidebar-v3-target="sidebar"] [data-sidebar-v3-target="fullLogo"] {
    display: none;
}
html[data-sidebar-v3-state="expanded"] aside[data-sidebar-v3-target="sidebar"] [data-sidebar-v3-target="iconLogo"] {
    display: none;
}

/* Collapse-toggle button icon swap */
html[data-sidebar-v3-state="collapsed"] aside[data-sidebar-v3-target="sidebar"] [data-sidebar-v3-target="collapseIcon"] {
    display: none;
}
html[data-sidebar-v3-state="expanded"] aside[data-sidebar-v3-target="sidebar"] [data-sidebar-v3-target="expandIcon"] {
    display: none;
}

/* ===========================================================================
   V1 sidebar FOUC prevention — driven by data-sidebar-v1-state on <html>
   set by an inline <head> script before first paint.
   =========================================================================== */

/* Smooth main-content margin transition to match sidebar collapse/expand */
@media (min-width: 1024px) {
    #main-content {
        transition: margin-left 200ms ease-in-out, margin-inline-start 200ms ease-in-out;
    }
}

/* Sidebar width based on state */
html[data-sidebar-v1-state="collapsed"] aside#sidebar {
    width: 4rem;  /* w-16 */
}
html[data-sidebar-v1-state="expanded"] aside#sidebar {
    width: 16rem;  /* w-64 */
}

/* Main content margin to match sidebar width */
@media (min-width: 1024px) {
    html[data-sidebar-v1-state="collapsed"] #main-content {
        margin-left: 4rem;
        margin-right: 0;
    }
    html[data-sidebar-v1-state="expanded"] #main-content {
        margin-inline-start: 16rem;
        margin-inline-end: 0;
    }
}

/* Collapsible elements (labels, headings inside expanded sidebar) hidden when collapsed */
html[data-sidebar-v1-state="collapsed"] aside#sidebar [data-sidebar-collapse-hide] {
    display: none;
}

/* Subitem left-padding only when expanded */
html[data-sidebar-v1-state="collapsed"] aside#sidebar [data-sidebar-collapse-subitem] {
    padding-left: 0;
}

/* Toggle button icon swap — uses saved-state (not hover-state) to prevent
   icon flicker during hover-to-expand. Set by JS and FOUC <head> script. */
html[data-sidebar-v1-saved="collapsed"] [data-sidebar-target="collapseIcon"] {
    display: none;
}
html[data-sidebar-v1-saved="expanded"] [data-sidebar-target="expandIcon"] {
    display: none;
}

/* Classic theme: preserve toast notification rounding
   (must be in application.css, not theme-classic.css, to escape Tailwind's layer cascade) */
[data-theme="classic"] [role="alert"] {
    border-radius: 0.5rem !important;
}
[data-theme="classic"] [role="alert"] .rounded-lg {
    border-radius: 0.5rem !important;
}

/* Prevent badges in datatables from wrapping to two lines */
table td .inline-flex.rounded {
    white-space: nowrap;
}

/* Search input in dropdown - text size for both themes */
.iti__search-input {
    font-size: 0.875rem !important; /* text-sm to match Tom Select */
}

/* No results message - text size for both themes */
.iti__no-results {
    font-size: 0.875rem !important; /* text-sm */
    padding: 0.5rem 0.75rem !important; /* py-2 px-3 */
    text-align: center;
}

/* Individual country items - base style */
.iti__country {
    font-size: 0.875rem; /* text-sm to match Tom Select */
    padding: 0.5rem 0.75rem; /* py-2 px-3 to match Tom Select */
}

/* Custom color for intl-tel-input */
.dark .iti__flag.iti__globe {
    filter: invert(1) brightness(0.8);
}

/* intl-tel-input Dark Mode Styles */

/* Main input wrapper */
.dark .iti {
    display: block;
    width: 100%;
}

/* Selected flag button (country selector) */
.dark .iti__selected-flag {
    background-color: rgb(55 65 81); /* dark:bg-gray-700 */
    border-color: rgb(75 85 99); /* dark:border-gray-600 */
    color: rgb(255 255 255); /* dark:text-white */
}

.dark .iti__selected-flag:hover {
    background-color: rgb(75 85 99); /* dark:hover:bg-gray-600 */
}

/* Arrow icon in the flag selector */
.dark .iti__arrow {
    border-top-color: rgb(156 163 175); /* dark:text-gray-400 */
}

/* Dropdown container */
.dark .iti__dropdown {
    background-color: rgb(55 65 81); /* dark:bg-gray-700 */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.dark .iti--inline-dropdown .iti__dropdown-content {
    border: 1px solid rgb(75 85 99) !important; /* dark:border-gray-600 */
    border-radius: 0.5rem !important; /* rounded-lg */
}

/* Country list */
.dark .iti__country-list {
    background-color: rgb(55 65 81); /* dark:bg-gray-700 */
}

.dark .iti__country.iti__highlight {
    background-color: rgb(75 85 99) !important; /* bg-gray-600 */
}

.dark .iti__country.iti__highlight .iti__country-name,
.dark .iti__country.iti__highlight .iti__dial-code {
    color: rgb(96 165 250) !important; /* text-blue-400 */
}

.dark .iti__country:hover .iti__country-name,
.dark .iti__country:hover .iti__dial-code {
    color: rgb(96 165 250) !important; /* text-blue-400 */
}

/* Individual country items - base style */
.dark .iti__country {
    color: rgb(229 231 235); /* gray-200 - default text color */
}

/* Hover state - gray background with blue text (matches Tom Select) */
.dark .iti__country:hover {
    background-color: rgb(75 85 99); /* bg-gray-600 - exact match to Tom Select */
    color: rgb(96 165 250); /* text-blue-400 */
}

/* Highlighted (keyboard navigation) - same as hover */
.dark .iti__country.iti__highlight {
    background-color: rgb(75 85 99) !important; /* bg-gray-600 */
    color: rgb(96 165 250) !important; /* text-blue-400 - force override */
}

/* Selected/active country - blue background (currently selected country) */
.dark .iti__country.iti__active {
    background-color: rgb(37 99 235); /* bg-blue-600 - solid blue for selected */
    color: rgb(255 255 255); /* text-white */
}

/* Preferred countries divider */
.dark .iti__divider {
    border-bottom-color: rgb(75 85 99); /* dark:border-gray-600 */
}

/* Search input in dropdown */
.dark .iti__search-input {
    background-color: rgb(55 65 81); /* dark:bg-gray-700 */
    border: 1px solid rgb(75 85 99); /* dark:border-gray-600 */
    color: rgb(255 255 255); /* dark:text-white */
}

.dark .iti__search-input::placeholder {
    color: rgb(156 163 175); /* dark:placeholder-gray-400 */
}

.dark .iti__search-input:focus {
    border-color: rgb(59 130 246); /* dark:focus:border-blue-500 */
    outline: none;
    ring: 2px;
    ring-color: rgb(59 130 246); /* dark:focus:ring-blue-500 */
}

/* Dial code text */
.dark .iti__selected-dial-code {
    color: rgb(255 255 255); /* dark:text-white */
}

/* Country name in list */
.dark .iti__country-name {
    color: rgb(255 255 255); /* dark:text-white */
}

/* Dial code in list */
.dark .iti__dial-code {
    color: rgb(156 163 175); /* dark:text-gray-400 */
}

/* No results message - dark mode colors */
.dark .iti__no-results {
    background-color: rgb(55 65 81) !important; /* dark:bg-gray-700 */
    color: rgb(156 163 175) !important; /* dark:text-gray-400 */
}


.simple-icon, .simple-icon * {
    fill: currentColor;
    stroke: currentColor;
}

/* Custom Colors for Icons */
.icon-whatsapp   { color: #25D366; }
.icon-telegram   { color: #0088CC; }
.icon-viber      { color: #665CAC; }
.icon-zalo       { color: #0068FF; }
.icon-kakaotalk  { color: #FFCD00; }
.icon-instagram  { color: #E4405F; }
.icon-youtube    { color: #FF0000; }
.icon-x          { color: #000000; }
.icon-linkedin   { color: #0A66C2; }

.dark .icon-whatsapp   { color: #51e88b; }
.dark .icon-telegram   { color: #33aaff; }
.dark .icon-viber      { color: #9b8be3; }
.dark .icon-zalo       { color: #4c8fff; }
.dark .icon-kakaotalk  { color: #ffe766; }
.dark .icon-instagram  { color: #ff6a85; }
.dark .icon-youtube    { color: #ff5c5c; }
.dark .icon-x          { color: #ffffff; }
.dark .icon-linkedin   { color: #3a8df0; }

/* Custom Cropper Modal Styles */
.crop-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.crop-modal-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.9);
}

.crop-image-wrapper {
    max-height: 70vh;
    max-width: 90vw;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crop-image-wrapper img {
    max-width: 100%;
    max-height: 70vh;
    display: block;
}

.cropper-point {
    width: 8px !important;
    height: 8px !important;
    opacity: 0.9 !important;
}

.cropper-point.point-se {
    width: 8px !important;
    height: 8px !important;
}

/* Hide disabled today button */
button.today-btn[disabled] {
    visibility: hidden !important;
}


/* FilePond styles moved to app/assets/tailwind/filepond.css */
/* Lexical editor styles moved to app/assets/tailwind/lexical.css */


/* Leaflet GeoSearch - Wider search box only */
.leaflet-geosearch-bar {
    width: 600px !important;
}

.leaflet-geosearch-bar.hidden {
    display: none;
}

@media (max-width: 640px) {
    .leaflet-geosearch-bar {
        width: calc(100vw - 40px) !important;
        min-width: 250px !important;
    }
}

/* Enhanced GeoSearch Input - Prominent yellow for visibility in both themes */
.leaflet-control-geosearch input {
    font-size: 16px;
    font-weight: 600 !important;
}

.leaflet-control-geosearch.leaflet-geosearch-bar,
.leaflet-touch .leaflet-geosearch-bar form,
.leaflet-control-geosearch input,
.leaflet-control-geosearch .reset,
.leaflet-control-geosearch .results {
    background-color: rgb(254 240 138) !important; /* yellow-200 - vibrant but not too bright */
}

.leaflet-control-geosearch input[type="text"]:focus {
    box-shadow: none !important;
}


/* Wrapper created by Leaflet-Geosearch */
/*.leaflet-control-geosearch .search {
    display: flex;
    flex-direction: column;
    padding: 6px 8px;
    cursor: pointer;
}*/

.geosearch-result-main {
    font-weight: 600;
}

.geosearch-result-sub {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 2px;
}

.geosearch-icon {
    width: 14px;
    height: 14px;
    margin-right: 6px;
    vertical-align: -2px;
    flex: 0 0 auto;
}

.geosearch-row {
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

.geosearch-line {
    pointer-events: none;
    display: flex;
    align-items: center;
}

/* Opportunity and Payment Plan Selection Radio Styles */
.opportunity-option:has(input[type="radio"]:checked) {
    border-color: var(--color-brand);
    background-color: var(--color-brand-subtle);
}

.payment-plan-option:has(input[type="radio"]:checked) {
    border-color: var(--color-brand);
    background-color: var(--color-brand-subtle);
}

.opportunity-option input[type="radio"]:checked + .radio-indicator {
    border-color: var(--color-brand);
    background-color: var(--color-brand);
}

.opportunity-option input[type="radio"]:checked + .radio-indicator .radio-dot {
    display: block;
}

.payment-plan-option:has(input[type="radio"]:checked) .radio-indicator {
    border-color: var(--color-brand);
    background-color: var(--color-brand);
}

.payment-plan-option:has(input[type="radio"]:checked) .radio-dot {
    display: block;
}

/* Dark mode for opportunity/payment plan selection */
.dark .opportunity-option:has(input[type="radio"]:checked) {
    border-color: var(--color-brand);
    background-color: var(--color-brand-subtle);
}

.dark .payment-plan-option:has(input[type="radio"]:checked) {
    border-color: var(--color-brand);
    background-color: var(--color-brand-subtle);
}

/* Turbo Frame loading state — visual feedback during inline edit loads */
turbo-frame[busy] {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.15s ease-in-out;
}

/* Navigation surface uses CSS tokens --color-nav-* from theme-base-stone.css.
   Sidebar/navbar HTML uses nav token classes directly (text-nav-text, bg-nav-bg-hover, etc.).
   No CSS overrides needed — change the tokens to change the nav color scheme. */