/* Portal Visibility Fix - Forces proper text colors */

/* Global fix for portal dashboard */
.portal-dashboard,
.portal-dashboard * {
    color: #333 !important;
}

/* Ensure headers are visible */
.portal-dashboard h1,
.portal-dashboard h2,
.portal-dashboard h3,
.portal-dashboard h4,
.portal-dashboard h5,
.portal-dashboard h6 {
    color: #111 !important;
}

/* Fix portal header specifically */
.portal-header {
    background: linear-gradient(135deg, #74b72a, #558B2F) !important;
}

.portal-header *,
.portal-header h2,
.portal-header p {
    color: white !important;
}

/* Fix stat cards */
.stat-card-mini {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%) !important;
}

.stat-card-mini *,
.stat-card-mini .stat-number,
.stat-card-mini .stat-label {
    color: white !important;
}

/* Fix management categories */
.management-category {
    background: white !important;
    border: 1px solid #e5e7eb !important;
}

.management-category h3,
.management-category p {
    color: #333 !important;
}

/* Fix action items */
.action-item {
    background: #f9fafb !important;
    color: #333 !important;
}

.action-item .action-title {
    color: #111 !important;
    font-weight: 600 !important;
}

.action-item .action-desc {
    color: #666 !important;
}

/* Fix buttons */
.btn-primary,
.portal-button,
.action-btn,
.modern-btn {
    background: #74b72a !important;
    color: white !important;
}

/* Fix empty states */
.empty-state {
    color: #666 !important;
}

.empty-state h3 {
    color: #333 !important;
}

/* Fix loading spinners */
.loading-spinner {
    color: #74b72a !important;
}

/* Project Details Button Styling - Align with upper elements */
.modern-project-card .project-actions {
    display: flex !important;
    justify-content: center !important; /* Zurück zur Zentrierung */
    align-items: center !important;
    width: 100% !important;
    margin-top: 1.2rem !important; /* Genug Abstand für Styling-Strich */
    margin-bottom: 1rem !important; /* Normaler Abstand nach unten */ 
    padding: 0 0.5rem !important; /* WENIGER Padding = Button weiter nach links */
    border-top: 1px solid #e5e7eb !important; /* Sichtbare Trennung vom Styling-Strich */
    padding-top: 1rem !important; /* Abstand über der Trennlinie */
}

.modern-project-card .project-actions .modern-btn {
    width: 100% !important; /* Volle Breite wieder verwenden */
    max-width: none !important; /* Entferne max-width Beschränkung */
    justify-content: center !important;
    text-align: center !important;
    margin: 0 auto !important; /* Auto-margin für Zentrierung */
}

/* Project Image Quality Enhancement */
.project-image .project-thumbnail {
    /* Improve image rendering for sharper display */
    image-rendering: -webkit-optimize-contrast !important;
    image-rendering: crisp-edges !important;
    image-rendering: high-quality !important;
    
    /* Better anti-aliasing */
    -webkit-backface-visibility: hidden !important;
    -moz-backface-visibility: hidden !important;
    backface-visibility: hidden !important;
    
    /* Optimize for high-DPI displays */
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
    
    /* Remove blur filter that might be applied */
    filter: brightness(1.1) saturate(1.1) !important;
}

/* ========================================
   ULTIMATE MODAL VISIBILITY FIX
   ======================================== */

/* CRITICAL: Highest priority modal definitions */
.portal-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: rgba(0, 0, 0, 0.6) !important;
    z-index: 99999 !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1rem !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
    /* Force initial state */
    opacity: 0 !important;
    visibility: hidden !important;
    transition: opacity 0.3s ease, visibility 0.3s ease !important;
}

/* ULTIMATE MODAL ACTIVE STATE - HIGHEST SPECIFICITY */
.portal-modal.modal-active,
#projects-panel.modal-active,
#documents-panel.modal-active,
#invoices-panel.modal-active,
#info-panel.modal-active,
#notes-panel.modal-active,
#requirements-panel.modal-active,
#support-panel.modal-active,
#projectDocumentsModal.modal-active,
#vermittlerDocumentUploadModal.modal-active,
#vermittlerInvoiceUploadModal.modal-active {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 99999 !important;
    /* Force override any conflicting styles */
    transform: none !important;
    animation: modalFadeIn 0.3s ease-out !important;
}

/* Force animation for smooth appearance */
@keyframes modalFadeIn {
    from {
        opacity: 0 !important;
        transform: scale(0.95) !important;
    }
    to {
        opacity: 1 !important;
        transform: scale(1) !important;
    }
}

.portal-modal-content {
    position: relative !important;
    background: white !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
    margin: auto !important;
    width: auto !important;
    min-width: 300px !important;
    max-width: min(95vw, 1400px) !important;
    max-height: min(95vh, 900px) !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

.portal-modal-content.large {
    max-width: min(90vw, 1200px) !important;
}

.portal-modal-content.extra-large {
    max-width: min(95vw, 1600px) !important;
    max-height: min(90vh, 1000px) !important;
}

.portal-modal-content.medium {
    max-width: min(80vw, 800px) !important;
}

.portal-modal-content.small {
    max-width: min(70vw, 600px) !important;
}

.portal-modal-header {
    flex-shrink: 0 !important;
    padding: 1.5rem !important;
    border-bottom: 1px solid #e5e7eb !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    background: linear-gradient(135deg, #74b72a 0%, #558B2F 100%) !important;
    color: white !important;
}

.portal-modal-header h3 {
    margin: 0 !important;
    color: white !important;
    font-size: 1.25rem !important;
    font-weight: 600 !important;
}

.portal-modal-body {
    flex: 1 !important;
}

.portal-modal h3,
.portal-modal h4 {
    color: #111 !important;
}

/* Backward compatibility for content-panel */
.content-panel {
    background: white !important;
}

.content-panel h3,
.content-panel h4 {
    color: #111 !important;
}

/* Fix forms */
.portal-form label {
    color: #333 !important;
}

.portal-form input,
.portal-form select,
.portal-form textarea {
    color: #333 !important;
    background: white !important;
    border: 1px solid #ddd !important;
}

/* Fix tables */
.portal-data-table {
    color: #333 !important;
}

.portal-data-table th {
    color: #111 !important;
    background: #f5f5f5 !important;
}

.portal-data-table td {
    color: #333 !important;
    background: white !important;
}

/* Fix notices */
.portal-notice {
    color: #333 !important;
}

/* Make sure page background is visible */
.page-content {
    background-color: #f5f5f5 !important;
}

/* CRITICAL: Force portal dashboard visibility */
.portal-dashboard {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 999 !important;
    background-color: #f5f5f5 !important;
    min-height: 400px !important;
    padding: 20px !important;
}

/* Force visibility on all button text */
.portal-dashboard button span,
.portal-dashboard a span {
    color: inherit !important;
}

/* Fix white text in project cards */
.project-status-badge span,
.project-action-btn span {
    color: #333 !important;
}

/* Ensure tables are visible */
.portal-dashboard table {
    background: white !important;
}

.portal-dashboard th {
    background: #f5f5f5 !important;
    color: #111 !important;
} 