/* =======================================================
   💎 META TAG GENERATOR - ULTRA-PRO CSS (FINAL FIXED)
   ======================================================= */
:root {
    --primary: #2563eb;
    --dark: #0f172a;
    --terminal-bg: #1e293b;
    --terminal-text: #a5b4fc;
    --terminal-highlight: #38bdf8;
    --border: #e2e8f0;
    --bg-light: #f8fafc;
    --success: #22c55e;
    --danger: #ef4444;
}

.dw-saas-wrapper { max-width: 1250px; margin: 40px auto; padding: 0 20px; font-family: 'Plus Jakarta Sans', sans-serif; box-sizing: border-box; }
.dw-saas-wrapper * { box-sizing: border-box; }

.text-gradient { background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: 800; }

.dw-saas-header { text-align: center; margin-bottom: 40px; }
.dw-saas-chip { display: inline-block; padding: 6px 16px; background: #eff6ff; color: var(--primary); border-radius: 100px; font-size: 12px; font-weight: 700; margin-bottom: 12px; letter-spacing: 0.5px; }

/* 🚀 MAIN GRID */
.dw-main-grid { display: grid; grid-template-columns: 1fr 480px; gap: 30px; align-items: start; }

.dw-card { background: #fff; border-radius: 24px; border: 1px solid var(--border); box-shadow: 0 10px 40px rgba(0,0,0,0.04); overflow: hidden; }
.dw-card-header { padding: 20px 25px; border-bottom: 1px solid var(--border); background: var(--bg-light); }
.dw-card-header h3 { font-size: 18px; font-weight: 800; margin: 0; color: var(--dark); }

.dw-form-body { padding: 25px; }
.dw-form-group { margin-bottom: 22px; position: relative; }
.dw-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

.dw-label { display: flex; justify-content: space-between; font-weight: 700; font-size: 14px; margin-bottom: 8px; color: var(--dark); }
.dw-counter { font-size: 12px; color: #64748b; font-weight: 600; }

.dw-input { 
    width: 100%; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); 
    font-size: 14px; outline: none; transition: 0.3s; color: #334155; background: #fff; font-family: inherit;
}
.dw-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37,99,235,0.1); }
select.dw-input { height: 48px; padding: 0 16px; cursor: pointer; line-height: normal; }
.dw-textarea { resize: vertical; min-height: 100px; line-height: 1.5; }
.dw-divider { border: 0; height: 1px; background: var(--border); margin: 30px 0; }

/* Progress Bars */
.dw-progress-bar { width: 100%; height: 4px; background: #e2e8f0; border-radius: 4px; margin-top: 6px; overflow: hidden; }
.dw-progress-fill { height: 100%; width: 0%; background: var(--success); transition: 0.3s ease; }
.dw-progress-fill.over-limit { background: var(--danger); }
.dw-counter.over-limit { color: var(--danger); }

/* 💻 PREVIEW PANEL (Right) */
.dw-terminal-panel { 
    background: #fff; border-color: var(--border); display: flex; flex-direction: column; 
    align-self: start; /* 🔥 THE FIX: Prevents Grid from forcing a bad height */
    position: sticky; top: 20px; 
    border-radius: 24px; overflow: hidden; 
}

/* Tabs Protection */
.dw-preview-tabs { display: flex; background: var(--bg-light); padding: 0 15px; border-bottom: 1px solid var(--border); }
.dw-tab-btn { 
    flex: 1; padding: 16px 5px !important; background: transparent !important; border: none !important; 
    font-size: 14px !important; font-weight: 700 !important; color: #64748b !important; cursor: pointer; 
    border-bottom: 3px solid transparent !important; transition: 0.3s; border-radius: 0 !important; box-shadow: none !important;
}
.dw-tab-btn:hover { background: transparent !important; color: var(--primary) !important; }
.dw-tab-btn.active { color: var(--primary) !important; border-bottom-color: var(--primary) !important; background: transparent !important; }

/* Container Heights Fix */
.dw-preview-container { flex-grow: 1; display: flex; flex-direction: column; background: var(--terminal-bg); }

.dw-tab-content { display: none; flex-direction: column; flex-grow: 1; }
.dw-tab-content.active { display: flex; }

/* 1. Terminal Styles */
.dw-terminal-window { padding: 25px; flex-grow: 1; max-height: 500px; overflow-y: auto; }
.dw-terminal-window::-webkit-scrollbar { width: 8px; }
.dw-terminal-window::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); }
.dw-terminal-window::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }
#live-code-output { margin: 0 !important; padding: 0 !important; background: transparent !important; border: none !important; color: var(--terminal-text) !important; font-family: 'Courier New', Courier, monospace; font-size: 14px; line-height: 1.6; white-space: pre-wrap !important; word-wrap: break-word !important; }

