/**
 * PCG Listings Plugin - Frontend Styles
 */

/* ==========================================================================
   General Styles
   ========================================================================== */

.pcg-archive-wrapper,
.pcg-dashboard-wrapper,
.pcg-submission-form-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ==========================================================================
   Filter Form
   ========================================================================== */

.pcg-filter-wrapper {
    background: #f9f9f9;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.pcg-filter-form {
    display: block;
}

.pcg-filter-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.pcg-filter-field {
    flex: 1;
    min-width: 200px;
}

.pcg-filter-field-small {
    flex: 0 0 150px;
}

.pcg-filter-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.pcg-input,
.pcg-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.pcg-input:focus,
.pcg-select:focus {
    outline: none;
    border-color: #0073aa;
}

/* ==========================================================================
   Listings Grid
   ========================================================================== */

.pcg-listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.pcg-listing-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.pcg-listing-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.pcg-listing-card.featured {
    border: 2px solid #ffc107;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
}

.pcg-featured-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ffc107;
    color: #000;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
}

.pcg-listing-image {
    position: relative;
    height: 220px;
    overflow: hidden;
    background: #f5f5f5;
}

.pcg-listing-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.pcg-listing-card:hover .pcg-listing-image img {
    transform: scale(1.05);
}

.pcg-no-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 14px;
}

.pcg-listing-content {
    padding: 15px;
}

.pcg-listing-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    line-height: 1.4;
}

.pcg-listing-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.pcg-listing-title a:hover {
    color: #0073aa;
}

.pcg-listing-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #666;
}

.pcg-location .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    vertical-align: middle;
}

.pcg-listing-price {
    font-size: 24px;
    font-weight: bold;
    color: #0073aa;
}

.pcg-negotiable-badge {
    display: inline-block;
    margin-left: 10px;
    padding: 3px 8px;
    background: #e7f5ff;
    color: #0073aa;
    font-size: 12px;
    border-radius: 3px;
    font-weight: normal;
}

/* ==========================================================================
   Single Listing
   ========================================================================== */

.pcg-single-listing {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.pcg-featured-banner {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #000;
    text-align: center;
    padding: 12px;
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 20px;
    border-radius: 8px;
}

.pcg-featured-star {
    font-size: 20px;
    margin-right: 8px;
}

.pcg-listing-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.pcg-listing-gallery {
    position: sticky;
    top: 20px;
}

.pcg-main-image {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
    background: #f5f5f5;
}

.pcg-main-image img {
    width: 100%;
    height: auto;
    display: block;
}

.pcg-thumbnail-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}

