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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #244b91 0%, #2d4573 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
}

/* Card styles */
.card {
    background: rgba(237, 243, 248, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid rgba(237, 243, 248, 0.3);
}

/* Button styles */
.btn {
    background: rgba(117, 184, 222, 0.3);
    color: white;
    border: 1px solid rgba(117, 184, 222, 0.5);
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

.btn:hover {
    background: rgba(71, 151, 194, 0.4);
}

.btn.active {
    background: #2f9ddf;
    border-color: #2f9ddf;
}

/* Typography */
h1 {
    color: white;
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 10px;
}

h2 {
    color: white;
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.subtitle {
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

/* Model badge */
.model-badge {
    background: linear-gradient(45deg, #4797c2, #2f9ddf);
    color: white;
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    display: inline-block;
    margin: 10px 0;
}

/* Center the model badge container */
.card {
    text-align: center;
}

.card .header-info {
    text-align: left;
}

/* Login page specific styles */
.login-container {
    max-width: 400px;
    margin: 10vh auto;
}

.login-form {
    margin-bottom: 20px;
}

.login-form label {
    color: white;
    display: block;
    margin-bottom: 8px;
}

.login-form input {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(117, 184, 222, 0.4);
    background: rgba(237, 243, 248, 0.1);
    color: white;
    margin-bottom: 20px;
}

.login-form input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.login-info {
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}

/* Dashboard specific styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(237, 243, 248, 0.12);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    border: 1px solid rgba(237, 243, 248, 0.25);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: white;
    margin-bottom: 5px;
}

.stat-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

.thinking-mode {
    background: rgba(116, 137, 176, 0.2);
    border-color: rgba(116, 137, 176, 0.3);
}

.feedback-mode {
    background: rgba(80, 116, 180, 0.2);
    border-color: rgba(80, 116, 180, 0.3);
}

.system-monitor {
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.3);
}

.controls {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-label {
    color: white;
    font-weight: 500;
}

.alerts-container {
    background: rgba(237, 243, 248, 0.08);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    overflow: hidden;
}

.user-info {
    text-align: right;
    margin-top: 15px;
}

.user-info span {
    color: rgba(255, 255, 255, 0.8);
    margin-right: 15px;
    font-size: 0.9rem;
}

.user-info a {
    color: white;
    text-decoration: none;
    background: rgba(117, 184, 222, 0.3);
    padding: 8px 16px;
    border-radius: 8px;
}

/* Header layout with system stats and user info */
.header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.system-stats {
    display: flex;
    gap: 12px;
}

.system-stat {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    font-family: monospace;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.system-stat span {
    color: rgba(255, 255, 255, 0.9);
    font-weight: bold;
}

/* Alert styles */
.alert-item {
    background: rgba(237, 243, 248, 0.12);
    border: 1px solid rgba(237, 243, 248, 0.25);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.alert-header {
    margin-bottom: 15px;
}

.alert-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}

.opsgenie-number {
    font-size: 0.85rem;
    color: #FF9800;
    font-weight: bold;
    text-align: left;
    font-family: monospace;
}

.alert-message {
    flex: 1;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
}

.severity-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    white-space: nowrap;
    color: white;
}

.alert-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 15px;
}

.alert-meta-top {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    justify-content: flex-start;
}

.alert-meta-top .severity-badge {
    align-self: flex-start;
}

.alert-processing-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    flex-wrap: wrap;
}

.alert-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.alert-actions button,
.alert-actions a {
    display: inline-block;
    pointer-events: auto;
    position: relative;
    z-index: 11;
}

.action-button {
    transition: all 0.2s ease;
    user-select: none;
}

.action-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.feedback-button:hover {
    background: #1976D2 !important;
}

.opsgenie-button:hover {
    background: #F57C00 !important;
}

.alert-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.detail-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 10px;
}

.detail-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    margin-bottom: 5px;
}

.detail-value {
    color: white;
    font-weight: 500;
}

.thinking-section {
    grid-column: 1 / -1;
    background: rgba(255, 193, 7, 0.1);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.thinking-content {
    color: white;
    font-weight: 400;
    font-size: 0.9rem;
    max-height: 120px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 193, 7, 0.5) transparent;
    padding-right: 8px;
    line-height: 1.4;
}

/* Webkit scrollbar styling for thinking content */
.thinking-content::-webkit-scrollbar {
    width: 6px;
}

.thinking-content::-webkit-scrollbar-track {
    background: transparent;
}

.thinking-content::-webkit-scrollbar-thumb {
    background: rgba(255, 193, 7, 0.5);
    border-radius: 3px;
}

.thinking-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 193, 7, 0.7);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}

