/* Directory Styles */
.cdm-directory {
    margin-bottom: 3rem;
}

/* Alphabet Navigation */
.directory-nav {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.alphabet-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.alphabet-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 6px;
    background: white;
    color: #0056b3;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.alphabet-link:hover {
    background: #0056b3;
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Letter Sections */
.letter-heading {
    color: #333;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

/* Company Cards */
.company-card {
    background: white;
    border-radius: 12px;
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    border: none;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    position: relative;
}

.premium-company {
    background: linear-gradient(to bottom right, #ffffff, #f9f7f0);
    border-left: 4px solid #e6a80d;
}

.company-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.company-card-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1.5rem;
    align-items: start;
}

.company-logo {
    width: 100px;
    height: 100px;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.company-logo img {
    max-width: 100%;
    max-height: 100%;
    display: block;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.company-logo:hover img {
    transform: scale(1.05);
}

.company-info {
    min-width: 0; /* Prevents grid overflow */
}

.company-name {
    font-size: 1.4rem;
    margin: 0 0 0.75rem;
    font-weight: 600;
    line-height: 1.3;
}

.company-name a {
    color: #222;
    text-decoration: none;
    transition: color 0.2s ease;
}

.company-name a:hover {
    color: #0056b3;
}

.company-address {
    margin: 0;
    font-style: normal;
    color: #555;
    font-size: 0.95rem;
    line-height: 1.5;
}

.company-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.company-actions .btn {
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.company-actions .btn-primary {
    background: linear-gradient(to bottom, #0069d9, #0056b3);
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.company-actions .btn-primary:hover {
    background: linear-gradient(to bottom, #0062cc, #004fa3);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Device Types */
.company-device-types {
    margin: 1rem 0;
    padding: 1rem 0;
    border-top: 1px solid #eee;
}

.device-type-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.device-type-tag {
    background: #f0f4f8;
    color: #0056b3;
    padding: 0.3rem 0.85rem;
    border-radius: 50px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.device-type-tag:hover {
    background: #e1ecf9;
    transform: translateY(-1px);
}

/* Properties */
.company-properties {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #eee;
}

.properties-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    color: #333;
    font-weight: 500;
    text-decoration: none;
    background: #f8f9fa;
    border-radius: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e9ecef;
}

.properties-toggle:hover {
    background: #e9ecef;
    color: #0056b3;
    text-decoration: none;
}

.properties-toggle::after {
    content: '\f107';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    transition: transform 0.3s ease;
    font-size: 1.1rem;
}

.properties-toggle.collapsed::after {
    transform: rotate(180deg);
}

.properties-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 1rem;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.property-item {
    display: flex;
    flex-direction: column;
    padding: 0.85rem;
    border-radius: 6px;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f1f3f5;
    grid-column: 1 / -1;
    background: rgba(255,255,255,0.5);
}

.property-item:last-child {
    border-bottom: none;
}

.property-item:hover {
    background: rgba(255,255,255,0.9);
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

.property-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
}

.property-value {
    color: #212529;
    width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.5;
}

/* Boolean Properties */
.boolean-property {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.85rem;
}

.boolean-property i {
    font-size: 1.15rem;
}

/* Filter Section */
.directory-filters-toggle {
    text-align: right;
    margin-bottom: 1.5rem;
}

.directory-filters-toggle .btn {
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.directory-filters-toggle .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

#directoryFilters {
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

#directoryFilters .card-body {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
}

.form-select:focus, .form-control:focus {
    border-color: #0069d9;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Contact Modal */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.modal-header {
    background: #0056b3;
    color: white;
    border-radius: 12px 12px 0 0;
    padding: 1rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* Certification Badge Corner */
.certification-badge-corner {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    z-index: 5;
}

.certification-badge {
    width: 50px;
    height: auto;
    border-radius: 4px;
    transition: transform 0.2s ease;
}

.certification-badge:hover {
    transform: scale(1.05);
}

.awards-badge {
    margin-top: 0;
}

.awards-badge-img {
    width: 50px;
    height: auto;
    border-radius: 4px;
    transition: transform 0.2s ease;
}

.awards-badge-img:hover {
    transform: scale(1.05);
}

/* Responsive Adjustments */
@media (min-width: 768px) {
    .properties-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 0.75rem;
    }
    
    .boolean-property {
        grid-column: auto;
    }
}

@media (max-width: 991.98px) {
    .company-card-header {
        grid-template-columns: auto 1fr;
    }

    .company-actions {
        grid-column: span 2;
        flex-direction: row;
        justify-content: flex-start;
        margin-top: 1rem;
    }
}

@media (max-width: 767.98px) {
    .company-card-header {
        grid-template-columns: 1fr;
    }

    .company-logo {
        width: 80px;
        height: 80px;
        margin: 0 auto 1rem;
    }

    .company-name, .company-address {
        text-align: center;
    }

    .company-actions {
        grid-column: 1;
        justify-content: center;
    }

    .properties-grid {
        grid-template-columns: 1fr;
    }

    .alphabet-link {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.875rem;
    }
    
    .certification-badge-corner {
        flex-direction: row;
    }
    
    .certification-badge, .awards-badge-img {
        width: 40px;
    }
}

/* Additional Directory Styles */
.no-results-message {
    text-align: center;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 2rem 0;
}

.alphabet-link.disabled {
    opacity: 0.5;
    pointer-events: none;
    background: #e9ecef;
}

.alphabet-link.active {
    background: #0056b3;
    color: white;
}

/* Animation for showing/hiding companies */
.company-card {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.company-cards {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Reference Customers Preview in Directory */
.company-reference-customers-preview {
    margin: 0.75rem 0;
    padding: 0.75rem 0;
    border-top: 1px solid #eee;
}

.company-reference-customers-preview strong {
    color: #495057;
    font-size: 0.95rem;
    margin-right: 0.5rem;
}

.reference-customers-text {
    display: inline;
    color: #212529;
    font-size: 0.95rem;
    line-height: 1.4;
}