/* WSConnect Main Styles */

/* Container-fluid - full width with consistent padding */
.container-fluid {
    width: 100%;
    max-width: 100%;
    padding-left: 8% !important;
    padding-right: 8% !important;
}

/* Content area padding */
main .container-fluid {
    padding-top: 20px !important;
    padding-bottom: 20px !important;
}

body {
    background-color: #f9fafb;
    color: #2d2d49;
}

/* Softer text color for inputs */
input,
textarea,
select {
    color: #2d2d49 !important;
}

/* Labels and headings */
label,
h1, h2, h3, h4, h5, h6 {
    color: #2d2d49;
}

/* Override Tailwind dark text colors with softer color */
.text-gray-900 {
    color: #2d2d49 !important;
}

.text-gray-800 {
    color: #3d3d59 !important;
}

.text-gray-700 {
    color: #4d4d69 !important;
}

/* ========================================
   TomSelect Custom Styling
   ======================================== */

/* Wrapper */
.ts-wrapper {
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    background-color: #fff;
}

.ts-wrapper.focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.5);
    outline: none;
}

/* Control (input area) */
.ts-control {
    border: none !important;
    background-color: transparent !important;
    padding: 0.5rem 0.75rem !important;
    min-height: 38px;
}

.ts-control input {
    font-size: 0.875rem;
}

.ts-control input::placeholder {
    color: #9ca3af;
}

/* Dropdown */
.ts-dropdown {
    border: 1px solid #d1d5db !important;
    border-radius: 0.25rem !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    margin-top: 4px !important;
    overflow: visible;
    z-index: 99999 !important;
    position: absolute;
}

/* When dropdown is appended to body, ensure proper positioning */
body > .ts-dropdown {
    z-index: 99999 !important;
}

.ts-wrapper {
    position: relative;
    z-index: 1;
}

.ts-wrapper.dropdown-active {
    z-index: 99999;
}

.ts-dropdown .ts-dropdown-content {
    max-height: 300px;
    overflow-y: auto;
}

/* Options */
.ts-dropdown .option {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.ts-dropdown .option:hover,
.ts-dropdown .option.active {
    background-color: #eff6ff;
    color: #1d4ed8;
}

.ts-dropdown .option.selected {
    background-color: #dbeafe;
}

/* Clear button */
.ts-wrapper .clear-button {
    color: #9ca3af;
    padding: 0 0.5rem;
}

.ts-wrapper .clear-button:hover {
    color: #374151;
}

/* ========================================
   Country Select Specific Styles
   ======================================== */

/* Option in dropdown */
.ts-country-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ts-country-flag {
    font-size: 1.25rem;
    line-height: 1;
}

.ts-country-name {
    flex: 1;
}

/* Selected item */
.ts-country-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ts-control .item {
    background: none !important;
    border: none !important;
    padding: 0 !important;
}

/* No results */
.ts-no-results {
    padding: 0.75rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
}

/* Optgroup (preferred countries separator) */
.ts-dropdown .optgroup-header {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.ts-dropdown .optgroup:not(:first-child) .optgroup-header {
    border-top: 1px solid #e5e7eb;
}

/* ========================================
   Multi-select Styling
   ======================================== */

.ts-wrapper.multi .ts-control > .item {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 0.25rem;
    padding: 0.125rem 0.5rem !important;
    margin: 0.125rem;
    font-size: 0.75rem;
    color: #1e40af;
}

.ts-wrapper.multi .ts-control > .item .remove {
    border-left: 1px solid #bfdbfe;
    margin-left: 0.25rem;
    padding-left: 0.25rem;
}

/* ========================================
   Form Input Styles
   ======================================== */

.form-input {
    display: block;
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #2d2d49;
    background-color: #fff;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    min-height: 42px;
}

.form-input:focus {
    border-color: #93c5fd;
    outline: none;
    box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.5);
}

.form-input::placeholder {
    color: #9ca3af;
}

.form-textarea {
    display: block;
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #2d2d49;
    background-color: #fff;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    resize: vertical;
    min-height: 80px;
}

.form-textarea:focus {
    border-color: #93c5fd;
    outline: none;
    box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.5);
}

.form-select {
    display: block;
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #2d2d49;
    background-color: #fff;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    min-height: 42px;
}

.form-select:focus {
    border-color: #93c5fd;
    outline: none;
    box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.5);
}

.form-checkbox {
    width: 1rem;
    height: 1rem;
    color: #3b82f6;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
}

.form-checkbox:focus {
    outline: none;
    box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.5);
}

/* ========================================
   International Phone Input Styling
   ======================================== */

/* Container */
.iti {
    width: 100%;
}

/* Input field */
.iti__tel-input {
    width: 100%;
    padding: 0.625rem 0.75rem !important;
    padding-left: 90px !important;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #2d2d49;
    background-color: #fff;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    min-height: 42px;
}

