* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.8s ease-out;
}

.form-container {
    margin-bottom: 30px;
}

.analysis-container {
    max-width: 1200px;
    margin: 30px auto 0 auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideUp 0.8s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 40px;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.analysis-title {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.analysis-content {
    display: flex;
    gap: 30px;
    min-height: 500px;
}

.analysis-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.analysis-right {
    flex: 1.5; /* Give more space to the graph */
}

.vertical-divider {
    width: 2px;
    background: linear-gradient(to bottom, transparent, rgba(102, 126, 234, 0.5), transparent);
    border-radius: 1px;
}

.form-group {
    margin-bottom: 25px;
    animation: fadeIn 0.6s ease-out forwards;
    opacity: 0;
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }
.form-group:nth-child(3) { animation-delay: 0.3s; }
.form-group:nth-child(4) { animation-delay: 0.4s; }
.form-group:nth-child(5) { animation-delay: 0.5s; }
.form-group:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1rem;
}

input[type="text"], select {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

input[type="text"]:focus, select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.form-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.form-col {
    flex: 1;
    min-width: 200px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.checkbox-container input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #667eea;
    cursor: pointer;
}

.checkbox-container label {
    margin: 0;
    cursor: pointer;
    font-weight: 500;
    color: #555;
}

.additional-field {
    margin-top: 15px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    border-left: 4px solid #667eea;
    animation: slideIn 0.5s ease-out;
}

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

.terms-container {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border-radius: 12px;
    border: 2px solid #f39c12;
}

.terms-container label {
    color: #856404;
    font-weight: 600;
}

.submit-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 30px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

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

.category-buttons h3,
.summary-stats h3,
.quick-insights h3,
.graph-container h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3rem;
    font-weight: 600;
}

.button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.category-btn {
    padding: 12px 16px;
    border: none;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    color: white;
}

/* .category-btn:nth-child(1) { background: linear-gradient(135deg, #ff6b6b, #ee5a52); } */
/* .category-btn:nth-child(2) { background: linear-gradient(135deg, #4ecdc4, #44a08d); } */
/* .category-btn:nth-child(3) { background: linear-gradient(135deg, #45b7d1, #96c93d); } */
/* ... Add other colors ... */

.category-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.category-btn.active {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    filter: brightness(1.1);
}

.summary-stats {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 20px;
    border-radius: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
}

.stat-value {
    color: #667eea;
    font-weight: 700;
}

.quick-insights {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    padding: 20px;
    border-radius: 15px;
}

.insight-list {
    max-height: 150px;
    overflow-y: auto;
}

.insight-item {
    padding: 8px 12px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    color: #856404;
    border-left: 3px solid #f39c12;
}

.graph-placeholder {
    flex: 1;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    min-height: 300px;
    text-align: center;
    color: #666;
}

#reportGraph {
    max-width: 100%;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .container {
        padding: 30px 20px;
    }
    
    .analysis-content {
        flex-direction: column;
    }
    
    .vertical-divider {
        width: 100%;
        height: 2px;
        background: linear-gradient(to right, transparent, #667eea, transparent);
    }
}

.category-btn {
    position: relative; /* Needed for positioning the count */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.review-count {
    background-color: rgba(0, 0, 0, 0.2);
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 10px;
}

/* GLOW EFFECT CLASSES */
.glow-positive {
    background: linear-gradient(135deg, #45b7d1, #96c93d);
    box-shadow: 0 0 25px 7.5px rgba(46, 204, 113, 0.7);
}

.glow-negative {
    background: linear-gradient(135deg, #ff6b6b, #eea852);
    box-shadow: 0 0 25px 7.5px rgba(231, 76, 60, 0.7);
}

/* --- Styles for the Upgraded Dashboard --- */
.cc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e9ecef;
}
.cc-business-name {
    font-size: 2.5rem;
    margin: 0;
    color: #2c3e50;
}
.cc-tagline {
    font-size: 1.1rem;
    color: #7f8c8d;
    margin: 0;
}
.logout-btn {
    background: #e74c3c;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    transition: background 0.2s ease;
}
.logout-btn:hover { background: #c0392b; }

.cc-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 30px;
}
.cc-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
    padding: 30px;
}
.card-header h2 {
    font-size: 1.8rem;
    margin: 0 0 5px 0;
}
.card-header p {
    color: #7f8c8d;
    margin: 0;
}
.card-section {
    margin-top: 30px;
}
.card-section h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    border-bottom: 1px solid #f1f3f5;
    padding-bottom: 10px;
}
.target-form-condensed {
    display: flex;
    gap: 10px;
}
.target-form-condensed input {
    flex-grow: 1;
}
.submit-btn-small {
    padding: 15px 25px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s ease;
}
.submit-btn-small:hover { background: #5a67d8; }

.target-list-revamped {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
}
.target-item-revamped {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #f8f9fa;
}
.target-info {
    display: flex;
    flex-direction: column;
}
.target-query { font-weight: bold; }
.target-status-text { font-size: 0.85rem; color: #7f8c8d; }
.action-btn-revamped {
    background: #2ecc71;
    color: white;
    padding: 8px 15px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: bold;
    transition: background 0.2s ease;
}
.action-btn-revamped:hover { background: #27ae60; }
.empty-state-text {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.category-grid-container {
    height: 100%;
    min-height: 400px;
}
.oracle-standby {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    text-align: center;
    color: #bdc3c7;
    border: 3px dashed #e9ecef;
    border-radius: 12px;
    padding: 20px;
}
.oracle-icon {
    font-size: 4rem;
    animation: pulse 2s infinite ease-in-out;
}
.oracle-standby h3 {
    border: none;
    color: #95a5a6;
    margin-top: 15px;
}
@keyframes pulse {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0.7; }
}

@media (max-width: 900px) {
    .cc-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Drill-Down Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}
.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 15px;
    margin-bottom: 20px;
}
.modal-close-btn {
    background: none;
    border: none;
    font-size: 2.5rem;
    cursor: pointer;
    color: #95a5a6;
    line-height: 1;
}
.modal-body-content {
    overflow-y: auto;
}
.phrase-list { list-style: none; }
.phrase-item {
    padding: 15px;
    border-bottom: 1px solid #f1f3f5;
}
.phrase-item .sentiment-pos { color: #27ae60; }
.phrase-item .sentiment-neg { color: #c0392b; }
.review-context {
    font-style: italic;
    color: #7f8c8d;
    margin-top: 5px;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Show only 2 lines */
    -webkit-box-orient: vertical;
}

/* Make pills clickable */
.category-pill { cursor: pointer; }

.add-target-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid #e2e8f0;
}

.add-target-form {
    display: flex;
    gap: 10px;
}

.add-target-form input {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 0.95rem;
}

.add-target-form button {
    background: #667eea;
    color: white;
    border: none;
    padding: 0 25px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.add-target-form button:hover {
    background: #5a67d8;
}
/* ===== Operator console ===================================================== */
.op-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.op-header h1 { margin: 0; font-size: 1.5rem; }
.op-actions { display: flex; gap: 10px; }
.btn { display: inline-block; padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
       font-weight: 600; cursor: pointer; text-decoration: none; font-size: .92rem; }
.btn-primary { background: #5a3bbf; color: #fff; }
.btn-primary:hover { background: #4a2fa0; }
.btn-ghost { background: #fff; color: #5a3bbf; border-color: #d9d2f0; }
.btn-danger { background: #c0392b; color: #fff; }
.btn-danger:hover { background: #a02e22; }
.btn-link-danger { background: none; border: none; padding: 0; color: #c0392b; cursor: pointer;
                   font-size: .92rem; text-decoration: underline; }
.op-row-actions { display: flex; gap: 12px; align-items: center; }
.op-danger { border-color: #f0d4d0; background: #fdf8f7; }
.op-table { width: 100%; border-collapse: collapse; margin-top: 20px; }
.op-table th, .op-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #eee; font-size: .92rem; }
.op-table th { color: #777; font-weight: 600; text-transform: uppercase; font-size: .72rem; letter-spacing: .05em; }
.op-empty { margin-top: 24px; color: #777; }
.op-card { margin-top: 20px; padding: 18px; border: 1px solid #ece9f5; border-radius: 14px; background: #fbfaff; }
.op-card h2 { margin: 0 0 10px; font-size: 1.1rem; }
.op-summary { display: flex; gap: 18px; flex-wrap: wrap; list-style: none; padding: 0; margin: 0 0 12px; }
.op-form { display: flex; flex-direction: column; gap: 12px; max-width: 480px; margin-top: 8px; }
.op-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9rem; }
.op-form input { padding: 9px 12px; border: 1px solid #d6d2e2; border-radius: 9px; font-size: .95rem; }
.op-form input[type="color"] { height: 42px; padding: 4px; }
.op-form label.op-check { flex-direction: row; align-items: center; gap: 8px; cursor: pointer; }
.op-form label.op-check input { width: auto; padding: 0; }
.muted { color: #888; font-weight: 400; font-size: .85rem; }
.candidate-list { list-style: none; padding: 0; margin: 14px 0; }
.candidate-list li { padding: 6px 0; }
.candidate-list label { display: flex; gap: 10px; align-items: baseline; cursor: pointer; }
.candidate-name { font-weight: 600; }
.candidate-meta { color: #888; font-size: .82rem; }
.status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; text-transform: capitalize; background: #eee; color: #555; }
.status-ready { background: #e3f5ea; color: #2f7d4f; }
.status-failed { background: #fbe5e5; color: #b23b3b; }
.status-review_competitors { background: #fff3da; color: #9a6b00; }
.status-scraping, .status-scraping_subject, .status-analyzing, .status-resolving, .status-rediscovering { background: #e7eefb; color: #2f5fb0; }
.notification { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; }
.notification.is-danger { background: #fbe5e5; color: #9a2b2b; }

.op-rediscover { border-top: 1px solid #ece9f5; margin-top: 16px; padding-top: 14px; }
.op-rediscover input[type=text] { padding: 8px 10px; border: 1px solid #d6d2e4; border-radius: 8px; min-width: 240px; margin-right: 8px; }
.op-radius { margin: 12px 0; }
.op-radius > label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.op-radius-controls { display: flex; align-items: center; gap: 10px; max-width: 420px; }
.op-radius-controls input[type=range] { flex: 1; accent-color: #764ba2; }
.op-radius-controls input[type=number] { width: 80px; padding: 8px 10px; border: 1px solid #d6d2e4; border-radius: 8px; }
.op-radius p { margin: 6px 0 0; font-size: .82rem; }

/* Operator: photography-offer flag + reply draft editing */
.op-flag { background: #fff3da; border-radius: 9px; padding: 8px 12px; font-size: .88rem; color: #7a5500; margin: 6px 0 0; }
.op-flag-warn { background: #fbe5e5; color: #9a2b2b; }

/* Operator: per-competitor data health + single-row rescrape */
.comp-health { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid #ece9f5; }
.comp-health:first-of-type { border-top: none; }
.comp-health .muted { display: block; margin-top: 2px; }
.comp-health-empty { background: #fff8f3; border-radius: 9px; padding: 10px 12px; border-top: none; margin-top: 8px; }
.reply-edit { border-top: 1px solid #ece9f5; padding: 14px 0; }
.reply-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.reply-review { margin: 8px 0; padding: 8px 12px; background: #f6f5fb; border-radius: 9px; font-size: .88rem; color: #444; }
.reply-current { background: #fbfaff; border: 1px solid #e4e0f0; border-radius: 9px; padding: 10px 12px; white-space: pre-wrap; }
.reply-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.reply-revise { display: flex; gap: 8px; flex: 1 1 320px; }
.reply-revise input { flex: 1; padding: 8px 11px; border: 1px solid #d6d2e2; border-radius: 9px; font-size: .9rem; }
.status-reply-generated { background: #e7eefb; color: #2f5fb0; }
.status-reply-draft { background: #fff3da; color: #9a6b00; }
.status-reply-confirmed { background: #e3f5ea; color: #2f7d4f; }
