/* Companies admin styles */
.company-logo-thumb {
    max-height: 64px;
    margin-right: 10px;
    border-radius: 6px;
}

.company-logo-dropzone {
    border: 2px dashed #cbd5f5;
    border-radius: 10px;
    padding: 18px;
    background: #f9fafb;
    color: #4b5563;
    text-align: center;
    cursor: pointer;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.company-logo-dropzone:hover {
    border-color: #6366f1;
    background: #eef2ff;
}

.company-logo-dropzone--fallback {
    border-style: dashed;
    cursor: default;
}

.company-logo-input-fallback {
    display: none;
    margin-top: 10px;
}

.company-logo-dropzone--fallback + .company-logo-input-fallback {
    display: inline-block;
}

.quotify-company-hero-card {
    background: #fff;
    border-radius: 18px;
    padding: 24px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    box-shadow: 0 15px 40px rgba(15, 23, 42, 0.08);
}

.quotify-company-hero-info {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    min-width: 280px;
}

.quotify-company-hero-logo {
    width: 96px;
    height: 96px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f3f4f6;
    padding: 12px;
}

.quotify-company-hero-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.quotify-company-hero-initial {
    font-size: 36px;
    font-weight: 600;
    color: #6366f1;
}

.quotify-company-hero-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    color: #6b7280;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.quotify-company-hero-title {
    margin: 0;
    font-size: 30px;
    font-weight: 600;
    color: #111827;
}

.quotify-company-hero-meta {
    margin-top: 8px;
    color: #6b7280;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.quotify-company-hero-meta span,
.quotify-company-hero-meta a {
    font-size: 14px;
    color: #4b5563;
}

.quotify-company-hero-meta a {
    text-decoration: none;
    border-bottom: 1px dotted transparent;
}

.quotify-company-hero-meta a:hover {
    border-color: currentColor;
}

.quotify-company-hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.quotify-company-sections {
    margin-top: 15px;
}

.quotify-company-section-card {
    background: transparent;
    border-radius: 18px;
    padding: 0;
    box-shadow: none;
}

.quotify-company-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.quotify-company-card {
    border: 1px solid #edf2f7;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.quotify-company-card-header {
    padding: 18px 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.quotify-company-card-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.quotify-company-card-header.subheading h4 {
    font-size: 15px;
    color: #4b5563;
}

.quotify-company-card-body {
    padding: 18px 20px 24px;
}

.quotify-company-card-body p {
    margin-bottom: 10px;
}

.quotify-company-description {
    color: #4b5563;
    line-height: 1.6;
}

.quotify-company-tags {
    color: #9ca3af;
    font-size: 13px;
}

.quotify-company-data-table td,
.quotify-company-data-table th {
    border: none;
    padding: 8px 0;
}

.quotify-company-data-table td:first-child,
.quotify-company-data-table th:first-child {
    color: #6b7280;
    width: 45%;
}

.quotify-company-additional h5 {
    font-size: 14px;
    font-weight: 600;
    margin: 16px 0 10px;
}

.quotify-company-table > thead > tr > th {
    border-bottom-width: 1px;
    color: #6b7280;
    font-weight: 600;
}

.quotify-company-table td {
    vertical-align: middle;
}

.quotify-inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px;
}

.quotify-inline-form .form-group {
    margin-bottom: 0;
}

.quotify-inline-form .form-control {
    min-width: 220px;
}

.quotify-inline-form .form-group-flex {
    flex: 1;
}

.quotify-company-member-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 767px) {
    .quotify-company-card + .quotify-company-card {
        margin-top: 20px;
    }
}

.company-card-logo {
    max-height: 80px;
    margin-bottom: 10px;
    border-radius: 6px;
}

.notes-list .note-item {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
}

.quotify-directory {
    margin-top: 20px;
}

.quotify-directory-hero-card {
    background: #fff;
    border-radius: 24px;
    padding: 28px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 25px 55px rgba(15, 23, 42, 0.1);
}

.quotify-directory-hero-text h1 {
    margin: 0;
    font-size: 30px;
    font-weight: 600;
    color: #0f172a;
}

.quotify-directory-hero-label {
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.quotify-directory-hero-description {
    margin: 10px 0 0;
    color: #475569;
    max-width: 560px;
}

.quotify-directory-hero-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.quotify-directory-filter {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 25px 0;
    align-items: end;
}

.quotify-directory-filter label {
    font-weight: 600;
    margin-bottom: 6px;
    color: #475569;
}

.quotify-input-icon {
    position: relative;
}

.quotify-input-icon i {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: #cbd5f5;
}

.quotify-input-icon .form-control {
    padding-left: 34px;
}

.btn-bold {
    font-weight: 600;
}

.quotify-directory-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .quotify-directory-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .quotify-directory-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.quotify-directory-card {
    border: 1px solid #e2e8f0;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.quotify-directory-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 25px 55px rgba(15, 23, 42, 0.12);
}

.quotify-directory-card.is-active {
    border-color: #22c55e;
}

.quotify-directory-card-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.quotify-directory-card-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.quotify-directory-pill {
    background: #f8fafc;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
}

.quotify-directory-chip {
    margin-top: 6px;
    display: inline-block;
    background: #eef2ff;
    color: #4338ca;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
}

.quotify-directory-card-body {
    padding: 0 20px 15px;
}

.quotify-directory-card-logo {
    width: 100%;
    margin: 10px auto 15px;
    text-align: center;
}

.quotify-directory-card-logo img {
    max-height: 90px;
    max-width: 180px;
    object-fit: contain;
}

.quotify-directory-card-description {
    color: #4b5563;
    margin-bottom: 12px;
    min-height: 45px;
}

.quotify-directory-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: #64748b;
}

