/* Accounting GHL App - Custom Styles */

/* Base overrides */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Table styles */
table {
    border-collapse: collapse;
}

table th {
    white-space: nowrap;
}

table td {
    vertical-align: middle;
}

/* Consistent form input height */
input[type="text"],
input[type="email"],
input[type="date"],
input[type="number"],
input[type="tel"],
input[type="password"],
textarea {
    min-height: 42px;
    box-sizing: border-box;
}

/* Form focus styles */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Scrollbar styles */
.overflow-y-auto::-webkit-scrollbar {
    width: 6px;
}

.overflow-y-auto::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.overflow-y-auto::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Tom Select - Custom theme to match app design */

/* Strip ALL border/padding from outer wrapper — only .ts-control should have a border */
.ts-wrapper,
.ts-wrapper.single,
.ts-wrapper.multi,
.ts-wrapper.border,
.ts-wrapper.rounded-lg {
    border: 0 !important;
    border-width: 0 !important;
    border-style: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: transparent !important;
}

.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control {
    background: #fff;
    border: 1px solid #d1d5db !important;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    min-height: 42px;
    box-shadow: none !important;
    transition: border-color 0.15s, box-shadow 0.15s;
    display: flex;
    align-items: center;
}

.ts-wrapper.single .ts-control:hover,
.ts-wrapper.multi .ts-control:hover {
    border-color: #9ca3af;
}

.ts-wrapper.single.focus .ts-control,
.ts-wrapper.multi.focus .ts-control {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

/* Hide selected item text only when dropdown is open (typing to search) */
.ts-wrapper.single.dropdown-active .ts-control > .item {
    display: none !important;
}

/* Make search input take full width */
.ts-wrapper .ts-control > input {
    font-size: 0.875rem;
    flex: 1;
    width: 100% !important;
}

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

/* Dropdown */
.ts-dropdown {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    margin-top: 4px;
    font-size: 0.875rem;
    min-width: 100%;
    width: max-content;
}

.ts-dropdown .option {
    padding: 0.5rem 0.75rem;
    border-radius: 0;
    white-space: nowrap;
    transition: background-color 0.1s;
}

.ts-dropdown .option:first-child {
    border-radius: 0.5rem 0.5rem 0 0;
}

.ts-dropdown .option:last-child {
    border-radius: 0 0 0.5rem 0.5rem;
}

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

.ts-dropdown .option:hover {
    background-color: #f3f4f6;
}

.ts-dropdown .create {
    padding: 0.5rem 0.75rem;
    color: #6b7280;
}

/* Hide caret arrow when dropdown is open */
.ts-wrapper.single .ts-control::after {
    border-color: #9ca3af transparent transparent transparent;
    border-width: 5px 5px 0 5px;
    transition: transform 0.15s;
}

.ts-wrapper.single.dropdown-active .ts-control::after {
    transform: rotate(180deg);
}

/* Dropdown max height with scroll */
.ts-dropdown .ts-dropdown-content {
    max-height: 250px;
    overflow-y: auto;
}

/* Multi-select tags */
.ts-wrapper.multi .ts-control > .item {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    border-radius: 0.375rem;
    padding: 0.125rem 0.5rem;
    font-size: 0.8125rem;
    margin: 1px 4px 1px 0;
}

.ts-wrapper.multi .ts-control > .item .remove {
    border-left: 1px solid #bfdbfe;
    color: #93c5fd;
}

.ts-wrapper.multi .ts-control > .item .remove:hover {
    color: #dc2626;
    background: transparent;
}

/* Filter bar selects - match search input height with a fixed min width */
.ts-wrapper.ts-sm {
    min-width: 150px;
}

.ts-wrapper.ts-sm .ts-control {
    min-height: 42px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

/* Print styles */
@media print {
    nav, footer, .no-print {
        display: none !important;
    }

    main {
        padding: 0 !important;
    }

    .shadow-sm {
        box-shadow: none !important;
    }
}