.iti__tel-input:focus {
    border-color: #93c5fd;
    outline: none;
    box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.5);
}

.iti__tel-input::placeholder {
    color: #9ca3af;
}

/* Country selector button */
.iti__country-container {
    padding: 0;
}

.iti__selected-country {
    padding: 0.5rem 0.5rem 0.5rem 0.75rem;
    background-color: #f9fafb;
    border-right: 1px solid #d1d5db;
    border-radius: 0.25rem 0 0 0.25rem;
}

.iti__selected-country:hover {
    background-color: #f3f4f6;
}

/* Selected dial code */
.iti__selected-dial-code {
    font-size: 0.875rem;
    color: #374151;
    margin-left: 0.25rem;
}

/* Dropdown arrow */
.iti__arrow {
    border-top-color: #6b7280;
    margin-left: 0.25rem;
}

.iti__arrow--up {
    border-bottom-color: #6b7280;
}

/* Dropdown */
.iti__dropdown-content {
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    margin-top: 4px;
    background-color: #fff;
    overflow: hidden;
}

/* Search input in dropdown */
.iti__search-input {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: none;
    border-bottom: 1px solid #e5e7eb;
    width: 100%;
    outline: none;
}

.iti__search-input:focus {
    border-bottom-color: #3b82f6;
}

.iti__search-input::placeholder {
    color: #9ca3af;
}

/* Country list */
.iti__country-list {
    max-height: 250px;
    overflow-y: auto;
}

/* Country item */
.iti__country {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.iti__country:hover {
    background-color: #eff6ff;
}

.iti__country.iti__highlight {
    background-color: #eff6ff;
}

.iti__country.iti__active {
    background-color: #dbeafe;
}

/* Country name */
.iti__country-name {
    color: #1f2937;
    flex: 1;
}

/* Dial code in list */
.iti__dial-code {
    color: #6b7280;
    font-size: 0.75rem;
}

/* Flag */
.iti__flag {
    margin-right: 0.25rem;
}

/* Preferred countries divider */
.iti__divider {
    border-top: 1px solid #e5e7eb;
    margin: 0;
}

/* No results */
.iti__no-results {
    padding: 0.75rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
}

/* ========================================
   Global Input Focus Styles
   ======================================== */

/* Override Tailwind focus styles for all inputs */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
textarea:focus,
select:focus {
    border-color: #93c5fd !important;
    outline: none !important;
    box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.5) !important;
    --tw-ring-color: transparent !important;
}

/* Increase input height and reduce border radius */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
    min-height: 42px;
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
    border-radius: 0.25rem !important; /* Smaller radius - 4px */
}

/* ========================================
   Tab Navigation Styles
   ======================================== */

/* Base tab button */
.tab {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    color: #6b7280;
    transition: color 0.15s ease-in-out, border-color 0.15s ease-in-out;
    cursor: pointer;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab:hover {
    color: #374151;
    border-bottom-color: #d1d5db;
}

/* Active tab - blue style */
.tab.active,
.tab[aria-selected="true"] {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.tab.active:hover,
.tab[aria-selected="true"]:hover {
    color: #1d4ed8;
    border-bottom-color: #1d4ed8;
}

/* Tab container/nav */
.tab-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: -1px;
}

/* Tab nav without bottom border (for inline use) */
.tab-nav-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Tab panel */
.tab-panel {
    /* Default visible */
}

.tab-panel.hidden {
    display: none;
}

/* ========================================
   Markdown Table Styling
   ======================================== */

/* Tables inside AI content or prose blocks */
.ai-content table,
.prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin: 1rem 0;
}

.ai-content thead,
.prose thead {
    background-color: #f9fafb;
}

.ai-content th,
.prose th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ai-content td,
.prose td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    color: #4b5563;
}

.ai-content tbody tr:hover,
.prose tbody tr:hover {
    background-color: #f9fafb;
}

.ai-content tbody tr:last-child td,
.prose tbody tr:last-child td {
    border-bottom: none;
}

/* ========================================
   Inline Edit Controller Styles
   ======================================== */

/* Ensure inline-edit dropdown has proper z-index in tables */
.inline-edit-select-wrapper {
    position: relative;
}

.inline-edit-select-wrapper .ts-wrapper {
    position: relative;
}

.inline-edit-select-wrapper .ts-wrapper.dropdown-active {
    z-index: 99999 !important;
}

.inline-edit-select-wrapper .ts-dropdown {
    z-index: 99999 !important;
    position: absolute !important;
}

/* Ensure table cell doesn't clip the dropdown */
td[data-controller="inline-edit"] {
    position: relative;
    overflow: visible !important;
}

/* Ensure table row and table don't create stacking context issues */
table {
    overflow: visible;
}

tbody, tr {
    overflow: visible;
}
