/**
 * LDM Divi Commercial Module Styles
 * Version: 1.0.0
 */

/* ===========================
   Base Styles
   =========================== */

.ldm-commercial-module {
    width: 100%;
    margin-bottom: 20px;
}

/* ===========================
   Department Filter
   =========================== */

.ldm-department-filter {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.ldm-department-filter label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.ldm-dept-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px;
}

.ldm-dept-select:hover {
    border-color: #0073aa;
}

.ldm-dept-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.ldm-no-results {
    padding: 30px;
    text-align: center;
    font-size: 16px;
    color: #666;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 20px;
}

/* ===========================
   Info Card
   =========================== */

.ldm-info-card {
    margin-top: 20px;
    padding: 40px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.ldm-info-card-content svg {
    margin: 0 auto 20px;
    display: block;
}

.ldm-info-card-content h3 {
    font-size: 22px;
    font-weight: 600;
    color: #333;
    margin: 0 0 12px 0;
}

.ldm-info-card-content p {
    font-size: 16px;
    color: #666;
    line-height: 1.6;
    margin: 0;
    max-width: 500px;
    margin: 0 auto;
}

/* Icon Styling */
.ldm-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.ldm-info-icon .et-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ldm-info-icon .et-pb-icon {
    font-size: inherit;
    line-height: 1;
}

/* ===========================
   Commercial List Container
   =========================== */

.ldm-commercial-list {
    display: block;
    width: 100%;
}

/* Cards layout when using cards display type */
.ldm-commercial-list.ldm-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Single card takes full width */
.ldm-commercial-list.ldm-cards .ldm-commercial-card:only-child,
.ldm-commercial-list.ldm-cards .ldm-commercial-card:first-child:nth-last-child(1) {
    width: 100%;
}

/* List layout when using list display type */
.ldm-commercial-list.ldm-list {
    display: flex;
    flex-direction: column;
}

.ldm-commercial-card {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.ldm-commercial-list.ldm-list .ldm-commercial-card {
    margin-bottom: 0;
}

.ldm-commercial-card[style*="display: none"] {
    opacity: 0;
    transform: scale(0.95);
    height: 0;
    margin: 0;
    overflow: hidden;
}

/* ===========================
   Layout Types
   =========================== */

.ldm-commercial-list {
    margin-bottom: 20px;
}

/* ===========================
   Commercial Item/Card
   =========================== */

.ldm-commercial-item,
.ldm-card,
.ldm-list-item {
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Cards Display Type */
.ldm-cards .ldm-card {
    padding: 24px;
    border: 1px solid #e0e0e0;
}

.ldm-cards .ldm-commercial-item {
    height: 100%;
}

/* List Display Type */
.ldm-list-item {
    padding: 16px 20px;
    border-left: 4px solid #0073aa;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

.ldm-list-item .ldm-commercial-name {
    flex: 0 0 200px;
    margin: 0;
}

.ldm-list-item .ldm-commercial-departments {
    flex: 1 1 auto;
    margin: 0;
}

.ldm-list-item .ldm-commercial-contact,
.ldm-list-item .ldm-mobile-actions {
    flex: 0 0 100%;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

/* ===========================
   Typography
   =========================== */

.ldm-commercial-name {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 12px 0;
    line-height: 1.4;
    color: #333;
}

.ldm-cards .ldm-commercial-name {
    font-size: 20px;
    margin-bottom: 15px;
}

.ldm-list-item .ldm-commercial-name {
    font-size: 17px;
}

/* ===========================
   Departments
   =========================== */

.ldm-commercial-departments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.ldm-department-badge {
    background-color: #e8f4f8;
    color: #0073aa;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid #0073aa;
}

.ldm-cards .ldm-department-badge {
    padding: 8px 14px;
    font-size: 14px;
}

.ldm-list-item .ldm-department-badge {
    padding: 5px 10px;
    font-size: 12px;
}

/* ===========================
   Contact Information
   =========================== */

.ldm-commercial-contact {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
    font-size: 14px;
}

.ldm-cards .ldm-commercial-contact {
    margin-top: 20px;
    padding-top: 20px;
}

.ldm-contact-email,
.ldm-contact-phone {
    margin: 8px 0;
    line-height: 1.6;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ldm-contact-email strong,
.ldm-contact-phone strong {
    font-weight: 600;
    color: #555;
    min-width: 60px;
    flex-shrink: 0;
}

.ldm-contact-email a,
.ldm-contact-phone a {
    color: #0073aa;
    text-decoration: none;
    word-break: break-word;
    font-weight: 500;
}

.ldm-contact-email a:hover,
.ldm-contact-phone a:hover {
    text-decoration: underline;
}

/* ===========================
   Mobile Action Buttons
   =========================== */

.ldm-mobile-actions {
    display: none;
    gap: 10px;
    margin-top: 15px;
}

.ldm-mobile-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ldm-mobile-btn-call {
    background-color: #0073aa;
    color: white;
}

.ldm-mobile-btn-email {
    background-color: #28a745;
    color: white;
}

.ldm-mobile-btn:active {
    transform: scale(0.98);
}

.ldm-mobile-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* ===========================
   Pagination
   =========================== */

.ldm-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.ldm-page-link {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #0073aa;
    transition: all 0.3s ease;
    background-color: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: inline-block;
    min-width: 40px;
    text-align: center;
}

.ldm-page-link:hover:not(.ldm-active) {
    border-color: #0073aa;
    background-color: #f5f5f5;
}

.ldm-page-link.ldm-active {
    background-color: #0073aa;
    color: white;
    border-color: #0073aa;
}

.ldm-page-link.ldm-prev,
.ldm-page-link.ldm-next {
    font-size: 16px;
}

/* ===========================
   Responsive Design
   =========================== */

@media (max-width: 768px) {
    .ldm-commercial-list.ldm-cards {
        flex-direction: column;
    }

    .ldm-commercial-item,
    .ldm-card {
        padding: 16px;
    }

    .ldm-commercial-name {
        font-size: 16px;
    }

    .ldm-list-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .ldm-list-item .ldm-commercial-name {
        flex: 1 1 100%;
    }

    .ldm-list-item .ldm-commercial-departments {
        flex: 1 1 100%;
    }
}

@media (max-width: 480px) {
    .ldm-commercial-list.ldm-cards {
        flex-direction: column;
    }

    .ldm-commercial-item,
    .ldm-card,
    .ldm-list-item {
        padding: 16px;
    }
}

/* ===========================
   Dark Mode Support
   =========================== */

@media (prefers-color-scheme: dark) {
    .ldm-commercial-item,
    .ldm-card,
    .ldm-list-item {
        background-color: #1e1e1e;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        border-color: #333;
    }
    
    .ldm-commercial-name {
        color: #e0e0e0;
    }

    .ldm-department-badge {
        background-color: #1a3a4a;
        color: #64b5f6;
        border-color: #64b5f6;
    }

    .ldm-commercial-contact {
        border-top-color: #333;
    }
    
    .ldm-contact-email strong,
    .ldm-contact-phone strong {
        color: #aaa;
    }
    
    .ldm-contact_email a,
    .ldm-contact_phone a {
        color: #64b5f6;
    }

    .ldm-page-link {
        border-color: #444;
        color: #64b5f6;
    }

    .ldm-mobile-btn_call {
        background-color: #0d8ae8;
    }

    .ldm-mobile-btn_email {
        background-color: #31b94d;
    }
    
    .ldm-department-filter {
        background-color: #1e1e1e;
        border-color: #333;
    }
    
    .ldm-department-filter label {
        color: #e0e0e0;
    }
    
    .ldm-dept-select {
        background-color: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .ldm-info-card {
        background-color: #1e1e1e;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    }
    
    .ldm-info-card-content h3 {
        color: #e0e0e0;
    }
    
    .ldm-info-card-content p {
        color: #aaa;
    }
    
    .ldm-info-card-content svg path {
        fill: #64b5f6;
    }
}

/* ===========================
   Accessibility
   =========================== */

.ldm-page-link:focus,
.ldm-contact-email a:focus,
.ldm-contact-phone a:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.ldm-commercial-module:focus-within {
    outline: none;
}

/* ===========================
   Print Styles
   =========================== */

@media print {
    .ldm-pagination {
        display: none;
    }

    .ldm-commercial-item,
    .ldm-card,
    .ldm-list-item {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
