/* Tech Jarvis AI Guest Post Core - Frontend Styles */

:root {
    --tjgpc-radius-btn: 25px;
}

.tjgpc-container,
.tjgpc-container *,
.tjgpc-container *::before,
.tjgpc-container *::after,
.tjgpc-modal,
.tjgpc-modal *,
.tjgpc-modal *::before,
.tjgpc-modal *::after {
    box-sizing: border-box;
}

.tjgpc-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 0;
    overflow-x: hidden;
}

/* Filters */
.tjgpc-filters {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid #e2e8f0;
}

.tjgpc-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.tjgpc-filter-group {
    flex: 1;
    min-width: 140px;
}

.tjgpc-filter-search {
    flex: 2;
    min-width: 220px;
}

.tjgpc-input,
.tjgpc-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    transition: all 0.2s;
    color: #334155;
}

.tjgpc-input:focus,
.tjgpc-select:focus {
    outline: none;
    border-color: var(--tjgpc-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.tjgpc-input-small {
    width: 100%;
    min-width: 0;
    flex: 1 1 72px;
    padding: 8px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 12.5px;
    text-align: center;
    color: #334155;
}

.tjgpc-range-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.tjgpc-range-inputs span {
    color: #94a3b8;
    font-weight: 600;
}

.tjgpc-btn-secondary {
    padding: 10px 18px;
    background: #e2e8f0;
    color: #475569;
    border: none;
    border-radius: var(--tjgpc-radius-btn, 25px);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tjgpc-btn-secondary:hover {
    background: #cbd5e1;
}

/* Results Count */
.tjgpc-results-count {
    font-size: 15px;
    color: #64748b;
    margin-bottom: 16px;
    font-weight: 500;
}

.tjgpc-results-count span {
    color: var(--tjgpc-primary, #2563eb);
    font-weight: 700;
}

/* Grid - responds to the container's own width (auto-fit), not just the
   viewport, so it also behaves inside narrow Elementor columns/sidebars. */
.tjgpc-grid {
    display: grid;
    gap: 20px;
    width: 100%;
}

.tjgpc-grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.tjgpc-grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.tjgpc-grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }

/* Container-query fallback isn't relied on above (minmax(min(),1fr) already
   solves the narrow-parent case); these viewport breakpoints handle general
   tablet/phone sizing and the filter bar. */
@media (max-width: 1024px) {
    .tjgpc-grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
}

@media (max-width: 900px) {
    .tjgpc-filters { padding: 16px; }
    .tjgpc-filter-row { flex-direction: column; align-items: stretch; }
    .tjgpc-filter-group,
    .tjgpc-filter-search { width: 100%; min-width: 0; flex: 1 1 auto; }
    .tjgpc-btn-secondary { width: 100%; }
}

@media (max-width: 640px) {
    .tjgpc-grid-2,
    .tjgpc-grid-3,
    .tjgpc-grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
    .tjgpc-container { padding: 12px 0; }
    .tjgpc-card { padding: 18px 16px; }
}

@media (max-width: 420px) {
    .tjgpc-grid-2,
    .tjgpc-grid-3,
    .tjgpc-grid-4 { grid-template-columns: 1fr; }
    .tjgpc-stats-row { grid-template-columns: repeat(4, 1fr); padding: 12px 6px; gap: 4px; }
    .tjgpc-stat-value { font-size: 15px; }
}

/* Card */
.tjgpc-card {
    background: var(--tjgpc-card-bg, #ffffff);
    border-radius: 16px;
    padding: 24px 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tjgpc-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border-color: #cbd5e1;
}

.tjgpc-badge-niche {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f1f5f9;
    color: #64748b;
    margin-bottom: 10px;
    align-self: flex-start;
}

.tjgpc-website-name {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 16px 0;
    word-break: break-word;
    line-height: 1.3;
}

/* Stats Row */
.tjgpc-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    background: #f8fafc;
    border-radius: 12px;
    padding: 14px 10px;
    margin-bottom: 12px;
}

.tjgpc-stat {
    text-align: center;
}

.tjgpc-stat-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--tjgpc-primary, #2563eb);
    line-height: 1.2;
}

.tjgpc-stat-label {
    display: block;
    font-size: 10px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 3px;
    font-weight: 600;
}

/* Meta */
.tjgpc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
    font-size: 12px;
    color: #64748b;
}

.tjgpc-meta-item strong {
    color: #334155;
    font-weight: 600;
}

/* Price */
.tjgpc-price-section {
    margin-bottom: 16px;
    text-align: center;
}

.tjgpc-price {
    font-size: 26px;
    font-weight: 800;
    color: var(--tjgpc-primary, #2563eb);
    line-height: 1.2;
}

.tjgpc-price-original {
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 2px;
}

.tjgpc-price-original del {
    text-decoration: line-through;
}

.tjgpc-price-sale {
    font-size: 28px;
    font-weight: 800;
    color: var(--tjgpc-accent, #ec4899);
    line-height: 1.2;
}

.tjgpc-price-pkr {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
    font-weight: 500;
}

/* Card Actions */
.tjgpc-card-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

.tjgpc-btn-sample {
    display: block;
    text-align: center;
    padding: 10px;
    background: #f1f5f9;
    color: #334155;
    text-decoration: underline;
    border-radius: var(--tjgpc-radius-btn, 25px);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
}

.tjgpc-btn-sample:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.tjgpc-btn-order {
    display: block;
    width: 100%;
    padding: 13px 20px;
    background: linear-gradient(135deg, var(--tjgpc-primary, #2563eb), var(--tjgpc-secondary, #1d4ed8));
    color: var(--tjgpc-button-text, #ffffff) !important;
    border: none;
    border-radius: var(--tjgpc-radius-btn, 25px);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
    letter-spacing: 0.3px;
}

.tjgpc-btn-order:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
    filter: brightness(1.1);
    color: #ffffff !important;
}

.tjgpc-btn-order:active {
    transform: translateY(0);
}

/* No Data / No Results */
.tjgpc-no-data,
.tjgpc-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
    font-size: 16px;
}

.tjgpc-card.hidden {
    display: none !important;
}

/* ===== MODAL ===== */
.tjgpc-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.tjgpc-modal.active {
    display: flex;
}

.tjgpc-modal-overlay {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.tjgpc-modal-content {
    background: #fff;
    border-radius: 16px;
    max-width: 480px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    z-index: 1;
    animation: tjgpc-slide-up 0.3s ease;
    box-shadow: 0 24px 48px rgba(0,0,0,0.2);
}

@media (max-width: 480px) {
    .tjgpc-modal-content { width: 96%; max-height: 94vh; }
    .tjgpc-modal-header { padding: 22px 18px; }
    .tjgpc-modal-body { padding: 18px; }
}

@keyframes tjgpc-slide-up {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Modal Header - Uses plugin colors via CSS variables */
.tjgpc-modal-header {
    background: linear-gradient(135deg, var(--tjgpc-primary, #2563eb), var(--tjgpc-accent, #ec4899));
    padding: 28px 24px;
    border-radius: 16px 16px 0 0;
    position: relative;
    text-align: center;
}

.tjgpc-modal-header h2 {
    margin: 0 0 6px 0;
    font-size: 20px;
    color: #fff;
    font-weight: 700;
}

.tjgpc-modal-header p {
    margin: 0;
    font-size: 13px;
    color: rgba(255,255,255,0.85);
}

.tjgpc-modal-close {
    position: absolute;
    right: 14px;
    top: 14px;
    font-size: 28px;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.tjgpc-modal-close:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* Modal Body */
.tjgpc-modal-body {
    padding: 24px;
}

.tjgpc-form-group {
    margin-bottom: 18px;
}

.tjgpc-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tjgpc-required {
    color: #ef4444;
}

.tjgpc-form-group .tjgpc-input {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 14px;
    color: #334155;
}

.tjgpc-form-group .tjgpc-input:focus {
    background: #fff;
    border-color: var(--tjgpc-primary, #2563eb);
}

.tjgpc-form-group .tjgpc-input::placeholder {
    color: #94a3b8;
}

/* File Upload */
.tjgpc-file-upload {
    position: relative;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #f8fafc;
}

.tjgpc-file-upload:hover {
    border-color: var(--tjgpc-primary, #2563eb);
    background: #f1f5f9;
}

.tjgpc-file-upload input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.tjgpc-file-label {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: none;
}

.tjgpc-file-icon {
    font-size: 20px;
}

.tjgpc-file-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--tjgpc-primary, #2563eb);
}

.tjgpc-file-hint {
    font-size: 12px;
    color: #94a3b8;
}

.tjgpc-file-upload.has-file {
    border-color: #22c55e;
    background: #f0fdf4;
}

.tjgpc-file-upload.has-file .tjgpc-file-text {
    color: #16a34a;
}

/* Submit Button - FULL WIDTH, 25px radius, uses plugin colors */
.tjgpc-btn-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--tjgpc-primary, #2563eb), var(--tjgpc-accent, #ec4899));
    color: #fff;
    border: none;
    border-radius: var(--tjgpc-radius-btn, 25px);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    line-height: 1.2;
}

.tjgpc-btn-submit:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
    filter: brightness(1.1);
}

.tjgpc-btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.tjgpc-submit-icon {
    font-size: 16px;
    margin-right: 4px;
}

#tjgpc-form-status {
    margin-top: 14px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    min-height: 20px;
    padding: 8px;
    border-radius: 8px;
}

#tjgpc-form-status.success {
    color: #16a34a;
    background: #f0fdf4;
}

#tjgpc-form-status.error {
    color: #dc2626;
    background: #fef2f2;
}
