/**
 * Frontend CSS for Business Directory
 */

/* Dashboard Styles */
.wpib-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.wpib-dashboard-header h3 {
    margin: 0;
    color: #333;
}

#wpib-add-new-listing {
    background-color: #0073aa;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
}

#wpib-add-new-listing:hover {
    background-color: #005177;
}

/* Listings Container */
#wpib-listings-container {
    margin-top: 20px;
}

/* Table Styles */
.wpib-table-container {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    border: 1px solid #e1e5e9;
}

.wpib-listings-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 14px;
    table-layout: fixed;
}

.wpib-listings-table thead {
    background-color: #dee2e6;
    color: #000000;
}

.wpib-listings-table th {
    padding: 18px 8px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    position: relative;
}

.wpib-listings-table th:after {
    content: '';
    position: absolute;
    right: 0;
    top: 25%;
    height: 50%;
    width: 1px;
    background: rgba(255,255,255,0.2);
}

.wpib-listings-table th:last-child:after {
    display: none;
}

.wpib-listings-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
    color: #495057;
}

.wpib-listings-table tbody tr {
    transition: background-color 0.2s ease;
}

.wpib-listings-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.wpib-listings-table tbody tr:hover {
    background-color: #e9ecef;
}

.wpib-listings-table tbody tr:last-child td {
    border-bottom: none;
}

/* Column Widths */
.wpib-col-number {
    width: 50px;
    text-align: center;
}

.wpib-col-logo {
    width: 60px;
    text-align: center;
}

.wpib-col-name {
    width: auto;
    min-width: 200px;
}

.wpib-col-phone {
    width: 130px;
}

.wpib-col-status {
    width: 100px;
    text-align: center;
}

.wpib-col-modified {
    width: 120px;
}

.wpib-col-actions {
    width: 110px;
    text-align: center;
}

/* Table Logo */
.wpib-table-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0 auto;
}

.wpib-table-logo img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wpib-no-logo {
    background: #f8f9fa;
    border-radius: 6px;
    border: 2px dashed #dee2e6;
}