.tag {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
}

.tag.escalation {
    background: rgba(244, 67, 54, 0.8);
}

.tag.feedback {
    background: rgba(76, 175, 80, 0.8);
}

.tag.duplicate {
    background: rgba(255, 193, 7, 0.8);
    color: #333;
    font-weight: 600;
}

.tag.tier1 {
    background: rgba(63, 81, 181, 0.8);
    font-weight: 600;
}

.tag.tier2 {
    background: rgba(255, 152, 0, 0.8);
    font-weight: 500;
}

.tag.tier3 {
    background: rgba(156, 39, 176, 0.8);
    font-weight: 400;
}

.correlation-section {
    grid-column: 1 / -1;
    margin-top: 10px;
    padding: 15px;
    background: rgba(33, 150, 243, 0.1);
    border-radius: 8px;
    border-left: 4px solid rgba(33, 150, 243, 0.6);
}

.correlation-content {
    margin-top: 5px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.9);
    max-height: 150px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(33, 150, 243, 0.5) transparent;
    padding-right: 8px;
}

/* Webkit scrollbar styling for correlation content */
.correlation-content::-webkit-scrollbar {
    width: 6px;
}

.correlation-content::-webkit-scrollbar-track {
    background: transparent;
}

.correlation-content::-webkit-scrollbar-thumb {
    background: rgba(33, 150, 243, 0.5);
    border-radius: 3px;
}

.correlation-content::-webkit-scrollbar-thumb:hover {
    background: rgba(33, 150, 243, 0.7);
}

.alert-meta {
    display: flex;
    gap: 15px;
    margin-top: 8px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.alert-timestamp {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    margin-top: 10px;
}

.feedback-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    background: rgba(76, 175, 80, 0.8);
    color: white;
    z-index: 10;
}

/* Feedback stats specific styles */
.feedback-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.info-section {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
}

.info-section p {
    margin-bottom: 15px;
}

/* Semantic Search Page Styles */
.search-container, .analysis-container {
    background: rgba(237, 243, 248, 0.08);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid rgba(237, 243, 248, 0.3);
}

.search-section h2, .analysis-section h2 {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.search-section p, .analysis-section p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
}

.search-form {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 15px;
}

.search-input-container {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.search-input-container input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid rgba(117, 184, 222, 0.4);
    background: rgba(237, 243, 248, 0.1);
    color: white;
    font-size: 1rem;
}

.search-input-container input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    font-size: 0.9rem;
}

.filter-group select, .filter-group input[type="range"] {
    padding: 8px;
    border-radius: 8px;
    border: 1px solid rgba(117, 184, 222, 0.3);
    background: rgba(237, 243, 248, 0.08);
    color: white;
}

.filter-group select option {
    background: #2d4573;
    color: white;
}

.analysis-controls {
    display: flex;
    gap: 20px;
    align-items: end;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 15px;
}

/* Results Styling */
.results-container {
    margin-bottom: 30px;
}

.search-results, .cluster-results {
    background: rgba(237, 243, 248, 0.08);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    border: 1px solid rgba(237, 243, 248, 0.3);
}

.search-results h3, .cluster-results h3 {
    color: white;
    margin-bottom: 20px;
}

