/* =========================================
   SECTION 1: BRAND THEME
   ========================================= */
:root { 
    --bg-dark: #0f172a; 
    --card-bg: #1e293b; 
    --primary: #06b6d4; 
    --accent: #ec4899; 
    --text-main: #f8fafc; 
    --text-muted: #94a3b8; 
    --border: #334155; 
    --glass: rgba(30, 41, 59, 0.7);
}

* { box-sizing: border-box; }
body { 
    font-family: 'Plus Jakarta Sans', sans-serif; 
    background-color: var(--bg-dark); 
    color: var(--text-main); 
    margin: 0; padding: 0; 
    padding-bottom: 120px; /* Space for Footer */
}

/* Background Effects */
.bg-glow { position: fixed; width: 600px; height: 600px; background: radial-gradient(circle, rgba(6, 182, 212, 0.15) 0%, transparent 70%); top: -200px; left: -200px; z-index: -1; pointer-events: none; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

nav { display: flex; justify-content: space-between; align-items: center; padding: 25px 0; margin-bottom: 30px; border-bottom: 1px solid rgba(51, 65, 85, 0.5); }
.logo { font-size: 1.5rem; font-weight: 800; letter-spacing: -1px; text-decoration: none; color: white; }
.logo span { color: var(--primary); }

.step-container { display: none; animation: slideUp 0.5s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   SECTION 2: UPLOAD GALLERY (Step 1)
   ========================================= */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 24px; padding: 20px 0; align-items: start; }
.sortable-item { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 8px; position: relative; transition: 0.2s; }
.sortable-item img { width: 100%; height: auto; border-radius: 6px; display: block; }
.sortable-item:hover { border-color: var(--primary); transform: translateY(-3px); }

.badge { position: absolute; top: -8px; left: -8px; background: var(--primary); color: #000; font-weight: 700; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; z-index: 10; border: 2px solid var(--bg-dark); font-size: 0.8rem; }
.delete-btn { position: absolute; top: -8px; right: -8px; background: #ef4444; color: white; width: 28px; height: 28px; border-radius: 50%; border:none; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; transition: 0.2s; z-index: 10; }
.sortable-item:hover .delete-btn { opacity: 1; }

.big-upload { border: 2px dashed var(--border); padding: 50px; text-align: center; border-radius: 20px; background: rgba(30, 41, 59, 0.4); cursor: pointer; transition: 0.3s; }
.big-upload:hover { border-color: var(--primary); background: rgba(6, 182, 212, 0.05); }
.add-new-card { border: 2px dashed var(--border); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 200px; cursor: pointer; background: rgba(255,255,255,0.02); transition: 0.3s; }
.add-new-card:hover { border-color: var(--primary); }

/* =========================================
   SECTION 3: PREMIUM AI ANALYSIS UI
   ========================================= */
.analysis-card { 
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.9));
    border-left: 4px solid var(--primary); /* Accent Bar */
    border-radius: 8px; 
    padding: 20px; 
    margin-bottom: 20px; 
    display: flex; 
    gap: 20px; 
    align-items: flex-start;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    animation: fadeIn 0.6s ease;
}

.analysis-thumb { 
    width: 80px; height: 80px; 
    border-radius: 8px; 
    object-fit: cover; 
    border: 1px solid var(--border);
    flex-shrink: 0; 
}

.analysis-content { flex: 1; }

.analysis-header {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ai-dot { width: 8px; height: 8px; background: #10b981; border-radius: 50%; box-shadow: 0 0 10px #10b981; }

.analysis-text { 
    color: #e2e8f0; 
    font-family: 'Courier New', monospace; /* Tech feel */
    font-size: 0.95rem; 
    line-height: 1.6;
}

/* =========================================
   SECTION 4: PERSONA GRID (Perfect 3-Column)
   ========================================= */
.persona-grid { 
    display: grid; 
    /* Desktop: 3 Columns fixed for symmetry */
    grid-template-columns: repeat(3, 1fr); 
    gap: 20px; 
    margin-top: 20px; 
    margin-bottom: 40px; 
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .persona-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .persona-grid { grid-template-columns: 1fr; }
}

.persona-card { 
    background: var(--card-bg); 
    border: 1px solid var(--border); 
    padding: 20px; 
    border-radius: 16px; 
    cursor: pointer; 
    transition: all 0.3s ease; 
    position: relative; 
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.persona-card:hover { 
    transform: translateY(-5px); 
    border-color: var(--text-muted); 
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.persona-card.selected { 
    border-color: var(--primary); 
    background: linear-gradient(145deg, rgba(6, 182, 212, 0.1), rgba(30, 41, 59, 0.4));
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.15);
}

.persona-card.selected::after { 
    content: '✓'; 
    position: absolute; top: 15px; right: 15px; 
    background: var(--primary); color: #000;
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 0.9rem;
}

.p-icon { font-size: 2.5rem; display: block; margin-bottom: 15px; }
.p-name { font-weight: 700; font-size: 1.1rem; color: white; display: block; margin-bottom: 5px; }
.p-role { font-size: 0.85rem; color: var(--text-muted); display: block; margin-bottom: 20px; }

/* Upload Card Special Style */
.upload-json-card { 
    border: 2px dashed var(--accent); 
    background: rgba(236, 72, 153, 0.05); 
    align-items: center; 
    justify-content: center;
    text-align: center;
}
.upload-json-card:hover { background: rgba(236, 72, 153, 0.1); }

/* Buttons & Inputs */
.view-profile-btn { 
    width: 100%; 
    padding: 10px; 
    border-radius: 8px; 
    border: 1px solid rgba(255,255,255,0.1); 
    background: rgba(255,255,255,0.05); 
    color: var(--text-muted); 
    font-size: 0.85rem; 
    cursor: pointer; 
    transition: 0.2s; 
}
.view-profile-btn:hover { background: var(--primary); color: #000; border-color: var(--primary); }

.glass-input { width: 100%; background: #0f172a; border: 1px solid var(--border); padding: 20px; border-radius: 12px; color: white; font-size: 1rem; line-height: 1.5; resize: vertical; }
.glass-input:focus { outline: none; border-color: var(--primary); }

/* =========================================
   SECTION 5: FOOTER & MODAL
   ========================================= */
.fixed-bottom-bar { position: fixed; bottom: 0; left: 0; width: 100%; background: rgba(15, 23, 42, 0.95); backdrop-filter: blur(12px); border-top: 1px solid var(--border); padding: 20px; z-index: 999; display: flex; justify-content: center; box-shadow: 0 -10px 40px rgba(0,0,0,0.5); }

.btn-primary { background: var(--primary); color: #000; padding: 14px 40px; border-radius: 50px; font-weight: 700; border: none; cursor: pointer; transition: 0.3s; font-size: 1rem; box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3); }
.btn-primary:hover { transform: scale(1.05); box-shadow: 0 6px 25px rgba(6, 182, 212, 0.5); }
.btn-secondary { background: transparent; border: 1px solid var(--text-muted); color: var(--text-muted); padding: 14px 30px; border-radius: 50px; cursor: pointer; }
.btn-secondary:hover { border-color: white; color: white; }

/* Modal (Same as before but cleaner) */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); z-index: 1000; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
.modal-box { background: #1e293b; width: 90%; max-width: 550px; border-radius: 20px; padding: 30px; position: relative; border: 1px solid var(--primary); }
.close-modal { position: absolute; top: 15px; right: 20px; font-size: 2rem; cursor: pointer; color: var(--text-muted); }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.progress-bg { background: #334155; height: 6px; border-radius: 10px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; background: var(--primary); width: 0%; }
.tag { display: inline-block; background: #334155; padding: 4px 10px; border-radius: 6px; font-size: 0.8rem; margin: 2px; color: #e2e8f0; }


/* =========================================
   SECTION 6: SIMULATION PAGE (Split View)
   ========================================= */
   
/* Remove bottom padding on simulation page to fit viewport */
body.sim-mode { padding-bottom: 0; overflow: hidden; height: 100vh; }

.split-container {
    display: flex;
    height: calc(100vh - 80px); /* Height minus Navbar */
    margin-top: -20px; /* Adjust spacing */
}

/* --- LEFT: VISUAL PANEL --- */
.visual-panel {
    width: 50%;
    background: #0b1120;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px;
}

.screen-display-area {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.current-screen-img {
    max-width: 90%;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    border: 1px solid var(--border);
    transition: 0.3s;
}

.screen-controls {
    position: absolute;
    bottom: 20px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 10;
}
.control-btn { background: transparent; border: none; color: white; cursor: pointer; font-size: 1.2rem; }
.control-btn:disabled { color: var(--border); cursor: not-allowed; }
.screen-counter { color: var(--primary); font-family: monospace; font-size: 0.9rem; }

/* --- RIGHT: CHAT PANEL --- */
.chat-panel {
    width: 50%;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Chat Tabs */
.chat-tabs {
    display: flex;
    overflow-x: auto;
    background: #0f172a;
    border-bottom: 1px solid var(--border);
    padding: 0 10px;
}
.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 15px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: 0.2s;
}
.tab-btn:hover { color: white; background: rgba(255,255,255,0.02); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: rgba(6, 182, 212, 0.05); }

/* Chat Body (Scrollable) */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
    background-image: radial-gradient(var(--border) 1px, transparent 1px);
    background-size: 20px 20px; /* Subtle Grid Pattern */
    background-color: #0b1120;
}

/* Messages */
.msg-row { display: flex; margin-bottom: 20px; animation: fadeIn 0.3s ease; }
.msg-row.user { justify-content: flex-end; }
.msg-row.ai { justify-content: flex-start; }

.msg-avatar {
    width: 35px; height: 35px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin-right: 10px;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.msg-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
}

.msg-row.ai .msg-bubble {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: #e2e8f0;
    border-top-left-radius: 2px;
}
.msg-row.ai .sender-name {
    display: block; font-size: 0.75rem; color: var(--primary); margin-bottom: 4px; font-weight: 700;
}

.msg-row.user .msg-bubble {
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    color: black;
    border-top-right-radius: 2px;
    font-weight: 500;
}

/* Input Area */
.chat-input-area {
    padding: 20px;
    background: #0f172a;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
}
.chat-input {
    flex: 1;
    background: #1e293b;
    border: 1px solid var(--border);
    color: white;
    padding: 12px 20px;
    border-radius: 30px;
    font-family: inherit;
}
.chat-input:focus { outline: none; border-color: var(--primary); }
.send-btn {
    background: var(--primary);
    color: black;
    border: none;
    width: 45px; height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex; align-items: center; justify-content: center;
}
.send-btn:hover { transform: scale(1.1); }


/* =========================================
   SECTION 7: PDF REPORT STYLING
   ========================================= */

/* =========================================
   SECTION 7: PDF REPORT STYLING (FINAL CLEAN VERSION)
   ========================================= */

/* Ye original template hamesha chhupa rahega */
#report-template {
    display: none !important; 
    background: white;
    color: #0f172a;
    padding: 40px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    
    /* Layout styling */
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

/* Header Styling */
.rep-header {
    border-bottom: 2px solid #06b6d4;
    padding-bottom: 20px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.rep-logo { font-size: 1.5rem; font-weight: 800; color: #0f172a; }
.rep-date { color: #64748b; font-size: 0.9rem; }

/* Section Titles */
.rep-section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #06b6d4;
    margin-top: 30px;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Context Box */
.rep-context-box {
    background: #f1f5f9;
    padding: 15px;
    border-left: 4px solid #06b6d4;
    border-radius: 4px;
    font-style: italic;
    margin-bottom: 20px;
    color: #334155;
}

/* Screen Thumbnails */
.rep-screens-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center; /* Center align images in PDF */
}
.rep-img {
    width: 140px; /* Thoda bada size PDF ke liye */
    height: auto;
    object-fit: contain;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
}

/* Summary Box */
.rep-summary-box {
    border: 1px solid #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    background: #fff;
    margin-bottom: 20px;
}

/* Persona Grid */
.rep-persona-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2 Column Layout */
    gap: 15px;
    margin-top: 20px;
}
.rep-card {
    border: 1px solid #e2e8f0;
    padding: 15px;
    border-radius: 8px;
    background: #f8fafc;
    page-break-inside: avoid; /* Card beech se katega nahi */
}
.rep-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
}
.rep-avatar { font-size: 1.5rem; }
.rep-name { font-weight: 700; font-size: 0.95rem; color: #0f172a; }
.rep-role { font-size: 0.75rem; color: #64748b; display: block;}
.rep-feedback { font-size: 0.85rem; line-height: 1.5; color: #334155; }

/* Header */
.rep-header {
    border-bottom: 2px solid #06b6d4;
    padding-bottom: 20px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.rep-logo { font-size: 1.5rem; font-weight: 800; color: #0f172a; }
.rep-date { color: #64748b; font-size: 0.9rem; }

/* Section Titles */
.rep-section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #06b6d4;
    margin-top: 30px;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Context Box */
.rep-context-box {
    background: #f1f5f9;
    padding: 15px;
    border-left: 4px solid #06b6d4;
    border-radius: 4px;
    font-style: italic;
    margin-bottom: 20px;
}

/* Screen Thumbnails */
.rep-screens-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.rep-img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
}

/* Executive Summary Box */
.rep-summary-box {
    border: 1px solid #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

/* Persona Grid for Report */
.rep-persona-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}
.rep-card {
    border: 1px solid #e2e8f0;
    padding: 15px;
    border-radius: 8px;
    background: #f8fafc;
}
.rep-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
}
.rep-avatar { font-size: 1.5rem; }
.rep-name { font-weight: 700; font-size: 0.95rem; }
.rep-role { font-size: 0.75rem; color: #64748b; display: block;}
.rep-feedback { font-size: 0.85rem; line-height: 1.5; color: #334155; }


/* --- STEP 4 ADDITIONS: PDF FIX & CHAT TAGS --- */

/* 1. Screen Indicator Tag in Chat */
.screen-tag {
    font-size: 0.7rem;
    color: #707517;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
    border: 1px solid #334155;
    vertical-align: middle;
}



/* Report Content Styling */
.rep-header { border-bottom: 2px solid #06b6d4; padding-bottom: 20px; margin-bottom: 30px; display: flex; justify-content: space-between; }
.rep-logo { font-size: 1.5rem; font-weight: 800; color: #0f172a; }
.rep-section-title { font-size: 1.2rem; font-weight: 700; color: #06b6d4; margin-top: 30px; margin-bottom: 15px; text-transform: uppercase; }
.rep-context-box { background: #f1f5f9; padding: 15px; border-left: 4px solid #06b6d4; margin-bottom: 20px; color: #334155; }
.rep-screens-row { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.rep-img { width: 120px; height: auto; border: 1px solid #cbd5e1; border-radius: 4px; }
.rep-persona-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.rep-card { border: 1px solid #e2e8f0; padding: 15px; background: #f8fafc; }
.rep-feedback { font-size: 0.9rem; color: #334155; margin-top: 5px; }


/* =========================================
   SECTION 8: NATIVE PRINT STYLING (NETSKOPE PROOF)
   ========================================= */

/* Default State: Report screen par nahi dikhni chahiye */
#report-template {
    display: none;
}

/* PRINT MEDIA QUERY - Ye tab active hoga jab window.print() chalega */
@media print {
    
    /* 1. Website ke baaki hisse chhupa do */
    nav, 
    .split-container, 
    .screen-controls, 
    .chat-input-area,
    #statusIndicator,
    #downloadBtn {
        display: none !important;
    }

    /* 2. Body settings */
    body {
        background: white;
        margin: 0;
        padding: 0;
        overflow: visible !important;
    }

    /* 3. Report ko Visible karo */
    #report-template {
        display: block !important;
        position: relative;
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 20px;
        background: white;
        color: black;
    }

    /* 4. Page Breaks sambhalo (Taaki Card aadha na kate) */
    .rep-card, .rep-summary-box, .rep-context-box {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .rep-section-title {
        break-after: avoid;
        page-break-after: avoid;
        margin-top: 40px;
    }
    
    /* Images ko clean rakho */
    .rep-img {
        max-width: 150px;
        height: auto;
    }
}


/* Report Chat Log Styling */
.rep-chat-log {
    margin-top: 20px;
    border-top: 2px solid #e2e8f0;
    padding-top: 20px;
}
.rep-chat-row {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #cbd5e1;
}
.rep-chat-user {
    font-weight: 800;
    color: #0f172a;
    background: #f1f5f9;
    padding: 8px 12px;
    border-radius: 6px;
    display: inline-block;
    margin-bottom: 5px;
}
.rep-chat-ai {
    margin-left: 20px;
    color: #334155;
    font-size: 0.95rem;
    margin-top: 4px;
}
.rep-ai-name {
    font-weight: 700;
    color: #06b6d4;
    margin-right: 5px;
}


/* --- 🎙️ MICROPHONE STYLES (NEW) --- */
.input-wrapper {
    position: relative;
    width: 100%;
}

.mic-btn {
    position: absolute;
    right: 10px;
    bottom: 10px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.2rem;
    cursor: pointer;
    transition: 0.2s;
    padding: 5px;
    border-radius: 50%;
}

.mic-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Chat Page Specific Mic Positioning */
.chat-mic {
    position: static; /* Chat page me alag layout hai */
    margin-right: 5px;
    font-size: 1.3rem;
}

/* Listening Animation (Red Pulse) */
.mic-listening {
    color: #ef4444 !important; /* Red Color */
    background: rgba(239, 68, 68, 0.1);
    animation: micPulse 1.5s infinite;
}

@keyframes micPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
