agentic-defensor / src /utils /styles.py
vichudo's picture
chore: restructure architecture
d9feb53
Raw
History Blame Contribute Delete
16.1 kB
"""
Styles and UI configuration for the Defensor application.
"""
def get_custom_css():
"""Returns the custom CSS for the Defensor application."""
return """
body {
background-color: #f8f9fa;
color: #333;
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
/* App-wide typography improvements */
h1, h2, h3, h4, h5, h6 {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
font-weight: 600;
letter-spacing: -0.02em;
}
/* Dark mode theme - beautiful gradient background */
.gradio-container {
background: linear-gradient(135deg, #172a46 0%, #0c1220 100%);
max-width: 1000px;
margin: 0 auto;
border-radius: 16px;
overflow: hidden;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
border: 1px solid rgba(255, 255, 255, 0.05);
}
/* Logo styling */
.logo-container {
text-align: center;
margin-bottom: 10px;
}
.logo {
display: inline-flex;
align-items: center;
background: rgba(0, 0, 0, 0.2);
padding: 10px 20px;
border-radius: 50px;
border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
.logo-icon {
font-size: 2rem;
margin-right: 10px;
display: inline-block;
}
.logo-text {
font-size: 1.6rem;
font-weight: 700;
color: white;
letter-spacing: 0.5px;
background: linear-gradient(90deg, #a5b4fc 0%, #818cf8 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
/* App header styling */
.app-header {
text-align: center;
padding: 30px 20px 20px;
background: rgba(0, 0, 0, 0.2);
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
margin-bottom: 15px;
}
.app-header h1 {
font-size: 2.4rem;
color: #fff;
margin-bottom: 10px;
font-weight: 700;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
background: linear-gradient(90deg, #e0e7ff 0%, #c7d2fe 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.app-header p {
color: rgba(255, 255, 255, 0.8);
font-size: 1.1rem;
max-width: 700px;
margin: 0 auto;
line-height: 1.5;
}
/* Main container styling */
.main-container {
background-color: rgba(30, 41, 59, 0.7);
backdrop-filter: blur(10px);
border-radius: 12px;
padding: 25px;
margin: 15px;
color: #fff;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
border: 1px solid rgba(255, 255, 255, 0.08);
}
/* Status container */
.status-container {
margin-bottom: 20px;
text-align: center;
width: 100%;
}
/* Response styling */
.response-container, .response-wrapper {
background: rgba(15, 23, 42, 0.6);
backdrop-filter: blur(10px);
border-radius: 12px;
padding: 25px;
margin-top: 20px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
max-height: 700px;
overflow-y: auto;
width: 100%;
border: 1px solid rgba(255, 255, 255, 0.05);
transition: all 0.3s ease;
}
.answer-container {
background: rgba(30, 41, 59, 0.4);
border-radius: 10px;
padding: 20px;
margin-bottom: 15px;
border: 1px solid rgba(255, 255, 255, 0.05);
}
.answer-container h2 {
color: #a5b4fc;
margin-top: 25px;
margin-bottom: 15px;
font-size: 1.5em;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
padding-bottom: 10px;
}
.answer-container h3 {
color: #93c5fd;
margin-top: 20px;
margin-bottom: 12px;
font-size: 1.3em;
}
.answer-container h4 {
color: #bae6fd;
margin-top: 18px;
margin-bottom: 10px;
font-size: 1.15em;
}
.answer-container p {
margin-bottom: 15px;
line-height: 1.6;
color: rgba(255, 255, 255, 0.9);
font-size: 1.05em;
}
/* Status indicators */
.status-ready {
background: linear-gradient(135deg, #134e5e 0%, #71b280 100%);
color: white;
padding: 12px 18px;
border-radius: 30px;
margin: 10px auto;
font-weight: 600;
box-shadow: 0 4px 12px rgba(19, 78, 94, 0.3);
display: inline-block;
min-width: 180px;
}
.status-processing {
background: linear-gradient(135deg, #2980b9 0%, #2c3e50 100%);
color: white;
padding: 12px 18px;
border-radius: 30px;
margin: 10px auto;
font-weight: 600;
box-shadow: 0 4px 12px rgba(41, 128, 185, 0.3);
animation: pulse 2s infinite;
display: inline-block;
min-width: 180px;
}
.status-error {
background: linear-gradient(135deg, #cb2d3e 0%, #ef473a 100%);
color: white;
padding: 12px 18px;
border-radius: 30px;
margin: 15px auto;
font-weight: 600;
box-shadow: 0 4px 12px rgba(203, 45, 62, 0.3);
display: inline-block;
min-width: 180px;
}
.status-complete {
background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
color: white;
padding: 12px 18px;
border-radius: 30px;
margin: 10px auto;
font-weight: 600;
box-shadow: 0 4px 12px rgba(17, 153, 142, 0.3);
display: inline-block;
min-width: 180px;
}
/* Input container */
.input-container {
background: rgba(30, 41, 59, 0.7);
backdrop-filter: blur(10px);
border-radius: 12px;
padding: 25px;
margin-bottom: 20px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
border: 1px solid rgba(255, 255, 255, 0.08);
transition: all 0.3s ease;
}
.input-container:focus-within {
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
transform: translateY(-2px);
}
.hint-text {
color: rgba(255, 255, 255, 0.7);
font-size: 0.95em;
margin-top: 8px;
font-style: italic;
}
/* Progress container */
.progress-container {
background: rgba(30, 41, 59, 0.7);
backdrop-filter: blur(10px);
border-radius: 12px;
padding: 20px;
margin: 20px 0;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
width: 100%;
min-height: 90px;
display: block;
border: 1px solid rgba(255, 255, 255, 0.08);
}
/* Button container */
.button-container {
display: flex;
gap: 15px;
margin: 25px 0;
width: 100%;
justify-content: center;
}
.button-container button {
min-height: 52px;
font-size: 1.05em;
font-weight: 600;
padding: 0 35px;
flex: 0 1 auto;
min-width: 180px;
max-width: 220px;
letter-spacing: 0.3px;
border-radius: 30px !important;
}
/* Progress label */
.progress-label {
margin-bottom: 12px;
color: rgba(255, 255, 255, 0.85);
font-weight: 600;
font-size: 1.05em;
text-align: center;
}
/* Progress stages styling */
.progress-stages-container {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
gap: 12px;
margin-top: 20px;
width: 100%;
}
.progress-stage {
padding: 12px 15px;
border-radius: 30px;
background: rgba(15, 23, 42, 0.7);
color: rgba(255, 255, 255, 0.6);
font-size: 0.95em;
transition: all 0.3s ease;
flex: 1;
text-align: center;
min-width: 120px;
max-width: 200px;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid rgba(255, 255, 255, 0.05);
}
.progress-stage.active {
background: linear-gradient(135deg, #2980b9 0%, #2c3e50 100%);
color: white;
font-weight: 600;
animation: pulse 2s infinite;
border: none;
box-shadow: 0 4px 12px rgba(41, 128, 185, 0.25);
}
.progress-stage.complete {
background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
color: white;
font-weight: 600;
border: none;
box-shadow: 0 4px 12px rgba(17, 153, 142, 0.25);
}
.progress-stage.error {
background: linear-gradient(135deg, #cb2d3e 0%, #ef473a 100%);
color: white;
font-weight: 600;
border: none;
box-shadow: 0 4px 12px rgba(203, 45, 62, 0.25);
}
/* Reasoning steps styling */
.reasoning-step {
background: rgba(15, 23, 42, 0.5);
border-radius: 10px;
padding: 15px;
margin-bottom: 15px;
border-left: 3px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.reasoning-stage {
font-weight: 600;
color: #93c5fd;
margin-bottom: 10px;
padding-bottom: 6px;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
/* Sources section styling */
.sources-section {
background: rgba(15, 23, 42, 0.5);
border-radius: 10px;
padding: 15px;
margin-top: 25px;
border-left: 3px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.sources-section h3 {
color: #93c5fd;
margin-top: 0;
margin-bottom: 12px;
}
.source-item {
margin-bottom: 8px;
color: rgba(255, 255, 255, 0.85);
}
/* Enhanced visible styles for inputs */
input, textarea {
background: rgba(15, 23, 42, 0.6) !important;
color: white !important;
border: 1px solid rgba(255, 255, 255, 0.1) !important;
border-radius: 10px !important;
padding: 15px !important;
font-size: 1.05em !important;
transition: all 0.3s ease !important;
}
input:focus, textarea:focus {
border-color: rgba(147, 197, 253, 0.5) !important;
outline: none !important;
box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.25) !important;
background: rgba(15, 23, 42, 0.8) !important;
}
/* Make buttons more beautiful with gradients */
button {
border-radius: 30px !important;
transition: all 0.3s ease !important;
outline: none !important;
font-weight: 600 !important;
letter-spacing: 0.3px !important;
}
button:hover {
transform: translateY(-3px) !important;
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25) !important;
}
button:active {
transform: translateY(-1px) !important;
}
/* Primary button styling */
button[variant="primary"],
.gr-button-primary {
background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%) !important;
color: white !important;
border: none !important;
}
button[variant="primary"]:hover,
.gr-button-primary:hover {
background: linear-gradient(135deg, #4338ca 0%, #2563eb 100%) !important;
}
/* Secondary button styling */
button[variant="secondary"],
.gr-button-secondary {
background: rgba(30, 41, 59, 0.8) !important;
color: white !important;
border: 1px solid rgba(255, 255, 255, 0.15) !important;
}
button[variant="secondary"]:hover,
.gr-button-secondary:hover {
background: rgba(30, 41, 59, 0.95) !important;
}
/* Animation for processing effects */
@keyframes pulse {
0% {
opacity: 1;
box-shadow: 0 4px 12px rgba(41, 128, 185, 0.3);
}
50% {
opacity: 0.85;
box-shadow: 0 4px 20px rgba(41, 128, 185, 0.5);
}
100% {
opacity: 1;
box-shadow: 0 4px 12px rgba(41, 128, 185, 0.3);
}
}
/* Responsive improvements */
@media (min-width: 768px) {
.gradio-container {
min-width: 750px !important;
max-width: 1200px !important;
}
.input-container, .output-container {
padding: 30px !important;
}
.button-container {
justify-content: center !important;
gap: 25px !important;
}
}
@media (max-width: 767px) {
.progress-stage {
min-width: 90px;
padding: 10px;
font-size: 0.9em;
}
.app-header h1 {
font-size: 1.8rem;
}
.app-header p {
font-size: 1rem;
}
.logo-icon {
font-size: 1.5rem;
}
.logo-text {
font-size: 1.2rem;
}
}
/* Override any built-in Gradio container colors */
.gradio-container {
color: white !important;
}
.gr-box, .gr-form, .gr-panel {
background: rgba(30, 41, 59, 0.7) !important;
backdrop-filter: blur(10px) !important;
color: white !important;
border-radius: 12px !important;
border: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.gr-input, .gr-textarea, .gr-checkbox, .gr-radio, .gr-slider, .gr-dropdown {
background: rgba(15, 23, 42, 0.6) !important;
color: white !important;
border-color: rgba(255, 255, 255, 0.1) !important;
}
/* Override labels and markdown content */
.gr-label, .gr-markdown {
color: rgba(255, 255, 255, 0.9) !important;
}
/* Make sure accordions are styled properly */
.gr-accordion {
background: rgba(30, 41, 59, 0.7) !important;
backdrop-filter: blur(10px) !important;
color: white !important;
border: 1px solid rgba(255, 255, 255, 0.08) !important;
border-radius: 12px !important;
margin: 15px 0 !important;
}
.gr-accordion-header {
background: rgba(15, 23, 42, 0.5) !important;
color: white !important;
font-weight: 600 !important;
padding: 15px !important;
border-radius: 12px 12px 0 0 !important;
}
.gr-accordion-content {
background: transparent !important;
color: white !important;
padding: 20px !important;
}
/* Ensure response text is visible */
.response-wrapper,
.response-wrapper *,
.answer-container,
.answer-container * {
color: rgba(255, 255, 255, 0.9) !important;
background-color: transparent !important;
}
.response-wrapper {
background: rgba(15, 23, 42, 0.6) !important;
backdrop-filter: blur(10px) !important;
border-radius: 12px !important;
padding: 25px !important;
margin-top: 20px !important;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15) !important;
border: 1px solid rgba(255, 255, 255, 0.05) !important;
}
.answer-container {
background: rgba(30, 41, 59, 0.4) !important;
border-radius: 10px !important;
padding: 20px !important;
margin-bottom: 15px !important;
border: 1px solid rgba(255, 255, 255, 0.05) !important;
}
/* Apply styles to specific elements within the answer container */
.answer-container h2 {
color: #a5b4fc !important;
margin-top: 25px !important;
margin-bottom: 15px !important;
font-size: 1.5em !important;
border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
padding-bottom: 10px !important;
}
.answer-container h3 {
color: #93c5fd !important;
margin-top: 20px !important;
margin-bottom: 12px !important;
font-size: 1.3em !important;
}
.answer-container h4 {
color: #bae6fd !important;
margin-top: 18px !important;
margin-bottom: 10px !important;
font-size: 1.15em !important;
}
.answer-container p {
margin-bottom: 15px !important;
line-height: 1.6 !important;
color: rgba(255, 255, 255, 0.9) !important;
font-size: 1.05em !important;
}
.answer-container ul,
.answer-container ol {
margin-left: 20px !important;
margin-bottom: 15px !important;
color: rgba(255, 255, 255, 0.9) !important;
}
.answer-container li {
margin-bottom: 8px !important;
color: rgba(255, 255, 255, 0.9) !important;
line-height: 1.5 !important;
}
/* Fix raw HTML rendering */
.prose {
color: rgba(255, 255, 255, 0.9) !important;
background-color: transparent !important;
}
.prose * {
color: inherit !important;
}
/* Slider styling */
.gr-slider {
background: rgba(15, 23, 42, 0.6) !important;
}
.gr-slider .thumb {
background: #4f46e5 !important;
border: 2px solid white !important;
}
.gr-slider .track {
background: rgba(255, 255, 255, 0.2) !important;
}
.gr-slider .track-fill {
background: linear-gradient(90deg, #4f46e5 0%, #3b82f6 100%) !important;
}
/* Checkbox styling */
.gr-checkbox {
border: 2px solid rgba(255, 255, 255, 0.3) !important;
background: rgba(15, 23, 42, 0.6) !important;
}
.gr-checkbox:checked {
background: #4f46e5 !important;
border-color: white !important;
}
/* Better scrollbars for the response area */
.response-wrapper::-webkit-scrollbar,
.answer-container::-webkit-scrollbar {
width: 8px;
height: 8px;
}
.response-wrapper::-webkit-scrollbar-track,
.answer-container::-webkit-scrollbar-track {
background: rgba(255, 255, 255, 0.05);
border-radius: 4px;
}
.response-wrapper::-webkit-scrollbar-thumb,
.answer-container::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.2);
border-radius: 4px;
}
.response-wrapper::-webkit-scrollbar-thumb:hover,
.answer-container::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.3);
}
"""