.search-summary, .cluster-summary {
    background: rgba(33, 150, 243, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid rgba(33, 150, 243, 0.6);
}

.search-summary p, .cluster-summary p {
    color: rgba(255, 255, 255, 0.9);
    margin: 5px 0;
}

.results-list, .clusters-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.result-item, .cluster-item {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
}

.result-header, .cluster-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.result-message, .cluster-representative {
    color: white;
    font-weight: 500;
    flex: 1;
    margin-right: 15px;
}

.result-score {
    background: linear-gradient(45deg, #4797c2, #2f9ddf);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: bold;
}

.result-details, .cluster-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.severity-badge, .category-badge, .time-badge, .dist-item {
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
}

.category-badge {
    background: rgba(156, 39, 176, 0.8);
    color: white;
}

.time-badge, .dist-item {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.result-actions, .cluster-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.btn-small, .btn-tiny {
    padding: 6px 12px;
    background: rgba(117, 184, 222, 0.3);
    color: white;
    border: 1px solid rgba(117, 184, 222, 0.5);
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-tiny {
    padding: 4px 8px;
    font-size: 0.7rem;
}

.btn-small:hover, .btn-tiny:hover {
    background: rgba(71, 151, 194, 0.4);
}

/* Cluster specific styling */
.cluster-header h4 {
    color: white;
    margin: 0;
}

.cluster-distributions {
    margin: 15px 0;
}

.distribution {
    color: rgba(255, 255, 255, 0.9);
    margin: 8px 0;
}

.cluster-details {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.cluster-details h5 {
    color: white;
    margin-bottom: 10px;
}

.cluster-alerts {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cluster-alert {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 8px;
}

.cluster-alert .alert-message {
    color: white;
    margin-bottom: 8px;
}

.cluster-alert .alert-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* Modal Styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: linear-gradient(135deg, #244b91 0%, #2d4573 100%);
    border-radius: 20px;
    padding: 30px;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid rgba(237, 243, 248, 0.3);
}

.modal-content h3 {
    color: white;
    margin-bottom: 20px;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #ff6b6b;
}

.similar-summary {
    background: rgba(33, 150, 243, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid rgba(33, 150, 243, 0.6);
}

.similar-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.similar-item {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
}

.similar-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.similar-message {
    color: white;
    font-weight: 500;
    flex: 1;
    margin-right: 15px;
}

.similar-score {
    background: linear-gradient(45deg, #4797c2, #2f9ddf);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

.similar-details {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* Loading Indicator */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 30px;
    border-radius: 15px;
    z-index: 10001;
    text-align: center;
}

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-results {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    padding: 40px;
    font-style: italic;
}

/* Hidden utility class */
.hidden {
    display: none !important;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .card {
        padding: 20px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .alert-top-row {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .alert-meta-top {
        order: 1;
    }
    
    .alert-actions {
        order: 2;
        justify-content: flex-start;
    }
    
    .alert-header {
        margin-bottom: 10px;
    }
    
    .alert-meta {
        align-items: flex-start;
        width: 100%;
    }
    
    .alert-processing-info {
        font-size: 0.75rem;
        gap: 6px;
    }
    
    .opsgenie-number {
        font-size: 0.8rem;
        text-align: left;
    }
    
    .alert-actions {
        position: static;
        margin-top: 10px;
        justify-content: flex-start;
    }
    
    .feedback-badge {
        position: static;
        display: inline-block;
        margin-bottom: 10px;
    }
    
    .user-info {
        text-align: center;
        margin-top: 20px;
    }
    
    .user-info span {
        display: block;
        margin: 5px 0;
    }
    
    .header-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .system-stats {
        justify-content: center;
        gap: 10px;
    }
    
    .system-stat {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
    
    .search-filters {
        grid-template-columns: 1fr;
    }
    
    .analysis-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input-container {
        flex-direction: column;
    }
    
    .result-header, .cluster-header, .similar-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-content {
        margin: 20px;
        max-width: none;
    }
}

/* Attachment display styles */
.attachments-section {
    margin: 20px 0;
    grid-column: 1 / -1;
}

.attachments-content {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 15px;
    margin-top: 10px;
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.attachment-item {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    border-left: 3px solid #2196F3;
}

.attachment-item:last-child {
    margin-bottom: 0;
}

.attachment-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.attachment-name {
    font-weight: 600;
    color: #2196F3;
    font-size: 0.9rem;
}

.attachment-type {
    background: rgba(33, 150, 243, 0.2);
    color: #81D4FA;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: monospace;
}

.attachment-size {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
}

.attachment-status {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.attachment-status.processed {
    background: rgba(76, 175, 80, 0.2);
    color: #A5D6A7;
}

.attachment-status.pending {
    background: rgba(255, 193, 7, 0.2);
    color: #FFD54F;
}

.attachment-summary {
    background: rgba(33, 150, 243, 0.1);
    border-radius: 6px;
    padding: 8px;
    margin-top: 8px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    border-left: 2px solid #2196F3;
}

.attachment-extraction {
    margin-top: 5px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}
