/**
 * All of the CSS for your public-facing functionality should be
 * included in this file.
 */

/* ========================================
   Directory Shortcode Styles
   ======================================== */

.wp-data-display-directory {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
    color: #1565c0;
    margin: 2rem 0;
}

/* Directory Controls */
.directory-controls {
    background: linear-gradient(135deg, #e3f2fd 0%, #fce4ec 100%);
    border: 1px solid #bbdefb;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.directory-search {
    display: flex;
    flex: 1;
    min-width: 250px;
}

.directory-search-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px 0 0 4px;
    font-size: 1rem;
    border-right: none;
}

.directory-search-button {
    padding: 0.75rem 1rem;
    background: #e91e63;
    color: white;
    border: 1px solid #e91e63;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.directory-search-button:hover {
    background: #0d47a1;
}

.directory-filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.directory-filters select {
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
    background: white;
    min-width: 150px;
}

.directory-reset-filters {
    background: #e91e63;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

.directory-reset-filters:hover {
    background: #c2185b;
}

.directory-reset-filters:active {
    background: #ad1457;
}

/* Results Info */
.directory-results-info {
    background: linear-gradient(135deg, #e1f5fe 0%, #f3e5f5 100%);
    border: 1px solid #90caf9;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.directory-results-info p {
    margin: 0;
    color: #1565c0;
    font-weight: 500;
}

/* ========================================
   Table Layout Styles
   ======================================== */

.directory-table-wrapper {
    overflow-x: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.directory-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.directory-table th,
.directory-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.directory-table th {
    background: #1d204b;
    font-weight: 600;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.directory-table tr:hover {
    background: linear-gradient(135deg, #e1f5fe 0%, #f3e5f5 100%);
}

.directory-table tr.highlighted {
    background: #fce4ec;
    border-left: 2px solid #337ab7;
}

.directory-table tr.highlighted:hover {
    background: linear-gradient(135deg, #e1f5fe 0%, #f3e5f5 100%);
}

/* Table Columns */
.column-name {
    width: 18%;
    font-size: 14px;
}

.column-type {
    width: 10%;
}

.column-address {
    width: 22%;
    font-size: 12px;
}

.column-phone {
    width: 15%;
    font-size: 12px;
}

.column-region {
    width: 15%;
    font-size: 12px;
}

.column-actions {
    width: 20%;
    text-align: center;
    min-width: 100px;
}

/* ========================================
   Cards Layout Styles
   ======================================== */

.directory-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.directory-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.directory-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.directory-card.highlighted {
    border-color: #ffc107;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

.card-header {
    background: linear-gradient(135deg, #e3f2fd 0%, #fce4ec 100%);
    padding: 1.5rem;
    border-bottom: 1px solid #bbdefb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    margin: 0;
    font-size: 1.25rem;
    color: #1565c0;
}

.card-content {
    padding: 1.5rem;
}

.card-field {
    margin-bottom: 1rem;
}

.card-field:last-child {
    margin-bottom: 0;
}

.card-field strong {
    color: #1565c0;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 0.25rem;
}

.card-field p {
    margin: 0;
    color: #1565c0;
}

/* Card field specific font sizes */
.card-field.name p {
    font-size: 14px;
}

.card-field.address p {
    font-size: 12px;
}

.card-field.phone p {
    font-size: 12px;
}

.card-field.region p {
    font-size: 12px;
}

.card-actions {
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #e1f5fe 0%, #f3e5f5 100%);
    border-top: 1px solid #90caf9;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.card-action-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #1565c0;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

.card-action-button:hover {
    background: #0d47a1;
    color: white;
    text-decoration: none;
}

.card-action-button.call-button {
    background: #28a745;
}

.card-action-button.call-button:hover {
    background: #1e7e34;
}

.card-action-button.map-button {
    background: #6c757d;
}

.card-action-button.map-button:hover {
    background: #545b62;
}

/* ========================================
   List Layout Styles
   ======================================== */

.directory-list {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0;
}

.directory-list-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.directory-list-item:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.directory-list-item.highlighted {
    border-color: #ffc107;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

.list-item-header {
    background: linear-gradient(135deg, #e3f2fd 0%, #fce4ec 100%);
    padding: 1.5rem;
    border-bottom: 1px solid #bbdefb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-item-title {
    margin: 0;
    font-size: 1.25rem;
    color: #1565c0;
}

.list-item-content {
    padding: 1.5rem;
}

.list-item-field {
    display: flex;
    margin-bottom: 1rem;
    align-items: baseline;
}

.list-item-field:last-child {
    margin-bottom: 0;
}

.list-item-field strong {
    color: #1565c0;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 80px;
    margin-right: 1rem;
}

.list-item-field span {
    color: #1565c0;
    flex: 1;
}

.list-item-actions {
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #e1f5fe 0%, #f3e5f5 100%);
    border-top: 1px solid #90caf9;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.list-action-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #1565c0;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

.list-action-button:hover {
    background: #0d47a1;
    color: white;
    text-decoration: none;
}

.list-action-button.call-button {
    background: #28a745;
}

.list-action-button.call-button:hover {
    background: #1e7e34;
}

.list-action-button.map-button {
    background: #6c757d;
}

.list-action-button.map-button:hover {
    background: #545b62;
}

/* ========================================
   Common Elements
   ======================================== */

/* Entry Type Badges */
.entry-type-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.entry-type-distributor {
    background: #e22658;
    color: #1d204b;
    border: none;
}

.entry-type-retailer {
    background: #fff;
    color: #1d204b;
    border: 1px solid #e22658;
}

.entry-type-unknown {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Phone Links and Call Buttons */
.phone-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.phone-number {
    color: #1565c0;
    font-weight: 500;
    flex: 1;
}

.phone-link {
    color: #1565c0;
    text-decoration: none;
    font-weight: 500;
}

.phone-link:hover {
    color: #0d47a1;
    text-decoration: underline;
}

.call-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
}

.call-button:hover {
    background: #1e7e34;
    color: white;
    text-decoration: none;
    transform: scale(1.1);
}

.call-button .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
    line-height: 1;
}

/* Call Now Button - Table Layout */
.call-now-button {
    display: inline-block;
    padding: 8px 16px;
    background: #1d204b;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    min-width: 80px;
}

.call-now-button:hover {
    background: #0d47a1;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.call-now-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.no-phone {
    color: #1565c0;
    font-style: italic;
    opacity: 0.7;
}

/* Pagination */
.directory-pagination {
    text-align: center;
    margin-top: 2rem;
}

.directory-pagination .page-numbers {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    background: white;
    border: 1px solid #bbdefb;
    border-radius: 4px;
    color: #1565c0;
    text-decoration: none;
    transition: all 0.2s;
}

.directory-pagination .page-numbers:hover,
.directory-pagination .page-numbers.current {
    background: #1565c0;
    color: white;
    border-color: #1565c0;
}

.directory-pagination .prev,
.directory-pagination .next {
    background: #e91e63;
    color: white;
    border-color: #e91e63;
}

.directory-pagination .prev:hover,
.directory-pagination .next:hover {
    background: #c2185b;
}

/* No Results */
.directory-no-results {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(135deg, #e1f5fe 0%, #f3e5f5 100%);
    border: 1px solid #90caf9;
    border-radius: 8px;
}

.directory-no-results p {
    margin: 0;
    color: #1565c0;
    font-size: 1.1rem;
}

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

@media (max-width: 768px) {
    .directory-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .directory-search {
        min-width: auto;
    }
    
    .directory-filters {
        justify-content: center;
    }
    
    .directory-filters select {
        min-width: 120px;
    }
    
    .directory-table-wrapper {
        font-size: 0.875rem;
        overflow-x: auto;
    }
    
    .directory-table th,
    .directory-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .column-actions {
        min-width: 120px;
    }
    
    .directory-cards-grid {
        grid-template-columns: 1fr;
    }
    
    .card-header,
    .list-item-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .card-actions,
    .list-item-actions {
        justify-content: center;
    }
    
    .list-item-field {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .list-item-field strong {
        min-width: auto;
        margin-right: 0;
    }
}

@media (max-width: 480px) {
    .directory-controls {
        padding: 1rem;
    }
    
    .directory-table th,
    .directory-table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
    
    .call-now-button {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .card-content,
    .list-item-content {
        padding: 1rem;
    }
    
    .card-actions,
    .list-item-actions {
        flex-direction: column;
    }
    
    .card-action-button,
    .list-action-button {
        justify-content: center;
    }
}

/* ========================================
   Utility Classes
   ======================================== */

.wp-data-display-directory .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
    line-height: 1;
}

.wp-data-display-directory .dashicons-search {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

/* Loading States */
.directory-loading {
    text-align: center;
    padding: 2rem;
    color: #1565c0;
}

.directory-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #bbdefb;
    border-radius: 50%;
    border-top-color: #1565c0;
    animation: spin 1s ease-in-out infinite;
    margin-left: 0.5rem;
}

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

/* ========================================
   Client-Side Pagination Styles
   ======================================== */

.pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.directory-pagination .page-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    background: white;
    border: 1px solid #bbdefb;
    border-radius: 4px;
    color: #1565c0;
    text-decoration: none;
    transition: all 0.2s;
    min-width: 40px;
    text-align: center;
}

.directory-pagination .page-link:hover {
    background: #1565c0;
    color: white;
    border-color: #1565c0;
}

.directory-pagination .page-link.active {
    background: #1565c0;
    color: white;
    border-color: #1565c0;
}

.directory-pagination .page-ellipsis {
    padding: 0.5rem 0.25rem;
    color: #1565c0;
}

.directory-pagination .prev-page,
.directory-pagination .next-page {
    font-weight: bold;
}