/* 2. Google SERP Preview */
#tab-google { background: #fff; padding: 30px; height: 100%; }
.dw-serp-preview { font-family: Arial, sans-serif; max-width: 100%; }
.dw-serp-url { color: #202124; font-size: 13px; margin-bottom: 4px; display: flex; align-items: center; }
.dw-serp-title { color: #1a0dab; font-size: 20px; font-weight: 400; line-height: 1.3; margin-bottom: 3px; cursor: pointer; }
.dw-serp-title:hover { text-decoration: underline; }
.dw-serp-desc { color: #4d5156; font-size: 14px; line-height: 1.58; word-wrap: break-word; }

/* 3. Social Preview */
#tab-social { background: #f0f2f5; padding: 30px; align-items: center; height: 100%; }
.dw-social-preview { background: #fff; border: 1px solid #dddfe2; border-radius: 8px; width: 100%; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.dw-social-image { width: 100%; height: 200px; background: #e4e6eb; display: flex; align-items: center; justify-content: center; background-size: cover; background-position: center; border-bottom: 1px solid #dddfe2; }
#social-img-placeholder { color: #65676b; font-weight: 600; font-size: 14px; }
.dw-social-text { padding: 15px; }
.dw-social-domain { text-transform: uppercase; color: #65676b; font-size: 12px; margin-bottom: 6px; font-weight: 600; }
.dw-social-title { font-weight: 700; color: #1c1e21; font-size: 16px; margin-bottom: 6px; line-height: 1.3; word-wrap: break-word; }
.dw-social-desc { color: #65676b; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 🔥 THE FIX: Terminal Actions Protection */
.dw-terminal-actions { 
    padding: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 15px; 
    background: var(--terminal-bg); border-top: 1px solid rgba(255,255,255,0.05); 
    margin-top: auto !important; 
    flex-shrink: 0 !important; /* Ye buttons ko compress hone se bachaega */
}
.dw-terminal-actions button { border-radius: 12px !important; padding: 14px 10px !important; font-size: 15px !important; font-weight: 800 !important; display: flex !important; align-items: center !important; justify-content: center !important; width: 100% !important; height: 50px !important; line-height: 1 !important; margin: 0 !important; cursor: pointer; transition: 0.3s; }
.dw-terminal-actions .dw-btn-secondary { background: rgba(255,255,255,0.1) !important; color: #fff !important; border: 1px solid rgba(255,255,255,0.2) !important; }
.dw-terminal-actions .dw-btn-secondary:hover { background: rgba(255,255,255,0.2) !important; }
.dw-terminal-actions .dw-btn-ultimate { background: var(--primary) !important; color: #fff !important; border: none !important; box-shadow: 0 10px 20px rgba(37,99,235,0.3) !important; }
.dw-terminal-actions .dw-btn-ultimate:hover { transform: translateY(-3px) !important; box-shadow: 0 15px 30px rgba(37,99,235,0.4) !important; }

/* =======================================================
   🛡️ HARDCORE MEDIA QUERIES (Bulletproof Auto-Adjust)
   ======================================================= */
@media (max-width: 1024px) {
    .dw-main-grid { grid-template-columns: 1fr; }
    .dw-terminal-panel { position: static; height: auto; min-height: 500px; }
}

@media (max-width: 768px) {
    .dw-saas-header h1 { font-size: 30px; }
    .dw-grid-2 { grid-template-columns: 1fr; gap: 15px; }
}

@media (max-width: 480px) {
    .dw-saas-wrapper { padding: 0 15px; margin: 20px auto; }
    .dw-form-body { padding: 20px 15px; }
    .dw-grid-2 { grid-template-columns: 1fr; gap: 15px; }
    
    .dw-tab-btn { font-size: 11px !important; padding: 15px 2px !important; } /* Fit tabs on small screens */
    .dw-terminal-actions { grid-template-columns: 1fr; }
    #tab-google, #tab-social { padding: 20px 15px; }
}