.wpib-no-logo .dashicons {
    color: #6c757d;
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Pagination */
.wpib-pagination {
    display: flex;
    justify-content: center;
    margin: 16px 0;
}
.wpib-pagination .wpib-page-links {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}
.wpib-pagination a,
.wpib-pagination .wpib-page-number,
.wpib-pagination .wpib-page-prev,
.wpib-pagination .wpib-page-next {
    padding: 6px 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    text-decoration: none;
    color: #0073aa;
    background: #fff;
    font-size: 13px;
}
.wpib-pagination a:hover { background: #f5f5f5; }
.wpib-pagination .current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}
.wpib-pagination .disabled {
    color: #9aa0a6;
    border-color: #e1e5e9;
    background: #f8f9fa;
    cursor: not-allowed;
}

/* Status Badges */
.wpib-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.wpib-status-pending {
    background-color: #cf9c02;
    color: #ffffff;
}

.wpib-status-publish {
    background-color: #28a745;
    color: white;
}

.wpib-status-draft {
    background-color: #6c757d;
    color: white;
}

/* Bootstrap-style Button System */
.wpib-btn-group {
    display: inline-flex;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.wpib-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid;
    background: white;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
    font-size: 12px;
    line-height: 1;
    position: relative;
    margin: 0;
    border-radius: 0;
}

.wpib-btn:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.wpib-btn:disabled,
.wpib-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.wpib-btn:not(:disabled):not(.disabled) {
    cursor: pointer;
}

/* Button Sizes */
.wpib-btn-sm {
    width: 28px;
    height: 28px;
    font-size: 11px;
}

.wpib-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.wpib-btn-sm .dashicons {
    font-size: 12px;
    width: 12px;
    height: 12px;
}

/* Button Variants */
.wpib-btn-primary {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.wpib-btn-primary:hover {
    color: #fff;
    background-color: #0056b3;
    border-color: #004085;
}

.wpib-btn-danger {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

.wpib-btn-danger:hover {
    color: #fff;
    background-color: #c82333;
    border-color: #bd2130;
}

.wpib-btn-success {
    color: #fff;
    background-color: #28a745;
    border-color: #28a745;
}

.wpib-btn-success:hover {
    color: #fff;
    background-color: #218838;
    border-color: #1e7e34;
}

/* Button group borders */
.wpib-btn-group .wpib-btn:not(:first-child) {
    border-left: none;
}

.wpib-btn-group .wpib-btn:first-child {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

.wpib-btn-group .wpib-btn:last-child {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.wpib-btn-group .wpib-btn:hover {
    z-index: 1;
}

/* Legacy listing item styles (kept for backward compatibility) */

.wpib-listing-item {
    border: 1px solid #ddd;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

.wpib-listing-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.wpib-listing-item h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 18px;
}

.wpib-listing-item p {
    margin: 5px 0;
    color: #666;
    line-height: 1.5;
}

.wpib-listing-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.wpib-listing-actions button,
.wpib-listing-actions .button {
    margin-right: 10px;
    margin-bottom: 5px;
    padding: 8px 15px;
    border-radius: 3px;
    text-decoration: none;
    display: inline-block;
    border: 1px solid #ccc;
    background-color: #f7f7f7;
    color: #333;
    cursor: pointer;
    font-size: 13px;
}

.wpib-listing-actions button:hover,
.wpib-listing-actions .button:hover {
    background-color: #e7e7e7;
}

.wpib-edit-listing {
    background-color: #0073aa !important;
    color: white !important;
    border-color: #0073aa !important;
}

.wpib-edit-listing:hover {
    background-color: #005177 !important;
}

.wpib-delete-listing {
    background-color: #dc3232 !important;
    color: white !important;
    border-color: #dc3232 !important;
}

.wpib-delete-listing:hover {
    background-color: #a00 !important;
}

/* Status Styles */
.wpib-status {
    font-weight: bold;
    text-transform: capitalize;
}

/* Modal Styles */
.wpib-modal {
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 70px;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    display: none;
}

.wpib-modal-content {
    position: relative;
    background-color: #fefefe;
    margin: 3% auto;
    padding: 0;
    border: 1px solid #888;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.wpib-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    padding: 10px 15px;
    line-height: 1;
}

.wpib-close:hover,
.wpib-close:focus {
    color: #000;
    text-decoration: none;
}

#wpib-modal-body {
    padding: 20px;
}

/* Form Styles */
#wpib-listing-form {
    max-width: 100%;
}

#wpib-listing-form h3 {
    margin: 0 0 20px 0;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 2px solid #0073aa;
}

.wpib-form-row {
    margin-bottom: 20px;
}

.wpib-form-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.wpib-form-row input,
.wpib-form-row textarea,
.wpib-form-row select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

.wpib-form-row input:focus,
.wpib-form-row textarea:focus,
.wpib-form-row select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 5px rgba(0, 115, 170, 0.3);
}

.wpib-form-row textarea {
    resize: vertical;
    min-height: 100px;
}

.wpib-form-row small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
    font-style: italic;
}

.wpib-form-row-group {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.wpib-form-row-group .wpib-form-row {
    flex: 1;
    margin-bottom: 0;
}

/* Tags Styles */
.wpib-tags-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fafafa;
}

.wpib-tag-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal !important;
    margin: 0;
    padding: 5px 8px;
    border-radius: 3px;
    background-color: white;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.wpib-tag-item:hover {
    background-color: #f0f0f0;
}

.wpib-tag-item input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Current Logo Display */
.current-logo {
    margin-top: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
}

.current-logo p {
    margin: 0 0 10px 0;
    font-weight: 600;
    color: #333;
}

.current-logo img {
    max-width: 150px;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Form Actions */
.wpib-form-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: right;
}

