/* CSP Evaluator Page Styles */

/* Main Container */
.csp-evaluator {
    padding: 2rem 0 4rem;
    min-height: calc(100vh - 400px);
}

.evaluator-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Input Section */
.csp-input-section {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.input-card {
    background: var(--bg-card);
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
}

.input-header {
    margin-bottom: 1rem;
}

.input-header h3 {
    color: var(--neon-green);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#cspInput {
    width: 100%;
    min-height: 200px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 255, 65, 0.3);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#cspInput:focus {
    outline: none;
    border-color: var(--neon-green);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.2);
}

#cspInput::placeholder {
    color: var(--text-muted);
}

.input-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.analyze-btn {
    flex: 1;
    background: linear-gradient(135deg, var(--neon-green), var(--neon-cyan));
    color: #000;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.analyze-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.4);
}

.clear-btn {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    border-color: var(--neon-pink);
    color: var(--neon-pink);
}

/* Example CSP Section */
.example-csp-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.example-csp-section h4 {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.example-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.example-btn {
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid rgba(0, 255, 65, 0.3);
    color: var(--neon-green);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.example-btn:hover {
    background: rgba(0, 255, 65, 0.2);
    transform: translateY(-1px);
}

/* Results Section */
.csp-results-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Score Card */
.score-card {
    background: var(--bg-card);
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
}

.score-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.score-header h3 {
    color: var(--neon-green);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.export-btn {
    background: transparent;
    border: 1px solid rgba(0, 245, 255, 0.5);
    color: var(--neon-cyan);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.export-btn:hover {
    background: rgba(0, 245, 255, 0.1);
}

.score-display {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: rgba(0, 0, 0, 0.4);
    border: 4px solid;
}

.score-circle.score-critical { border-color: #ff4444; }
.score-circle.score-low { border-color: #ff8800; }
.score-circle.score-medium { border-color: #ffcc00; }
.score-circle.score-high { border-color: #44ff44; }
.score-circle.score-excellent { border-color: var(--neon-green); }

.score-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.score-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.score-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    flex: 1;
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
}

.summary-item .count {
    font-size: 1.5rem;
    font-weight: 700;
}

.summary-item .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.summary-item.critical .count { color: #ff4444; }
.summary-item.high .count { color: #ff8800; }
.summary-item.medium .count { color: #ffcc00; }
.summary-item.low .count { color: #00aaff; }

/* Common Card Styles */
.directives-card,
.findings-card,
.bypasses-card {
    background: var(--bg-card);
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.card-header h3 {
    color: var(--neon-green);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    transition: transform 0.3s ease;
}

.toggle-btn.collapsed i {
    transform: rotate(-90deg);
}

.findings-count,
.bypasses-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.card-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.export-btn {
    background: linear-gradient(135deg, rgba(0, 245, 255, 0.2) 0%, rgba(0, 245, 255, 0.1) 100%);
    border: 1px solid rgba(0, 245, 255, 0.4);
    color: var(--neon-cyan);
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.3s ease;
}

.export-btn:hover {
    background: linear-gradient(135deg, rgba(0, 245, 255, 0.35) 0%, rgba(0, 245, 255, 0.2) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 245, 255, 0.2);
}

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

.export-btn i {
    font-size: 0.75rem;
}

/* Directives List */
.directives-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.directive-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

.directive-name {
    color: var(--neon-cyan);
    font-weight: 600;
    min-width: 120px;
}

.directive-values {
    color: var(--text-secondary);
    word-break: break-all;
}

.directive-value {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin: 0.15rem;
}

.directive-value.unsafe {
    background: rgba(255, 68, 68, 0.2);
    color: #ff6b6b;
}

.directive-value.wildcard {
    background: rgba(255, 136, 0, 0.2);
    color: #ffaa44;
}

.directive-value.secure {
    background: rgba(0, 255, 65, 0.2);
    color: #44ff44;
}

.directive-item.invalid {
    border-left: 3px solid #ff8800;
    padding-left: 0.5rem;
}

.directive-name.invalid {
    color: #ff8800;
}

/* Findings List */
.findings-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.finding-item {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 1rem;
    border-left: 4px solid;
}

.finding-item.critical { border-left-color: #ff4444; }
.finding-item.high { border-left-color: #ff8800; }
.finding-item.medium { border-left-color: #ffcc00; }
.finding-item.low { border-left-color: #00aaff; }
.finding-item.info { border-left-color: #888888; }

.finding-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.severity-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.severity-badge.critical { background: rgba(255, 68, 68, 0.2); color: #ff4444; }
.severity-badge.high { background: rgba(255, 136, 0, 0.2); color: #ff8800; }
.severity-badge.medium { background: rgba(255, 204, 0, 0.2); color: #ffcc00; }
.severity-badge.low { background: rgba(0, 170, 255, 0.2); color: #00aaff; }
.severity-badge.info { background: rgba(136, 136, 136, 0.2); color: #888888; }

.finding-directive {
    font-family: 'JetBrains Mono', monospace;
    color: var(--neon-cyan);
    font-size: 0.85rem;
}

.finding-title {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.finding-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.finding-recommendation {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(0, 255, 65, 0.1);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--neon-green);
}

.finding-recommendation i {
    margin-right: 0.5rem;
}

/* Bypass List */
.bypasses-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.bypass-item {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(20, 20, 30, 0.6) 100%);
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid rgba(255, 0, 128, 0.2);
    transition: all 0.3s ease;
}

.bypass-item:hover {
    border-color: rgba(255, 0, 128, 0.5);
    box-shadow: 0 4px 20px rgba(255, 0, 128, 0.1);
}

.bypass-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bypass-type {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bypass-type i {
    color: var(--neon-pink);
    font-size: 0.9rem;
}

.bypass-type span {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.bypass-domain {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--neon-cyan);
    background: rgba(0, 245, 255, 0.15);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    border: 1px solid rgba(0, 245, 255, 0.3);
}

.bypass-description {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.bypass-payload {
    background: rgba(0, 0, 0, 0.6);
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 65, 0.15);
    overflow: hidden;
}

.bypass-payload code {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--neon-green);
    padding: 1rem 1.25rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.copy-payload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    background: linear-gradient(90deg, rgba(0, 255, 65, 0.1) 0%, rgba(0, 255, 65, 0.05) 100%);
    border: none;
    border-top: 1px solid rgba(0, 255, 65, 0.15);
    color: var(--neon-green);
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-payload-btn:hover {
    background: linear-gradient(90deg, rgba(0, 255, 65, 0.25) 0%, rgba(0, 255, 65, 0.15) 100%);
}

.copy-payload-btn:active {
    background: var(--neon-green);
    color: #000;
}

.copy-payload-btn i {
    font-size: 0.85rem;
}

.bypass-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.bypass-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Empty message styling */
.bypasses-list .empty-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-size: 0.95rem;
    background: rgba(0, 255, 65, 0.05);
    border-radius: 10px;
    border: 1px dashed rgba(0, 255, 65, 0.2);
}

/* Results Placeholder */
.results-placeholder {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-card);
    border: 1px dashed rgba(0, 255, 65, 0.3);
    border-radius: 16px;
}

.placeholder-icon {
    font-size: 4rem;
    color: var(--neon-green);
    opacity: 0.3;
    margin-bottom: 1rem;
}

.results-placeholder h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.results-placeholder p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.placeholder-features {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.placeholder-features .feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.placeholder-features .feature i {
    color: var(--neon-green);
}

/* CSP Reference Section */
.csp-reference {
    background: var(--bg-card);
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: 16px;
    padding: 2rem;
    backdrop-filter: blur(10px);
}

.csp-reference h3 {
    color: var(--neon-green);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reference-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.reference-item {
    background: rgba(0, 0, 0, 0.3);
    padding: 1.25rem;
    border-radius: 12px;
    border-left: 3px solid var(--neon-cyan);
}

.reference-item h4 {
    color: var(--neon-cyan);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.reference-item p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--neon-green);
    color: #000;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .reference-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 992px) {
    .evaluator-container {
        grid-template-columns: 1fr;
    }

    .csp-input-section {
        position: static;
    }

    .score-display {
        flex-direction: column;
        text-align: center;
    }

    .score-summary {
        width: 100%;
    }
}

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

    .input-actions {
        flex-direction: column;
    }

    .example-buttons {
        flex-direction: column;
    }

    .example-btn {
        width: 100%;
        text-align: center;
    }

    .bypass-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .bypass-payload code {
        font-size: 0.75rem;
        padding: 0.85rem 1rem;
    }

    .bypasses-list {
        max-height: none;
        padding-right: 0;
    }

    .finding-header {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .csp-evaluator {
        padding: 1rem 0 2rem;
    }

    .input-card,
    .score-card,
    .directives-card,
    .findings-card,
    .bypasses-card,
    .csp-reference {
        padding: 1rem;
        border-radius: 12px;
    }

    .score-circle {
        width: 100px;
        height: 100px;
    }

    .score-value {
        font-size: 2rem;
    }

    .directive-item {
        flex-direction: column;
    }

    .directive-name {
        min-width: auto;
    }
}

/* Scrollbar Styling */
.directives-list::-webkit-scrollbar,
.findings-list::-webkit-scrollbar,
.bypasses-list::-webkit-scrollbar {
    width: 6px;
}

.directives-list::-webkit-scrollbar-track,
.findings-list::-webkit-scrollbar-track,
.bypasses-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.directives-list::-webkit-scrollbar-thumb,
.findings-list::-webkit-scrollbar-thumb,
.bypasses-list::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 65, 0.3);
    border-radius: 3px;
}

.directives-list::-webkit-scrollbar-thumb:hover,
.findings-list::-webkit-scrollbar-thumb:hover,
.bypasses-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 65, 0.5);
}