.pcg-thumbnail {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.pcg-thumbnail:hover,
.pcg-thumbnail.active {
    border-color: #0073aa;
    transform: scale(1.05);
}

.pcg-listing-details {
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.pcg-listing-details .pcg-listing-title {
    font-size: 20px;
    margin-bottom: 20px;
    line-height: 1.3;
    font-weight: 600;
}

.pcg-price-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.pcg-price {
    font-size: 36px;
    font-weight: bold;
    color: #0073aa;
}

.pcg-negotiable-text {
    display: inline-block;
    margin-left: 15px;
    padding: 5px 12px;
    background: #e7f5ff;
    color: #0073aa;
    font-size: 14px;
    border-radius: 4px;
}

.pcg-meta-info {
    margin-bottom: 25px;
}

.pcg-meta-item {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 15px;
}

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

.pcg-meta-item strong {
    display: inline-block;
    min-width: 100px;
    color: #666;
}

.pcg-description-section {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.pcg-description-section h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 24px;
}

.pcg-description-content {
    line-height: 1.8;
    font-size: 16px;
    color: #333;
}

/* ==========================================================================
   Phone Reveal
   ========================================================================== */

.pcg-phone-reveal {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pcg-reveal-phone-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.pcg-reveal-phone-btn:hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.pcg-reveal-phone-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.pcg-phone-link {
    font-size: 16px;
    font-weight: 600;
    color: #0073aa;
    text-decoration: none;
    transition: color 0.3s;
}

.pcg-phone-link:hover {
    color: #005a87;
    text-decoration: underline;
}

/* ==========================================================================
   Auth Modal
   ========================================================================== */

.pcg-auth-required {
    max-width: 600px;
    margin: 40px auto;
    text-align: center;
}

.pcg-auth-notice {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.pcg-auth-notice p {
    font-size: 18px;
    margin-bottom: 20px;
    color: #333;
}

.pcg-auth-step {
    margin-top: 20px;
}

.pcg-auth-step p {
    color: #666;
    margin-bottom: 20px;
}

.pcg-button-secondary {
    background: #6c757d;
    color: #fff;
    margin-top: 10px;
}

.pcg-button-secondary:hover {
    background: #5a6268;
}

#verify_code {
    text-align: center;
    font-size: 24px;
    letter-spacing: 4px;
    font-weight: 600;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.pcg-button {
    display: inline-block;
    padding: 12px 24px;
    background: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.pcg-button:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.pcg-button-primary {
    background: #0073aa;
    color: #fff;
}

.pcg-button-primary:hover {
    background: #005a87;
}

.pcg-button-danger {
    background: #dc3545;
    color: #fff;
}

.pcg-button-danger:hover {
    background: #c82333;
}

.pcg-button-large {
    width: 100%;
    padding: 15px 24px;
    font-size: 17px;
}

.pcg-button-small {
    padding: 6px 12px;
    font-size: 13px;
}

.pcg-button .dashicons {
    vertical-align: middle;
    margin-right: 5px;
}

/* ==========================================================================
   Modal
   ========================================================================== */

.pcg-modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    overflow: auto;
}

.pcg-modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    position: relative;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.pcg-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    transition: color 0.3s;
}

.pcg-modal-close:hover {
    color: #000;
}

.pcg-modal-content h2 {
    margin-top: 0;
    margin-bottom: 25px;
}

/* Edit Warning Box */
.pcg-edit-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-left: 4px solid #f39c12;
    color: #856404;
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pcg-edit-warning .dashicons {
    color: #f39c12;
    font-size: 20px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.pcg-edit-warning strong {
    font-weight: 600;
}

/* ==========================================================================
   Form Styles
   ========================================================================== */

.pcg-form-group {
    margin-bottom: 20px;
}

.pcg-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.pcg-form-group .required {
    color: #dc3545;
}

.pcg-input,
.pcg-select,
.pcg-input-file {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    background-color: #ffffff !important;
    color: #333333 !important;
}

/* Force visible text in all inputs regardless of theme */
.pcg-input:focus,
.pcg-select:focus,
.pcg-input-file:focus,
input[type="text"].pcg-input,
input[type="number"].pcg-input,
input[type="email"].pcg-input,
input[type="tel"].pcg-input,
textarea.pcg-input,
select.pcg-select {
    background-color: #ffffff !important;
    color: #333333 !important;
}

textarea.pcg-input {
    resize: vertical;
    min-height: 100px;
}

/* WordPress Editor (TinyMCE/wp_editor) Fixes for Dark/Light Themes */
#pcg_description_ifr,
.mce-edit-area iframe,
.wp-editor-area {
    background-color: #ffffff !important;
}

#pcg_description_ifr body,
.mce-edit-area iframe body,
.wp-editor-area {
    background-color: #ffffff !important;
    color: #333333 !important;
}

/* TinyMCE toolbar buttons visibility fix */
.mce-toolbar .mce-btn,
.mce-toolbar .mce-btn button,
.mce-menubtn button,
.mce-splitbtn button {
    background-color: #f5f5f5 !important;
    color: #333333 !important;
    border-color: #ddd !important;
}

.mce-toolbar .mce-btn:hover,
.mce-toolbar .mce-btn:hover button,
.mce-menubtn:hover button,
.mce-splitbtn:hover button {
    background-color: #e0e0e0 !important;
    color: #000000 !important;
}

/* TinyMCE icon colors */
.mce-ico {
    color: #333333 !important;
}

/* WordPress visual/text editor tabs */
.wp-switch-editor {
    background-color: #f5f5f5 !important;
    color: #333333 !important;
    border-color: #ddd !important;
}

.wp-switch-editor:hover {
    background-color: #e0e0e0 !important;
}

/* Text editor in text mode */
.wp-editor-container textarea {
    background-color: #ffffff !important;
    color: #333333 !important;
}

/* MCE panel and containers */
.mce-panel,
.mce-container,
.mce-container-body {
    background-color: #f5f5f5 !important;
    color: #333333 !important;
}

/* Additional editor wrapper fixes */
#wp-pcg_description-wrap,
.wp-editor-wrap {
    background-color: #ffffff !important;
}

.pcg-help-text {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
}

.pcg-form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.pcg-col-6 {
    flex: 1;
    min-width: 250px;
}

.pcg-image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.pcg-image-preview img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid #ddd;
}

/* ==========================================================================
   Dashboard
   ========================================================================== */

.pcg-dashboard-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid #e0e0e0;
}

.pcg-tab {
    padding: 12px 20px;
    background: #f5f5f5;
    border: none;
    border-radius: 4px 4px 0 0;
    color: #666;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.pcg-tab:hover {
    background: #e0e0e0;
    color: #333;
}

.pcg-tab.active {
    background: #0073aa;
    color: #fff;
}

.pcg-listings-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.pcg-listings-table thead {
    background: #f9f9f9;
}

.pcg-listings-table th,
.pcg-listings-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.pcg-listings-table th {
    font-weight: 600;
    color: #666;
    font-size: 14px;
}

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

.pcg-listings-table tbody tr:hover {
    background: #f5f5f5;
}

.pcg-listing-image img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.pcg-no-image {
    width: 60px;
    height: 60px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #999;
}

.pcg-listing-actions {
    white-space: nowrap;
}

.pcg-listing-actions .pcg-button {
    margin-right: 5px;
    margin-bottom: 5px;
}

/* ==========================================================================
   Notices
   ========================================================================== */

.pcg-notice {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    border-left: 4px solid;
}

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

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

.pcg-notice-info {
    background: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

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

.pcg-pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 30px;
}

.pcg-page-btn {
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.pcg-page-btn:hover {
    background: #f0f0f0;
}

.pcg-page-btn.active {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.pcg-listings-loading {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #666;
}

.pcg-no-results {
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: #999;
    background: #f9f9f9;
    border-radius: 8px;
}

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

@media (max-width: 768px) {
    .pcg-listing-container {
        grid-template-columns: 1fr;
    }
    
    /* Remove sticky positioning on mobile to prevent content scrolling under images */
    .pcg-listing-gallery {
        position: static;
    }
    
    .pcg-filter-row {
        flex-direction: column;
    }
    
    .pcg-filter-field,
    .pcg-filter-field-small {
        width: 100%;
        min-width: 100%;
    }
    
    .pcg-listings-grid {
        grid-template-columns: 1fr;
    }
    
    .pcg-dashboard-tabs {
        flex-wrap: wrap;
    }
    
    .pcg-listings-table {
        font-size: 14px;
    }
    
    .pcg-listings-table th,
    .pcg-listings-table td {
        padding: 10px;
    }
}
