/* Modern Button Hover Effects */
button {
    transition: all 0.3s ease !important;
}

button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important;
}

/* Profile card hover effects */
.profile-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.profile-card:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15) !important;
}

/* Input focus effects */
input:focus, textarea:focus {
    outline: none !important;
    border-color: #3498db !important;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1) !important;
}

/* Radio button styling */
.radio-group {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.radio-item:hover {
    border-color: #3498db;
    background-color: #f8f9fa;
}

/* Incidents Table Styling */
.incidents-section {
    margin-bottom: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.incidents-title {
    color: white !important;
    margin-bottom: 20px !important;
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Gleiche Titel-Optik für weitere Sektionen */
.stats-title {
    color: white !important;
    margin-bottom: 20px !important;
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
}

.incidents-title::before {
    content: "🚨";
    font-size: 1.2em;
}

/* Titel-Icon nur für die zweite Tabelle (Alle TI-Komponenten) überschreiben */
.ci-all-title::before {
    content: "🗒️";
    font-size: 1.2em;
}

/* Statistik-Icon für Heatmap-Titel */
.stats-title::before {
    content: "📊";
    font-size: 1.2em;
}

.incidents-container {
    background: white;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Dark mode: alle Bildschirmgrößen – bessere Kontraste auch für Heatmap-Container */
@media (prefers-color-scheme: dark) {
    .incidents-container {
        background: #0b1220; /* sehr dunkles Slate */
        border: 1px solid #374151;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    }

    /* Hinweisbox hell lassen, aber Textfarbe leicht abdunkeln für Kontrast */
    .warning-message {
        background-color: #fef3c7; /* amber-100 */
        border: 1px solid #f59e0b; /* amber-500 */
        color: #92400e; /* amber-800 */
    }
}

.incidents-table-container {
    max-height: 200px; /* Show exactly 5 rows */
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--card-bg-color);
}

.incidents-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 0.9rem;
}

.incidents-table th {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.8rem;
}

.incidents-table td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: top;
}

.incidents-table tr:hover {
    background-color: #f8f9fa;
    transform: scale(1.01);
    transition: all 0.2s ease;
}

.incidents-table tr:last-child td {
    border-bottom: none;
}

.ci-link {
    color: #3498db !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.ci-link:hover {
    color: #2980b9 !important;
    text-decoration: underline;
}

.ci-name {
    color: #2c3e50;
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 4px;
    display: block;
}

.org-name {
    color: #34495e;
    font-weight: 600;
    font-size: 0.85rem;
}

.product-name {
    color: #7f8c8d;
    font-size: 0.75rem;
    margin-top: 2px;
    display: block;
}

.timestamp {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #2c3e50;
    white-space: nowrap;
}

/* Dark mode only on small screens: increase contrast for tables */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    .incidents-container {
        background: #0b1220;
        border: 1px solid #374151;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    }
    .incidents-table th {
        background: #111827;
        color: #f9fafb;
    }
    .incidents-table td {
        border-bottom: 1px solid #374151;
        color: #e5e7eb;
    }
    .incidents-table tr:hover {
        background-color: #1f2937;
    }
    .ci-link { color: #60a5fa !important; }
    .ci-link:hover { color: #93c5fd !important; }
    .ci-name { color: #d1d5db; }
    .org-name { color: #e5e7eb; }
    .product-name { color: #9ca3af; }
    .timestamp { color: #d1d5db; }
}

/* Dark mode for Dash DataTable (stats top table) - All screen sizes */
@media (prefers-color-scheme: dark) {
    .dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner th {
        background-color: #334155 !important;
        color: #f1f5f9 !important;
        border-color: #475569 !important;
    }
    .dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner td {
        background-color: #1e293b !important;
        color: #f1f5f9 !important;
        border-color: #475569 !important;
    }
    .dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner tr:nth-child(even) td {
        background-color: #334155 !important;
    }
    .dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner tr:hover td {
        background-color: rgba(96, 165, 250, 0.15) !important;
    }
}

.duration {
    font-weight: 600;
    color: #e74c3c;
    font-size: 0.85rem;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.incident-ongoing {
    background-color: #e74c3c;
    color: white;
    animation: pulse 2s infinite;
}

.incident-resolved {
    background-color: #27ae60;
    color: white;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Responsive design for incidents table */
@media (max-width: 768px) {
    .incidents-table {
        font-size: 0.8rem;
    }
    
    .incidents-table th,
    .incidents-table td {
        padding: 8px 6px;
    }
    
    .incidents-title {
        font-size: 1.2rem !important;
    }
}

.radio-item input[type="radio"] {
    margin: 0;
}

/* Success/Error message styling */
.success-message {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0;
}

.error-message {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0;
}

.warning-message {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0;
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive design improvements */
@media (max-width: 768px) {
    .container {
        padding: 10px !important;
    }
    
    button {
        width: 100% !important;
        margin: 5px 0 !important;
    }
    
    .button-group {
        flex-direction: column !important;
    }
}

/* Fix for hamburger menu touch issues on mobile devices */
details > summary {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* Ensure the summary element has proper positioning context */
    position: relative;
    z-index: 1001;
    /* Make sure the element is visible and clickable */
    display: block;
}

details > summary:focus {
    outline: none;
}

/* Ensure the hamburger menu content is properly positioned on mobile */
@media (max-width: 768px) {
    /* Fix header overflow issues that might clip the hamburger menu */
    header {
        overflow: visible !important;
    }
    
    #hamburger-menu-content {
        position: absolute !important;
        right: 0 !important;
        margin-top: 8px !important;
        background: #ffffff !important;
        border: 1px solid #e0e0e0 !important;
        border-radius: 10px !important;
        padding: 8px !important;
        box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
        min-width: 200px !important;
        max-width: 90vw !important; /* Prevent menu from being too wide on small screens */
        display: grid !important;
        row-gap: 4px !important;
        z-index: 10000 !important; /* Increase z-index to ensure it's above all other elements */
        /* Add overflow handling for small screens */
        overflow: hidden;
        /* Ensure the menu is not clipped by parent containers */
        transform: translateZ(0); /* Force hardware acceleration */
    }
    
    /* Improve touch targets for mobile */
    #hamburger-menu-content a {
        padding: 12px 12px !important;
        font-size: 16px !important; /* Minimum font size for mobile */
        /* Ensure links don't overflow */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        /* Make sure links are properly clickable */
        display: block !important;
        width: 100%;
    }
    
    /* Ensure the details element doesn't get cut off on small screens */
    details {
        position: relative;
        /* Make sure the details element is not affected by overflow */
        z-index: 1001;
    }
}

/* Additional mobile-specific improvements */
@media (max-width: 480px) {
    #hamburger-menu-content {
        min-width: 160px !important;
        right: 0 !important; /* Changed from -10px to 0 for better positioning */
        max-width: 85vw !important; /* Further limit width on very small screens */
    }
    
    /* Ensure the details element doesn't get cut off on small screens */
    details {
        position: relative;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Better typography */
body {
    line-height: 1.6;
    color: #2c3e50;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
}

/* Form improvements */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* Card improvements */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.card-header {
    padding: 20px 25px 15px;
    border-bottom: 1px solid #ecf0f1;
}

.card-body {
    padding: 20px 25px;
}

.card-footer {
    padding: 15px 25px 20px;
    border-top: 1px solid #ecf0f1;
    background-color: #f8f9fa;
}

/* Downtime table styling */
.downtime-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.downtime-table th {
    background-color: #e74c3c;
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.downtime-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #ecf0f1;
    font-size: 14px;
}

.downtime-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.downtime-table tr:hover {
    background-color: #e8f4f8;
    transition: background-color 0.2s ease;
}

.downtime-table td:first-child {
    font-weight: 500;
    color: #2c3e50;
}

.downtime-table td:nth-child(2) {
    color: #7f8c8d;
}

.downtime-table td:nth-child(3) {
    color: #e74c3c;
    font-weight: 500;
}

/* Responsive table */
@media (max-width: 768px) {
    .downtime-table {
        font-size: 12px;
    }
    
    .downtime-table th,
    .downtime-table td {
        padding: 8px 10px;
    }
}

/* Markdown Content Styling */
.markdown-content h1 {
    color: #2c3e50;
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    border-bottom: 3px solid #3498db;
    padding-bottom: 0.5rem;
}

.markdown-content h2 {
    color: #2c3e50;
    font-size: 2rem;
    font-weight: 500;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 0.3rem;
}

.markdown-content h3 {
    color: #34495e;
    font-size: 1.5rem;
    font-weight: 500;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
}

.markdown-content h4 {
    color: #34495e;
    font-size: 1.25rem;
    font-weight: 500;
    margin-top: 1.2rem;
    margin-bottom: 0.6rem;
}

.markdown-content p {
    line-height: 1.6;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.markdown-content ul, .markdown-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.markdown-content li {
    line-height: 1.6;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.markdown-content strong {
    color: #2c3e50;
    font-weight: 600;
}

.markdown-content em {
    color: #7f8c8d;
    font-style: italic;
}

.markdown-content hr {
    border: none;
    border-top: 2px solid #ecf0f1;
    margin: 2rem 0;
}

.markdown-content blockquote {
    border-left: 4px solid #3498db;
    padding-left: 1rem;
    margin: 1rem 0;
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    font-style: italic;
    color: #7f8c8d;
}

.markdown-content code {
    background-color: #f1f2f6;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #e74c3c;
}

.markdown-content pre {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1rem 0;
}

.markdown-content pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.markdown-content th,
.markdown-content td {
    border: 1px solid #ecf0f1;
    padding: 0.75rem;
    text-align: left;
}

.markdown-content th {
    background-color: #3498db;
    color: white;
    font-weight: 600;
}

.markdown-content tr:nth-child(even) {
    background-color: #f8f9fa;
}

.markdown-content tr:hover {
    background-color: #e8f4f8;
    transition: background-color 0.2s ease;
}

/* Responsive markdown content */
@media (max-width: 768px) {
    .markdown-content h1 {
        font-size: 2rem;
    }
    
    .markdown-content h2 {
        font-size: 1.5rem;
    }
    
    .markdown-content h3 {
        font-size: 1.25rem;
    }
    
    .markdown-content table {
        font-size: 0.9rem;
    }
    
    .markdown-content th,
    .markdown-content td {
        padding: 0.5rem;
    }
}