.quotify-directory-card-footer {
    padding: 15px 20px 20px;
    border-top: 1px solid #f1f5f9;
}

.quotify-directory-card-footer textarea {
    resize: vertical;
    margin-bottom: 10px;
}

.quotify-directory-status {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: #dcfce7;
    color: #047857;
    font-weight: 600;
}

.quotify-directory-status--pending {
    background: #fef9c3;
    color: #92400e;
}

.quotify-role-card {
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.quotify-permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.quotify-permission-item {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.quotify-permission-item input[type="checkbox"] {
    margin-top: 4px;
}

.quotify-permission-text .desc {
    display: block;
    margin-top: 4px;
}

/* Hide native company field in Customer forms */
/* This is done because we have a separate Company entity in quotify_companies module */
/* The native field is replaced with a selectbox from quotify_companies module */
/* Customer represents Contact only, not Company */

/* ===== ADMIN AREA ===== */

/* Hide the native company input field - target all company inputs except our replacement */
input[name="company"][id="company"],
input[name="company"]:not(.quotify-companies-company-select-wrapper input):not(#quotify-companies-company-select-wrapper input) {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Hide the native label for company field */
label[for="company"]:not([for="company_id"]):not(.quotify-companies-company-select-wrapper label) {
    display: none !important;
    visibility: hidden !important;
}

/* Hide the form-group wrapper containing the native company field */
.form-group:has(> input[name="company"][id="company"]),
.form-group:has(> input[name="company"]):has(> label[for="company"]:not([for="company_id"])) {
    display: none !important;
}

/* Fallback for browsers without :has() support - hide form-group containing company input */
.form-group input[name="company"][id="company"] {
    display: none !important;
}

/* More aggressive: hide form-group that directly contains company input */
.form-group > input[name="company"][id="company"],
.form-group > input[name="company"]:not(.quotify-companies-company-select-wrapper input):not(#quotify-companies-company-select-wrapper input) {
    display: none !important;
}

/* Hide the entire form-group if it contains company input and company label */
.form-group:has(input[name="company"][id="company"]):has(label[for="company"]:not([for="company_id"])) {
    display: none !important;
}

/* Hide company_exists_info div */
#company_exists_info {
    display: none !important;
    visibility: hidden !important;
}

/* ===== HIDE COMPANY-RELATED FIELDS IN CUSTOMER DETAILS TAB ===== */
/* Customer represents Contact only, not Company */
/* Company information comes from linked Company entity in quotify_companies */

/* Hide VAT Number field (company tax info) */
div[app-field-wrapper="vat"],
.form-group:has(> input[name="vat"]),
.form-group:has(> label[for="vat"]) {
    display: none !important;
}

/* Hide Website field (company website) */
div[app-field-wrapper="website"],
.form-group:has(> input[name="website"]),
.form-group:has(> label[for="website"]) {
    display: none !important;
}

/* Hide Address field (company address) */
div[app-field-wrapper="address"],
.form-group:has(> textarea[name="address"]),
.form-group:has(> label[for="address"]) {
    display: none !important;
}

/* Hide City field (company address) */
div[app-field-wrapper="city"],
.form-group:has(> input[name="city"]),
.form-group:has(> label[for="city"]) {
    display: none !important;
}

/* Hide State field (company address) */
div[app-field-wrapper="state"],
.form-group:has(> input[name="state"]),
.form-group:has(> label[for="state"]) {
    display: none !important;
}

/* Hide Zip Code field (company address) */
div[app-field-wrapper="zip"],
.form-group:has(> input[name="zip"]),
.form-group:has(> label[for="zip"]) {
    display: none !important;
}

/* Hide Country field (company address) */
div[app-field-wrapper="country"],
.form-group:has(> select[name="country"]),
.form-group:has(> label[for="country"]) {
    display: none !important;
}

/* Fallback for browsers without :has() support */
input[name="vat"],
input[name="website"],
textarea[name="address"],
input[name="city"],
input[name="state"],
input[name="zip"],
select[name="country"] {
    display: none !important;
    visibility: hidden !important;
}

label[for="vat"],
label[for="website"],
label[for="address"],
label[for="city"],
label[for="state"],
label[for="zip"],
label[for="country"] {
    display: none !important;
    visibility: hidden !important;
}

/* Hide HR separator before address fields (if it's only before address) */
hr:has(+ .form-group:has(textarea[name="address"])),
hr:has(+ .form-group:has(input[name="city"])) {
    display: none !important;
}

/* Hide empty rows/spacing that might be left after hiding fields */
.form-group:empty {
    display: none !important;
}

/* ===== CLIENT PORTAL ===== */

/* Hide native company field in client portal registration form */
.register-company-group,
.register-company-group input[name="company"],
.register-company-group label[for*="company"]:not([for="company_id"]) {
    display: none !important;
}

/* Hide native company field in client portal company profile form */
.company-profile-company-group,
.company-profile-company-group input[name="company"],
.company-profile-company-group label[for="company"]:not([for="company_id"]) {
    display: none !important;
}

/* ===== GENERAL ===== */

/* Ensure the replacement selectbox wrapper is visible */
.quotify-companies-company-select-wrapper,
#quotify-companies-company-select-wrapper {
    display: block !important;
}

#company_id {
    display: block !important;
}

/* Hide any honeypot company fields */
.honey-element[name="company"],
input.honey-element[name="company"] {
    display: none !important;
}