.wpib-form-actions button {
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    margin-left: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wpib-form-actions .button-primary {
    background-color: #0073aa;
    color: white;
    border: 1px solid #0073aa;
}

.wpib-form-actions .button-primary:hover {
    background-color: #005177;
    border-color: #005177;
}

.wpib-form-actions .wpib-cancel-btn {
    background-color: #f7f7f7;
    color: #333;
    border: 1px solid #ccc;
}

.wpib-form-actions .wpib-cancel-btn:hover {
    background-color: #e7e7e7;
}

/* Loading Styles */
.wpib-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

.wpib-loading:before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: wpib-spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes wpib-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notice Styles */
.wpib-notice {
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 6px;
    border-left: 4px solid;
    font-size: 14px;
    line-height: 1.5;
}

.wpib-notice-success {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.wpib-notice-error {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wpib-modal-content {
        width: 95% !important;
        margin: 2% auto !important;
        max-height: 95vh;
    }
    
    .wpib-form-row-group {
        flex-direction: column !important;
        gap: 0 !important;
    }
    
    .wpib-form-row-group .wpib-form-row {
        margin-bottom: 20px;
    }
    
    .wpib-dashboard-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px;
    }
    
    .wpib-dashboard-header h3 {
        margin-bottom: 0 !important;
    }
    
    .wpib-tags-list {
        grid-template-columns: 1fr 1fr;
        max-height: 150px;
    }
    
    /* Mobile table styling */
    .wpib-table-container {
        border-radius: 4px;
        margin: 0 -10px;
    }
    
    .wpib-listings-table {
        font-size: 12px;
    }
    
    .wpib-listings-table th,
    .wpib-listings-table td {
        padding: 8px 4px;
    }
    
    /* Hide less important columns on mobile */
    .wpib-col-number,
    .wpib-col-phone,
    .wpib-col-modified {
        display: none;
    }
    
    /* Adjust remaining column widths for mobile */
    .wpib-col-logo {
        width: 50px;
    }
    
    .wpib-col-name {
        min-width: 120px;
    }
    
    .wpib-col-status {
        width: 80px;
    }
    
    .wpib-col-actions {
        width: 90px;
    }
    
    .wpib-table-logo {
        width: 35px;
        height: 35px;
    }
    
    .wpib-table-logo img {
        width: 35px;
        height: 35px;
    }
    
    .wpib-no-logo .dashicons {
        font-size: 16px;
        width: 16px;
        height: 16px;
    }
    
    .wpib-btn-group {
        flex-direction: column;
        border-radius: 3px;
    }
    
    .wpib-btn-sm {
        width: 24px;
        height: 24px;
    }
    
    .wpib-btn-sm .dashicons {
        font-size: 10px;
        width: 10px;
        height: 10px;
    }
    
    .wpib-btn-group .wpib-btn:not(:first-child) {
        border-left: 1px solid;
        border-top: none;
    }
    
    .wpib-btn-group .wpib-btn:first-child {
        border-radius: 3px 3px 0 0;
    }
    
    .wpib-btn-group .wpib-btn:last-child {
        border-radius: 0 0 3px 3px;
    }
    
    .wpib-status-badge {
        font-size: 9px;
        padding: 3px 6px;
    }
    
    /* Legacy listing actions for backward compatibility */
    .wpib-listing-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .wpib-listing-actions button,
    .wpib-listing-actions .button {
        flex: 1;
        min-width: 80px;
        margin: 0;
        text-align: center;
    }
    
    .wpib-form-actions {
        text-align: center;
    }
    
    .wpib-form-actions button {
        display: block;
        width: 100%;
        margin: 5px 0;
    }
}

@media (max-width: 480px) {
    .wpib-tags-list {
        grid-template-columns: 1fr;
    }
    
    .wpib-listing-item {
        padding: 15px;
    }
    
    .wpib-listing-item h4 {
        font-size: 16px;
    }
    
    #wpib-modal-body {
        padding: 15px;
    }
}

.ib-manage-listings-login-notice {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 4px;
    padding: 15px;
    margin: 20px 0;
    text-align: center;
    font-size: 20px;
}

.ib-manage-listings-login-button {
    display: inline-block;
    background-color: #FBB202;
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 4px;
    margin-top: 10px;
    transition: background-color 0.3s ease;
}

.ib-manage-listings-login-button:hover {
    background-color: #e09a00;
    color: white;
    text-decoration: none;
}