/* ==========================================================================
   Modern Portal Dashboard Styles
   ========================================================================== */

/* ==========================================================================
   CRITICAL: GLOBAL BOX-SIZING FIX FOR ALL FORM CONTROLS
   This prevents form inputs from overflowing their containers
   ========================================================================== */

/* Apply box-sizing to ALL form elements globally */
.form-group input,
.form-group select,
.form-group textarea,
.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="file"],
select,
textarea {
    box-sizing: border-box !important;
}

/* Ensure all modal form controls have box-sizing */
.portal-modal input,
.portal-modal select,
.portal-modal textarea,
.modal-content input,
.modal-content select,
.modal-content textarea,
.modal-body input,
.modal-body select,
.modal-body textarea {
    box-sizing: border-box !important;
}

/* Fix for all container elements */
.form-group,
.modal-content,
.modal-body,
.portal-modal-content,
.portal-modal-body,
.document-row,
.document-upload-list {
    box-sizing: border-box !important;
}

/* Ensure all form groups and their children use border-box */
.form-group *,
.modal-content *,
.modal-body *,
.document-row * {
    box-sizing: border-box !important;
}

/* Document Grid Layout - Using Flexbox */
#vermittler-documents-content,
.vermittler-documents-list,
.vermittler-invoices-list {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 1.5rem !important;
    padding: 1rem 0;
    width: 100% !important;
    box-sizing: border-box !important;
}

@media (max-width: 1200px) {
    #vermittler-documents-content .document-item,
    .vermittler-documents-list .document-item,
    .vermittler-invoices-list .invoice-item {
        width: calc(33.333% - 1rem) !important;
    }
}

@media (max-width: 768px) {
    #vermittler-documents-content,
    .vermittler-documents-list,
    .vermittler-invoices-list {
        gap: 1rem !important;
    }
    #vermittler-documents-content .document-item,
    .vermittler-documents-list .document-item,
    .vermittler-invoices-list .invoice-item {
        width: calc(50% - 0.5rem) !important;
    }
}

@media (max-width: 480px) {
    #vermittler-documents-content .document-item,
    .vermittler-documents-list .document-item,
    .vermittler-invoices-list .invoice-item {
        width: 100% !important;
    }
}

/* Force document items to behave as flex items */
#vermittler-documents-content .document-item,
.vermittler-documents-list .document-item,
.vermittler-invoices-list .invoice-item {
    background: white;
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
    padding: 1rem;
    transition: var(--portal-transition);
    border: 1px solid var(--portal-border);
    display: flex !important;
    flex-direction: column !important;
    height: 100%;
    min-height: 160px;
    width: calc(25% - 1.125rem) !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
}

#vermittler-documents-content .document-item:hover,
.vermittler-documents-list .document-item:hover,
.vermittler-invoices-list .invoice-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border-color: var(--portal-primary);
}

.document-info {
    flex: 1;
    margin-bottom: 0.75rem;
}

.document-info h4 {
    color: var(--portal-dark);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    word-break: break-word;
    line-height: 1.2;
}

.document-info p {
    color: #666;
    font-size: 0.85rem;
    margin: 0.2rem 0;
    line-height: 1.3;
}

.document-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    flex-wrap: wrap;
}

.document-actions .btn {
    flex: 1;
    min-width: 80px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 4px;
    text-decoration: none;
    text-align: center;
    transition: var(--portal-transition);
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.document-actions .btn-primary {
    background: var(--portal-primary);
    color: white;
}

.document-actions .btn-primary:hover {
    background: var(--portal-secondary);
    transform: translateY(-1px);
}

.document-actions .btn-danger {
    background: var(--portal-danger);
    color: white;
}

.document-actions .btn-danger:hover {
    background: #b32d2e;
    transform: translateY(-1px);
}

:root {
    --portal-primary: #74b72a;
    --portal-secondary: #558B2F;
    --portal-success: #00a32a;
    --portal-warning: #ffb900;
    --portal-danger: #d63638;
    --portal-light: #f9f9f9;
    --portal-dark: #1e1e1e;
    --portal-border: #e0e0e0;
    --portal-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --portal-radius: 8px;
    --portal-transition: all 0.3s ease;
}

/* Portal Container */
.portal-dashboard {
    background: #f1f1f1;
    min-height: calc(100vh - 100px);
    padding: 2rem 1rem;
}

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

/* Portal Header */
.portal-header {
    background: linear-gradient(135deg, var(--portal-primary), var(--portal-secondary));
    color: white !important;
    padding: 2rem;
    border-radius: var(--portal-radius);
    margin-bottom: 2rem;
    box-shadow: var(--portal-shadow);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

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

.portal-header-icon,
.portal-header-avatar {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.portal-header-icon svg {
    width: 30px;
    height: 30px;
    color: white;
}

.portal-header-avatar {
    background: transparent;
    border: 3px solid rgba(255,255,255,0.3);
    position: relative;
    cursor: pointer;
    transition: var(--portal-transition);
}

.portal-header-avatar:hover {
    transform: scale(1.05);
    border-color: rgba(255,255,255,0.5);
}

.portal-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Profile picture zoom on hover */
.portal-header-avatar:hover::after {
    content: '';
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 150px;
    background-image: inherit;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    border: 4px solid white;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    animation: fadeInScale 0.3s ease forwards;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translateX(-50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}

.portal-header-text h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.8rem;
    font-weight: 600;
    color: white !important;
}

.portal-header-text p {
    margin: 0;
    opacity: 0.9;
    font-size: 1.1rem;
    color: white !important;
}

/* Dashboard Stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
    transition: var(--portal-transition);
    position: relative;
    overflow: hidden;
}

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

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--portal-primary), var(--portal-secondary));
}

.stat-card-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card-icon {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-icon.primary { background: rgba(116,183,42,0.1); color: var(--portal-primary); }
.stat-card-icon.success { background: rgba(0,163,42,0.1); color: var(--portal-success); }
.stat-card-icon.warning { background: rgba(255,185,0,0.1); color: var(--portal-warning); }
.stat-card-icon.danger { background: rgba(214,54,56,0.1); color: var(--portal-danger); }

.stat-card-text h3 {
    margin: 0 0 0.25rem 0;
    font-size: 2rem;
    font-weight: 700;
    color: var(--portal-dark);
}

.stat-card-text p {
    margin: 0;
    color: #666;
    font-size: 0.95rem;
}

/* Portal Tabs */
.portal-tabs-wrapper {
    background: white;
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
    overflow: hidden;
    margin-bottom: 2rem;
}

.tabs-nav {
    display: flex;
    background: #f9f9f9;
    border-bottom: 1px solid var(--portal-border);
}

.tab-link {
    flex: 1;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: #666;
    transition: var(--portal-transition);
    position: relative;
    text-align: center;
}

.tab-link:hover {
    background: rgba(116,183,42,0.05);
    color: var(--portal-primary);
}

.tab-link.active {
    background: white;
    color: var(--portal-primary);
    font-weight: 600;
}

.tab-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--portal-primary);
}

.tab-content {
    display: none;
    padding: 2rem;
}

.tab-content.active {
    display: block;
}

/* Project Grid */
.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.project-card {
    background: white;
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
    overflow: hidden;
    transition: var(--portal-transition);
    position: relative;
}

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

.project-card-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 1px solid var(--portal-border);
}

.project-card-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--portal-dark);
}

.project-card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.project-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-status.planning { background: rgba(255,185,0,0.2); color: #cc8800; }
.project-status.in-progress { background: rgba(116,183,42,0.2); color: #558B2F; }
.project-status.completed { background: rgba(0,163,42,0.2); color: #5a9023; }
.project-status.on-hold { background: rgba(214,54,56,0.2); color: #c62828; }

.project-card-body {
    padding: 1.5rem;
}

.project-card-progress {
    margin-bottom: 1rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #666;
}

.progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--portal-primary), var(--portal-secondary));
    border-radius: 4px;
    transition: width 0.6s ease;
}

/* Progress container for project overview modal */
.progress-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.progress-container .progress-bar {
    flex: 1;
    min-width: 80px;
}

.progress-container .progress-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
    white-space: nowrap;
}

.project-card-actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-top: 1px solid var(--portal-border);
}

.btn-card {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 1px solid var(--portal-border);
    border-radius: 4px;
    background: white;
    color: #666;
    text-decoration: none;
    text-align: center;
    font-size: 0.9rem;
    transition: var(--portal-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-card:hover {
    background: var(--portal-primary);
    color: white;
    border-color: var(--portal-primary);
    text-decoration: none;
}

.btn-card svg {
    width: 16px;
    height: 16px;
}

/* Portal Notices */
.portal-notice {
    background: white;
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--portal-shadow);
}

.portal-notice svg {
    width: 48px;
    height: 48px;
    color: #ccc;
    margin-bottom: 1rem;
}

.portal-notice p {
    margin: 0;
    color: #666;
    font-size: 1.1rem;
}

/* File List */
.portal-file-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.portal-file-list li {
    margin-bottom: 0.5rem;
}

.portal-file-list a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border: 1px solid var(--portal-border);
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    transition: var(--portal-transition);
}

.portal-file-list a:hover {
    background: var(--portal-light);
    border-color: var(--portal-primary);
    color: var(--portal-primary);
    text-decoration: none;
}

.portal-file-list svg {
    width: 20px;
    height: 20px;
    color: var(--portal-primary);
}

/* Logout Button */
.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #f8f9fa;
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    color: #666;
    text-decoration: none;
    transition: var(--portal-transition);
    margin-top: 2rem;
}

.btn-logout:hover {
    background: var(--portal-danger);
    color: white;
    border-color: var(--portal-danger);
    text-decoration: none;
}

.btn-logout svg {
    width: 18px;
    height: 18px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .portal-dashboard {
        padding: 1rem 0.5rem;
    }
    
    .portal-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .portal-header-avatar,
    .portal-header-icon {
        width: 80px;
        height: 80px;
        margin-bottom: 1rem;
    }
    
    .portal-header-avatar:hover::after {
        display: none; /* Disable hover effect on mobile */
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .tabs-nav {
        flex-direction: column;
    }
    
    .tab-link {
        text-align: left;
    }
    
    .portal-grid {
        grid-template-columns: 1fr;
    }
    
    .project-card-actions {
        flex-direction: column;
    }
    
    .stat-card-content {
        flex-direction: column;
        text-align: center;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.6s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-up {
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Customer Document Cards */
.documents-section {
    margin-bottom: 2rem;
}

.portal-section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--portal-dark);
}

.portal-section-title svg {
    width: 24px;
    height: 24px;
    color: var(--portal-primary);
}

.documents-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.document-card {
    background: white;
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
    overflow: hidden;
    transition: var(--portal-transition);
    position: relative;
    border: 1px solid var(--portal-border);
}

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

.document-card-header {
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 1px solid var(--portal-border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.document-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.8);
    border-radius: 8px;
    flex-shrink: 0;
}

.document-icon svg {
    width: 20px;
    height: 20px;
}

.document-category {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.document-card-body {
    padding: 1.5rem;
}

.document-title {
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--portal-dark);
    line-height: 1.4;
}

.document-project {
    margin: 0 0 0.5rem 0;
    color: var(--portal-primary);
    font-size: 0.85rem;
    font-weight: 500;
}

.document-description {
    margin: 0 0 1rem 0;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
}

.document-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: #666;
}

.document-date,
.document-size {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.document-date svg,
.document-size svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.document-card-actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-top: 1px solid var(--portal-border);
}

.btn-download {
    padding: 0.5rem 1rem;
    border: 1px solid var(--portal-border);
    border-radius: 4px;
    background: white;
    color: #666;
    text-decoration: none;
    text-align: center;
    font-size: 0.85rem;
    transition: var(--portal-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-weight: 500;
}

.btn-download:hover {
    background: var(--portal-primary);
    color: white;
    border-color: var(--portal-primary);
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-download svg {
    width: 14px;
    height: 14px;
}

/* Modern Action Buttons */
.btn-action {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.btn-action::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
    pointer-events: none;
}

.btn-action:hover::before {
    left: 100%;
}

.btn-action:active {
    transform: translateY(1px);
}

.btn-action.btn-download {
    background: linear-gradient(135deg, #74b72a, #8bc34a);
    color: white;
    border: 1px solid rgba(116, 183, 42, 0.3);
}

.btn-action.btn-download:hover {
    background: linear-gradient(135deg, #689f26, #74b72a);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(116, 183, 42, 0.3);
    text-decoration: none;
    color: white;
}

.btn-action.btn-delete {
    background: linear-gradient(135deg, #f44336, #e57373);
    color: white;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.btn-action.btn-delete:hover {
    background: linear-gradient(135deg, #d32f2f, #f44336);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
    text-decoration: none;
    color: white;
}

.btn-action svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Invoice Actions Container */
.invoice-actions {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-top: 1px solid var(--portal-border);
    justify-content: center;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.invoice-actions .btn-action {
    flex: 1;
    min-width: 120px;
}

/* Specific styling for invoice download button */
.invoice-actions .btn-download {
    width: 70%;
    max-width: 200px;
    margin: 0 auto;
    display: block;
    text-align: center;
}

/* Category-specific styling */
.document-card[data-category="vertrag"] {
    border-left: 4px solid #74b72a;
}

.document-card[data-category="rechnung"] {
    border-left: 4px solid #ffb900;
}

.document-card[data-category="bescheinigung"] {
    border-left: 4px solid #2196f3;
}

.document-card[data-category="steuer"] {
    border-left: 4px solid #9c27b0;
}

.document-card[data-category="sonstiges"] {
    border-left: 4px solid #666;
}

/* Document search and filter */
.documents-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.documents-search {
    flex: 1;
    max-width: 300px;
    position: relative;
}

.documents-search input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    font-size: 0.9rem;
    transition: var(--portal-transition);
}

.documents-search input:focus {
    outline: none;
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 2px rgba(116,183,42,0.1);
}

.documents-search svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: #666;
    pointer-events: none;
}

.documents-filter {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--portal-border);
    border-radius: 20px;
    background: white;
    color: #666;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--portal-transition);
    text-decoration: none;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--portal-primary);
    color: white;
    border-color: var(--portal-primary);
    text-decoration: none;
}

/* Empty state */
.documents-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.documents-empty svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Responsive Design for Documents */
@media (max-width: 768px) {
    .documents-grid {
        grid-template-columns: 1fr;
    }
    
    .documents-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .documents-search {
        max-width: none;
        margin-bottom: 1rem;
    }
    
    .documents-filter {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .document-card-actions {
        flex-direction: column;
    }
    
    .portal-section-title {
        font-size: 1.2rem;
    }
}

/* ==========================================================================
   Vermittler Forms and Submissions
   ========================================================================== */

/* Form Containers */
.billing-form-container,
.submission-form-container {
    margin-bottom: 4rem;
}

.portal-form {
    background: linear-gradient(145deg, #ffffff 0%, #fafbfc 100%);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 
        0 20px 40px rgba(0,0,0,0.08),
        0 8px 16px rgba(0,0,0,0.04),
        inset 0 1px 0 rgba(255,255,255,0.9);
    margin-bottom: 3rem;
    border: 1px solid rgba(255,255,255,0.2);
    position: relative;
    overflow: hidden;
}

.portal-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--portal-primary), var(--portal-secondary), #5a9023);
    border-radius: 20px 20px 0 0;
}

.portal-form::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(116,183,42,0.03) 0%, transparent 70%);
    pointer-events: none;
}

.form-header {
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
    z-index: 2;
}

.form-header h3 {
    color: #1a1a1a;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.02em;
}

.form-header p {
    color: #666;
    font-size: 1.1rem;
    margin: 0;
    font-weight: 400;
}

.form-section {
    position: relative;
    z-index: 2;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    position: relative;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #1a1a1a;
    font-size: 1rem;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group label::before {
    content: '';
    width: 3px;
    height: 16px;
    background: linear-gradient(135deg, var(--portal-primary), var(--portal-secondary));
    border-radius: 2px;
    flex-shrink: 0;
}

.required-asterisk {
    color: #e53e3e;
    font-weight: 700;
    margin-left: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 1rem 1.25rem;
    border: 2px solid #e8eaed;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    position: relative;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 8px rgba(0,0,0,0.04);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--portal-primary);
    box-shadow: 
        0 0 0 4px rgba(116, 183, 42, 0.1),
        0 8px 16px rgba(116, 183, 42, 0.08);
    transform: translateY(-1px);
}

.form-group input:valid,
.form-group select:valid,
.form-group textarea:valid {
    border-color: #10b981;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.form-group input[type="file"] {
    padding: 1rem;
    border: 2px dashed #d1d5db;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.form-group input[type="file"]:hover {
    border-color: var(--portal-primary);
    background: rgba(116, 183, 42, 0.02);
}

.form-group input[type="file"]:focus {
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 4px rgba(116, 183, 42, 0.1);
}

.form-help {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-help::before {
    content: 'ℹ️';
    font-size: 0.75rem;
}

/* Premium Input Effects */
.form-group {
    position: relative;
}

.form-group input:focus + .input-highlight,
.form-group select:focus + .input-highlight,
.form-group textarea:focus + .input-highlight {
    opacity: 1;
    transform: scaleX(1);
}

.input-highlight {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--portal-primary), var(--portal-secondary));
    border-radius: 1px;
    opacity: 0;
    transform: scaleX(0);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Premium Button Styles */
.form-actions {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(0,0,0,0.06);
    text-align: center;
    position: relative;
    z-index: 2;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 2.5rem;
    border: none;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    font-family: inherit;
    letter-spacing: 0.02em;
    position: relative;
    overflow: hidden;
    min-width: 200px;
    min-height: 56px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.6s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--portal-primary) 0%, var(--portal-secondary) 50%, #5a9023 100%);
    color: white;
    box-shadow: 
        0 8px 24px rgba(116, 183, 42, 0.25),
        0 4px 12px rgba(116, 183, 42, 0.15),
        inset 0 1px 0 rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.1);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 16px 40px rgba(116, 183, 42, 0.35),
        0 8px 20px rgba(116, 183, 42, 0.25),
        inset 0 1px 0 rgba(255,255,255,0.3);
    background: linear-gradient(135deg, #5a8f20 0%, var(--portal-primary) 50%, var(--portal-secondary) 100%);
}

.btn-primary:active {
    transform: translateY(-1px) scale(0.98);
    transition: all 0.1s ease;
}

.btn-primary:disabled {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid #e5e7eb;
    opacity: 0.7;
}

.btn-primary:disabled::before {
    display: none;
}

.btn-primary:disabled svg {
    transform: none;
}

.btn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.btn:hover svg {
    transform: scale(1.1) rotate(5deg);
}

/* Loading state */
.btn.loading {
    pointer-events: none;
    position: relative;
}

.btn.loading svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Success state animation */
.btn.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Invoice and Submission Cards */
.submitted-invoices,
.submitted-documents {
    margin-top: 3rem;
}

.submitted-invoices h4,
.submitted-documents h4 {
    color: #333;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.invoices-grid,
.submissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.invoice-card,
.submission-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--portal-shadow);
    border-left: 4px solid var(--portal-primary);
    transition: var(--portal-transition);
}

.invoice-card:hover,
.submission-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.invoice-header,
.submission-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.invoice-header h5,
.submission-header h5 {
    margin: 0;
    font-size: 1.125rem;
    color: #333;
    font-weight: 600;
    line-height: 1.3;
}

.invoice-status,
.submission-status,
.submission-priority {
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
    text-align: center;
}

.submission-badges {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
}

.invoice-body,
.submission-body {
    font-size: 0.9rem;
    line-height: 1.5;
}

.invoice-body p,
.submission-body p {
    margin: 0.5rem 0;
}

.invoice-body strong,
.submission-body strong {
    color: #333;
    font-weight: 600;
}

.invoice-response,
.submission-feedback {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    border-left: 3px solid var(--portal-primary);
}

.invoice-response strong,
.submission-feedback strong {
    color: var(--portal-primary);
    display: block;
    margin-bottom: 0.5rem;
}

.invoice-response p,
.submission-feedback p {
    margin: 0;
    color: #555;
}

/* Status Colors */
.status-eingegangen { background-color: rgba(33, 150, 243, 0.2); color: #1976d2; }
.status-pruefung { background-color: rgba(255, 152, 0, 0.2); color: #f57c00; }
.status-genehmigt { background-color: rgba(76, 175, 80, 0.2); color: #388e3c; }
.status-zur-zahlung { background-color: rgba(156, 39, 176, 0.2); color: #7b1fa2; }
.status-bezahlt { background-color: rgba(76, 175, 80, 0.2); color: #388e3c; }
.status-abgelehnt { background-color: rgba(244, 67, 54, 0.2); color: #d32f2f; }
.status-rueckfrage { background-color: rgba(255, 87, 34, 0.2); color: #e64a19; }
.status-akzeptiert { background-color: rgba(76, 175, 80, 0.2); color: #388e3c; }
.status-archiviert { background-color: rgba(158, 158, 158, 0.2); color: #616161; }

/* Priority Colors */
.priority-niedrig { background-color: rgba(76, 175, 80, 0.2); color: #388e3c; }
.priority-normal { background-color: rgba(255, 152, 0, 0.2); color: #f57c00; }
.priority-hoch { background-color: rgba(255, 87, 34, 0.2); color: #e64a19; }
.priority-kritisch { background-color: rgba(244, 67, 54, 0.2); color: #d32f2f; }

/* Empty States */
.portal-notice {
    text-align: center;
    padding: 3rem 2rem;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #e0e0e0;
}

.portal-notice svg {
    width: 48px;
    height: 48px;
    color: #999;
    margin-bottom: 1rem;
}

.portal-notice p {
    color: #666;
    font-size: 1.1rem;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .invoices-grid,
    .submissions-grid {
        grid-template-columns: 1fr;
    }
    
    .portal-form {
        padding: 1.5rem;
    }
    
    .submission-badges {
        align-items: flex-start;
    }
    
    .invoice-header,
    .submission-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .invoice-status,
    .submission-status,
    .submission-priority {
        align-self: flex-start;
    }
    
    /* Compact Vermittler Billing Stats - Mobile */
    .vermittler-billing-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .vermittler-billing-stats .billing-stat-card {
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .vermittler-billing-stats .billing-stat-icon {
        width: 28px;
        height: 28px;
    }
    
    .vermittler-billing-stats .billing-stat-icon svg {
        width: 14px;
        height: 14px;
    }
    
    .vermittler-billing-stats .billing-stat-content h4 {
        font-size: 1rem;
    }
    
    .vermittler-billing-stats .billing-stat-content p {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .portal-form {
        padding: 1rem;
    }
    
    .invoice-card,
    .submission-card {
        padding: 1rem;
    }
}

/* ==========================================================================
   Premium Notifications
   ========================================================================== */

.notification-toast {
    position: fixed;
    top: 30px;
    right: 30px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 
        0 20px 40px rgba(0,0,0,0.15),
        0 8px 16px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.9);
    padding: 1.5rem;
    min-width: 400px;
    max-width: 500px;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    z-index: 10000;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid;
}

.notification-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-toast.notification-success {
    border-left-color: #10b981;
}

.notification-toast.notification-error {
    border-left-color: #ef4444;
}

.notification-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.notification-success .notification-icon {
    color: #10b981;
}

.notification-error .notification-icon {
    color: #ef4444;
}

.notification-content {
    flex: 1;
}

.notification-content h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a1a;
}

.notification-content p {
    margin: 0;
    font-size: 0.95rem;
    color: #666;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.notification-close:hover {
    background: rgba(0,0,0,0.1);
    color: #666;
}

/* Mobile Toast Overrides V1.0 */
@media (max-width: 768px) {
    .notification-toast {
        top: 70px; /* Below mobile header */
        right: 15px;
        left: 15px;
        min-width: unset;
        max-width: calc(100% - 30px);
        padding: 1rem;
        border-radius: 12px;
    }

    .notification-content h4 {
        font-size: 1rem;
    }

    .notification-content p {
        font-size: 0.9rem;
    }

    /* Touch-friendly close button */
    .notification-close {
        min-width: 44px;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .notification-toast {
        top: 60px;
        right: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
        padding: 0.875rem;
        gap: 0.75rem;
    }

    .notification-content h4 {
        font-size: 0.95rem;
    }

    .notification-content p {
        font-size: 0.85rem;
    }
}

/* ==========================================================================
   Customer Billing Section
   ========================================================================== */

.billing-summary {
    margin-bottom: 3rem;
}

.billing-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.billing-stat-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--portal-shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--portal-transition);
    border-left: 4px solid;
}

.billing-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.billing-stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.billing-stat-icon.success { 
    background: rgba(76,175,80,0.1); 
    color: #4caf50;
}

.billing-stat-icon.warning { 
    background: rgba(255,152,0,0.1); 
    color: #ff9800;
}

.billing-stat-icon.danger { 
    background: rgba(244,67,54,0.1); 
    color: #f44336;
}

.billing-stat-icon.primary { 
    background: rgba(116,183,42,0.1); 
    color: var(--portal-primary);
}

.billing-stat-card:nth-child(1) { border-left-color: #4caf50; }
.billing-stat-card:nth-child(2) { border-left-color: #ff9800; }
.billing-stat-card:nth-child(3) { border-left-color: #f44336; }
.billing-stat-card:nth-child(4) { border-left-color: var(--portal-primary); }

.billing-stat-content h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
}

.billing-stat-content p {
    margin: 0;
    color: #666;
    font-size: 0.95rem;
    font-weight: 500;
}

/* Compact Vermittler Billing Stats */
.vermittler-billing-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.vermittler-billing-stats .billing-stat-card {
    padding: 0.875rem;
    border-radius: 12px;
    gap: 0.75rem;
    border-left-width: 3px;
}

.vermittler-billing-stats .billing-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
}

.vermittler-billing-stats .billing-stat-icon svg {
    width: 18px;
    height: 18px;
}

.vermittler-billing-stats .billing-stat-content h4 {
    font-size: 1.25rem;
    margin: 0 0 0.125rem 0;
    line-height: 1.2;
}

.vermittler-billing-stats .billing-stat-content p {
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    line-height: 1.2;
}

.vermittler-billing-stats .billing-stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* Customer Invoice Cards */
.customer-invoice {
    border-left-color: var(--portal-primary) !important;
}

.invoice-number {
    flex: 1;
}

.invoice-amount {
    text-align: right;
}

.invoice-amount .amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
}

.payment-progress {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.customer-message {
    background: #e3f2fd;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    border-left: 3px solid #2196f3;
}

.customer-message strong {
    color: #1976d2;
    display: block;
    margin-bottom: 0.5rem;
}

.customer-message p {
    margin: 0;
    color: #555;
}

.btn-primary {
    background: linear-gradient(135deg, var(--portal-primary), var(--portal-secondary));
    color: white !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--portal-secondary), #5a9023);
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .billing-stats {
        grid-template-columns: 1fr;
    }
    
    .billing-stat-card {
        padding: 1rem;
    }
    
    .billing-stat-content h4 {
        font-size: 1.5rem;
    }
    
    .invoice-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .invoice-amount {
        text-align: left;
    }
}

/* Vermittler Assignment Layout */
.vermittler-input-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.vermittler-select-container {
    flex: 1;
    position: relative;
}

.vermittler-select-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--portal-border);
    border-radius: 4px;
    font-size: 0.9rem;
    transition: var(--portal-transition);
}

.vermittler-select-input:focus {
    border-color: var(--portal-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(116, 183, 42, 0.1);
}

.vermittler-select-input.changed {
    border-color: var(--portal-warning);
    background-color: rgba(255, 185, 0, 0.05);
}

.btn-add-vermittler {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--portal-primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--portal-transition);
    white-space: nowrap;
}

.btn-add-vermittler:hover:not(:disabled) {
    background: #5d9620;
    transform: translateY(-1px);
}

.btn-add-vermittler:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-add-vermittler svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-add-vermittler .btn-text {
    font-size: 0.85rem;
}

.autocomplete-loading {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    z-index: 10;
    display: none !important; /* Hide by default - !important to override inline styles */
}

.autocomplete-loading.active,
.autocomplete-loading[style*="display: block"] {
    display: block !important; /* Show when active or when JavaScript sets display: block */
}

.loading-spinner-mini {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--portal-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive design for vermittler assignment */
@media (max-width: 768px) {
    .vermittler-input-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-add-vermittler .btn-text {
        display: none;
    }
    
    .btn-add-vermittler {
        padding: 0.5rem;
        width: 100%;
        justify-content: center;
    }
}

/* Project Overview Modal Specific Styles */
.project-overview-item {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    background: white;
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    margin-bottom: 1rem;
    box-shadow: var(--portal-shadow);
    transition: var(--portal-transition);
}

.project-overview-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.project-overview-image-container {
    flex-shrink: 0;
    width: 120px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
}

.project-overview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-overview-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #666;
    font-size: 1.5rem;
}

.project-overview-placeholder small {
    font-size: 0.7rem;
    margin-top: 0.25rem;
}

.project-overview-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.project-overview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.project-overview-info {
    flex: 1;
}

.project-overview-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--portal-dark);
    line-height: 1.3;
}

.project-overview-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.project-overview-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-overview-status.status-active,
.project-overview-status.status-in-progress {
    background: rgba(76, 175, 80, 0.2);
    color: #388e3c;
}

.project-overview-status.status-planning {
    background: rgba(255, 152, 0, 0.2);
    color: #f57c00;
}

.project-overview-status.status-fertiggestellt {
    background: rgba(39, 174, 96, 0.2);
    color: #229954;
}

.project-overview-location {
    color: #666;
    font-size: 0.9rem;
}

.project-overview-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.project-detail-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.project-detail-row .detail-label {
    font-weight: 500;
    color: var(--portal-dark);
    min-width: 80px;
    font-size: 0.9rem;
}

.project-detail-row .progress-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    max-width: 200px;
}

.project-detail-row .progress-bar {
    flex: 1;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    min-width: 100px;
}

.project-detail-row .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--portal-primary), var(--portal-secondary));
    border-radius: 3px;
    transition: width 0.6s ease;
}

.project-detail-row .progress-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: #666;
    white-space: nowrap;
    min-width: 35px;
    text-align: right;
}

.project-detail-row:last-child {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.detail-info {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: #f8f9fa;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #666;
    white-space: nowrap;
}

.project-overview-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: auto;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 6px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--portal-transition);
}

.btn-outline {
    background: white;
    border: 1px solid var(--portal-border);
    color: #666;
}

.btn-outline:hover {
    background: var(--portal-light);
    border-color: var(--portal-primary);
    color: var(--portal-primary);
    text-decoration: none;
}

.btn-primary.btn-small {
    background: var(--portal-primary);
    border: 1px solid var(--portal-primary);
    color: white;
}

.btn-primary.btn-small:hover {
    background: #5d9620;
    border-color: #5d9620;
    text-decoration: none;
    color: white;
}

/* Responsive design for project overview */
@media (max-width: 768px) {
    .project-overview-item {
        flex-direction: column;
        gap: 1rem;
    }
    
    .project-overview-image-container {
        width: 100%;
        height: 120px;
    }
    
    .project-overview-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .project-overview-meta {
        gap: 0.5rem;
    }
    
    .project-detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .project-detail-row .detail-label {
        min-width: auto;
    }
    
    .project-detail-row .progress-container {
        width: 100%;
        max-width: none;
    }
    
    .project-detail-row:last-child {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .project-overview-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-small {
        width: 100%;
        justify-content: center;
    }
}

/* Fix Content Security Policy for blob URLs (used by file uploads) */
.portal-stats-overview {
    margin-bottom: 2rem;
}

/* PROJECT MANAGEMENT - "Projekt ansehen" Button Fix */
.action-btn {
    color: white !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    background: var(--portal-primary, #16a34a) !important;
    padding: 0.5rem 1rem !important;
    border-radius: 6px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    border: none !important;
}

.action-btn:hover {
    background: var(--portal-primary-dark, #15803d) !important;
    color: white !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3) !important;
}

.action-btn span {
    color: white !important;
    font-weight: 500 !important;
}

.action-btn svg,
.action-btn i {
    color: white !important;
    fill: white !important;
}

/* Ensure all nested elements in action-btn have white text */
.action-btn * {
    color: white !important;
}

/* Specific fix for project management "Projekt ansehen" buttons */
#projektManagement .action-btn,
.projekt-card .action-btn,
.project-actions .action-btn {
    color: white !important;
}

#projektManagement .action-btn span,
.projekt-card .action-btn span,
.project-actions .action-btn span {
    color: white !important;
}

/* COMPACT CUSTOMER DOCUMENTS LAYOUT */
.customer-documents-controls.compact {
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.controls-section.compact {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: end;
}

.control-group.compact {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 120px;
}

.control-group.compact label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.premium-select.compact {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: white;
    min-width: 120px;
}

.btn-refresh.compact {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.btn-refresh.compact .btn-text {
    display: inline;
}

/* Compact Statistics */
.upload-statistics.compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

/* CENTRAL DEFINITION FOR STAT-CARD-MINI - THE ONLY SOURCE OF TRUTH */
.stat-card-mini {
    background: linear-gradient(to bottom right, #74b72a, #558b2f) !important;
    border-radius: 12px !important;
    padding: 1rem !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    position: relative !important;
    overflow: hidden !important;
}

.stat-card-mini:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(22, 163, 74, 0.3) !important;
}

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

.stat-card-mini .stat-icon {
    background: rgba(255,255,255,0.2) !important;
    border-radius: 8px !important;
    padding: 0.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.stat-card-mini .stat-number {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    color: white !important;
}

.stat-card-mini .stat-label {
    font-size: 0.875rem !important;
    opacity: 0.9 !important;
    color: white !important;
}

.stat-card-mini.compact {
    padding: 0.75rem !important;
    min-height: 60px !important;
    gap: 0.5rem !important;
}

.stat-icon.compact {
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.2) !important;
    border-radius: 6px !important;
    flex-shrink: 0;
}

.stat-content.compact {
    flex: 1;
}

.stat-content.compact .stat-number {
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    margin-bottom: 0.1rem;
}

.stat-content.compact .stat-label {
    font-size: 0.75rem !important;
    opacity: 0.9 !important;
    line-height: 1;
}

/* Compact Content Area */
.customer-documents-content.compact {
    margin-top: 0;
}

/* Compact Document Cards */
.customer-documents-list .document-card {
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.document-card .document-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.document-card .document-icon {
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

.document-card .document-category {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    background: #e5e7eb;
    border-radius: 12px;
    color: #374151;
    text-transform: uppercase;
    font-weight: 600;
}

.document-card .document-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: #111827;
}

.document-card .document-project {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.document-card .document-description {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.document-card .document-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 0.5rem;
}

.document-card .document-card-actions {
    display: flex;
    justify-content: flex-end;
}

.document-card .btn-download {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    background: var(--portal-primary);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: background 0.2s ease;
}

.document-card .btn-download:hover {
    background: var(--portal-primary-dark);
    color: white;
}

/* Upload Source Indicator - Color Strip at Top */
.document-card.customer-upload::before,
.document-card.employee-upload::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    z-index: 2;
}

.document-card.customer-upload::before {
    background: linear-gradient(90deg, #74b72a 0%, #5a9023 100%);
}

.document-card.employee-upload::before {
    background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

/* Upload Source Badge - In Card Body */
.document-card-body .upload-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    width: fit-content;
}

.upload-source-badge svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Customer Upload Badge - Green Theme */
.upload-source-badge.customer {
    background: #74b72a;
    color: white;
    box-shadow: 0 2px 4px rgba(116, 183, 42, 0.3);
}

/* Employee Upload Badge - Orange Theme */
.upload-source-badge.employee {
    background: #f59e0b;
    color: white;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

/* Document Card Border Styling based on Upload Type */
.document-card.customer-upload {
    border: 1px solid #e5e7eb;
    background: white;
    position: relative;
    overflow: hidden;
}

.document-card.customer-upload:hover {
    box-shadow: 0 4px 16px rgba(116, 183, 42, 0.15);
    border-color: #d4d4d8;
}

.document-card.employee-upload {
    border: 1px solid #e5e7eb;
    background: white;
    position: relative;
    overflow: hidden;
}

.document-card.employee-upload:hover {
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.15);
    border-color: #fbbf24;
}

/* Document Card Header - Simplified without badge */
.document-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
}

.document-card-header .document-category {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* No animations needed for subtle design */

/* Table Row Styling for List View */
tr.customer-uploaded-row {
    background: white;
    border-left: 4px solid #74b72a;
}

tr.employee-uploaded-row {
    background: white;
    border-left: 4px solid #f59e0b;
}

/* Upload Type Indicator in Compact Views */
.upload-type-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.upload-type-indicator.customer {
    background: #74b72a;
    box-shadow: 0 0 0 3px rgba(116, 183, 42, 0.2);
}

.upload-type-indicator.employee {
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

/* Responsive Compact Layout */
@media (max-width: 768px) {
    .controls-section.compact {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group.compact {
        min-width: 100%;
    }
    
    .premium-select.compact {
        min-width: 100%;
    }
    
    .upload-statistics.compact {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .stat-card-mini.compact {
        padding: 0.6rem !important;
        min-height: 50px !important;
    }
    
    .stat-content.compact .stat-number {
        font-size: 1rem !important;
    }
    
    .stat-content.compact .stat-label {
        font-size: 0.7rem !important;
    }
    
    .btn-refresh.compact .btn-text {
        display: none;
    }
}

@media (max-width: 480px) {
    .upload-statistics.compact {
        grid-template-columns: 1fr;
    }
}

/* DOCUMENT ARCHIVE LAYOUT (Green Theme - Site Consistent) */
.document-archive-controls.compact {
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f1f8e9;
    border-radius: 8px;
    border-left: 4px solid #16a34a;
}

.archive-statistics.compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-card-mini.green {
    background: linear-gradient(to bottom right, #74b72a, #558b2f) !important;
    color: white !important;
}

.stat-card-mini.green:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(116, 183, 42, 0.3) !important;
}

.stat-card-mini.green.compact {
    padding: 0.75rem !important;
    min-height: 60px !important;
    gap: 0.5rem !important;
    color: white !important;
}

/* Ensure ALL TEXT in ALL stat cards is white */
.stat-card-mini *,
.stat-card-mini .stat-number,
.stat-card-mini .stat-label,
.stat-card-mini.green *,
.stat-card-mini.green.compact *,
.stat-card-mini.blue *,
.stat-card-mini.blue.compact * {
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Legacy blue style - now redirects to green */
.stat-card-mini.blue {
    background: linear-gradient(to bottom right, #74b72a, #558b2f) !important;
    color: white !important;
}

.stat-card-mini.blue:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(116, 183, 42, 0.3) !important;
}

.stat-card-mini.blue.compact {
    padding: 0.75rem !important;
    min-height: 60px !important;
    gap: 0.5rem !important;
    color: white !important;
}

/* Ensure all text in blue stat cards (now green) is white */
.stat-card-mini.blue *,
.stat-card-mini.blue.compact * {
    color: white !important;
}

.document-archive-content.compact {
    margin-top: 0;
}

.document-archive-list .document-card.archive-card {
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.document-archive-list .document-card.archive-card:hover {
    border-color: #16a34a;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.1);
}

.archive-documents .document-card .document-category {
    background: #dcfce7;
    color: #15803d;
}

.archive-documents .document-card .document-customer,
.archive-documents .document-card .document-project {
    color: #15803d;
    font-weight: 500;
}

.archive-documents .document-card .btn-download {
    background: #16a34a;
    color: white;
}

.archive-documents .document-card .btn-download:hover {
    background: #15803d;
}

/* Archive-specific responsive design */
@media (max-width: 768px) {
    .document-archive-controls.compact {
        padding: 0.75rem;
    }
    
    .archive-statistics.compact {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .archive-statistics.compact {
        grid-template-columns: 1fr;
    }
}

/* Enhanced document grid for both layouts */
.documents-grid.archive-documents {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.documents-grid.customer-documents {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

/* Responsive Grid für kleinere Bildschirme */
@media (max-width: 1200px) {
    .documents-grid,
    .documents-grid.archive-documents,
    .documents-grid.customer-documents {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .documents-grid,
    .documents-grid.archive-documents,
    .documents-grid.customer-documents {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .documents-grid,
    .documents-grid.archive-documents,
    .documents-grid.customer-documents {
        grid-template-columns: 1fr;
    }
}

/* Enhanced Document Archive List */
.document-archive-list.enhanced {
    margin-top: 1rem;
}

.document-archive-list.enhanced .document-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
    position: relative;
}

.document-archive-list.enhanced .document-card:hover {
    border-color: #16a34a;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.1);
    transform: translateY(-1px);
}

.document-archive-list.enhanced .document-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #16a34a, #15803d);
    border-radius: 8px 8px 0 0;
}

/* Source badges */
.document-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.document-source-badge.customer {
    background: #dcfce7;
    color: #15803d;
}

.document-source-badge.employee {
    background: #dbeafe;
    color: #1d4ed8;
}

.document-source-badge.vermittler {
    background: #fef3c7;
    color: #d97706;
}

.document-source-badge.system {
    background: #f3e8ff;
    color: #7c3aed;
}

/* Improved loading states */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid var(--portal-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
} 
/* ==========================================================================
   Invoice-specific styles to match document grid layout
   ========================================================================== */

.invoice-info {
    flex: 1;
    margin-bottom: 0.75rem;
}

.invoice-info .invoice-title {
    color: var(--portal-dark);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    word-break: break-word;
    line-height: 1.2;
}

.invoice-info .invoice-meta {
    color: #666;
    font-size: 0.85rem;
    margin: 0.2rem 0;
    line-height: 1.3;
}

.invoice-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: auto;
    padding: 1rem 2rem;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
}

.invoice-amount-display {
    text-align: right;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid var(--portal-primary);
}

.invoice-amount-display .amount-label {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.invoice-amount-display .amount-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--portal-primary);
}

.invoice-actions .action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    align-items: center;
    justify-content: center;
}

.invoice-actions .btn {
    width: 100%;
    height: 36px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 4px;
    text-decoration: none;
    text-align: center;
    transition: var(--portal-transition);
    border: none;
    cursor: pointer;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.invoice-actions .btn-view {
    background: var(--portal-primary);
    color: white;
}

.invoice-actions .btn-view:hover {
    background: var(--portal-secondary);
    transform: translateY(-1px);
}

.invoice-actions .btn-delete {
    background: var(--portal-danger);
    color: white;
}

.invoice-actions .btn-delete:hover {
    background: #b32d2e;
    transform: translateY(-1px);
}

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-pending .status-badge {
    background: #fff3cd;
    color: #856404;
}

.status-approved .status-badge {
    background: #d4edda;
    color: #155724;
}

.status-rejected .status-badge {
    background: #f8d7da;
    color: #721c24;
}

/* Status Badge Styles for Vermittler/Partner Documents */
.status-badge.warning {
    background: #fff3e0;
    color: #f57c00;
}

.status-badge.primary {
    background: #e3f2fd;
    color: #1976d2;
}

.status-badge.success {
    background: #e8f5e9;
    color: #5a9023;
}

.status-badge.danger {
    background: #ffebee;
    color: #c62828;
}

.status-badge.secondary {
    background: #f5f5f5;
    color: #616161;
}


/* ==========================================================================
   Document Archive List View & Toggle Styles
   ========================================================================== */

/* List View Styles */
.documents-list-view {
    width: 100%;
    overflow-x: auto;
    margin: 0 -0.5rem;
    padding: 0 0.5rem;
}

/* Scrollbar styling for horizontal scroll */
.documents-list-view::-webkit-scrollbar {
    height: 10px;
}

.documents-list-view::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

.documents-list-view::-webkit-scrollbar-thumb {
    background: #16a34a;
    border-radius: 5px;
}

.documents-list-view::-webkit-scrollbar-thumb:hover {
    background: #15803d;
}

/* CRITICAL: Override grid layout when in list view */
#vermittlerDocumentsList.vermittler-documents-grid .documents-list-view {
    display: block !important;  /* Override grid */
}

#vermittlerDocumentsList.vermittler-documents-grid .documents-list-view .documents-table {
    display: table !important;  /* Ensure table layout */
    width: 100%;
    min-width: 900px;  /* Minimum width for 7 columns */
}

/* CRITICAL FIX: Disable grid layout on parent container when table view is active */
#vermittlerDocumentsList.vermittler-documents-grid:has(.documents-list-view) {
    display: block !important;
    grid-template-columns: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.documents-table {
    width: 100%;
    background: white;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.documents-table thead {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #16a34a;
}

.documents-table th {
    padding: 1.25rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9375rem;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.documents-table .th-checkbox {
    width: 40px;
    text-align: center;
}

.documents-table .th-actions {
    width: 120px;
    text-align: center;
}

.documents-table tbody tr {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #e5e7eb;
}

.documents-table tbody tr:hover {
    background-color: #f9fafb;
}

.documents-table tbody tr.row-customer-upload {
    background: linear-gradient(90deg, rgba(116, 183, 42, 0.03) 0%, transparent 100%);
}

.documents-table tbody tr.row-employee-upload {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.03) 0%, transparent 100%);
}

.documents-table td {
    padding: 1rem 1rem;
    font-size: 0.9375rem;
    color: #111827;
    vertical-align: middle;
}

.documents-table .td-checkbox {
    text-align: center;
}

.documents-table .td-title {
    font-weight: 600;
    color: #111827;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Minimum column widths for better table layout */
.documents-table .th-title,
.documents-table .td-title {
    min-width: 200px;
}

.documents-table .th-category,
.documents-table .td-category {
    min-width: 120px;
}

.documents-table .th-project,
.documents-table .td-project {
    min-width: 150px;
}

.documents-table .th-partner,
.documents-table .td-partner {
    min-width: 140px;
}

.documents-table .th-date,
.documents-table .td-date {
    min-width: 100px;
    white-space: nowrap;
}

.documents-table .th-customer,
.documents-table .td-customer {
    min-width: 140px;
}

.documents-table .th-upload-type,
.documents-table .td-upload-type {
    min-width: 100px;
}

.documents-table .th-status,
.documents-table .td-status {
    min-width: 120px;
}

.documents-table .th-actions,
.documents-table .td-actions {
    min-width: 80px;
    text-align: center;
}

.documents-table .category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #e5e7eb;
    color: #374151;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.documents-table .upload-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.documents-table .upload-type-badge.customer {
    background: rgba(116, 183, 42, 0.1);
    color: #16a34a;
}

.documents-table .upload-type-badge.employee {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.documents-table .td-actions {
    text-align: center;
}

.documents-table .action-buttons-row {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.documents-table .btn-action {
    padding: 0.375rem 0.75rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    text-decoration: none;
}

.documents-table .btn-action.btn-download-small {
    background: #16a34a;
    color: white;
}

.documents-table .btn-action.btn-download-small:hover {
    background: #15803d;
    transform: translateY(-1px);
}

.documents-table .btn-action.btn-delete-small {
    background: #ef4444;
    color: white;
}

.documents-table .btn-action.btn-delete-small:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Icon-Only Button Styles for Table View */
.btn-icon-only {
    padding: 0.5rem !important;
    min-width: 36px !important;
    width: 36px !important;
    height: 36px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative;
    border-radius: 8px !important;
}

.btn-icon-only svg {
    width: 18px !important;
    height: 18px !important;
}

.btn-icon-only[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 10000;
}

.btn-icon-only:hover[data-tooltip]::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-8px);
}
/* Bulk Action Controls Styling */
.bulk-action-controls-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-top: 2px solid #16a34a;
    border-radius: 0 0 12px 12px;
    margin-top: -1px;
}

.bulk-selection-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.bulk-selection-info button {
    padding: 0.5rem 1rem;
    border: 1px solid #16a34a;
    background: white;
    color: #16a34a;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.bulk-selection-info button:hover {
    background: #16a34a;
    color: white;
}

.selected-count {
    font-size: 0.875rem;
    font-weight: 600;
    color: #14532d;
}

.bulk-action-buttons {
    display: flex;
    gap: 0.75rem;
}

.btn-bulk-download,
.btn-bulk-delete {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-bulk-download {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(22, 163, 74, 0.2);
}

.btn-bulk-download:hover {
    background: linear-gradient(135deg, #15803d 0%, #14532d 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(22, 163, 74, 0.3);
}

.btn-bulk-delete {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.btn-bulk-delete:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

/* View Toggle Styles */
.view-toggle-controls {
    display: flex;
    justify-content: flex-end;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-top: 1px solid #e5e7eb;
}

.view-toggle-wrapper {
    display: flex;
    gap: 0.5rem;
    background: white;
    padding: 0.25rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.view-toggle {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: #6b7280;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.view-toggle:not(.active) {
    background: transparent !important;
    color: #6b7280 !important;
}

.view-toggle.active {
    background: #16a34a !important;
    color: white !important;
}

.view-toggle:hover:not(.active) {
    background: #f3f4f6;
}

/* Document Icon Styles */
.document-icon svg {
    width: 24px;
    height: 24px;
}

.td-title svg {
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.5rem;
}

/* Upload Source Badge Styles for Table View */
.documents-table .td-upload-type .upload-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.documents-table .upload-source-badge.customer {
    background: #74b72a;
    color: white;
    box-shadow: 0 2px 4px rgba(116, 183, 42, 0.3);
    border: none;
}

.documents-table .upload-source-badge.employee {
    background: #f59e0b;
    color: white;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
    border: none;
}

.documents-table .upload-source-badge svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ==========================================================================
   Multi-Upload Toggle Switch & UI Components
   ========================================================================== */

/* Toggle Switch Design */
.upload-mode-toggle {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 24px;
    background-color: #ccc;
    border-radius: 24px;
    transition: background-color 0.4s ease;
    margin-right: 12px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.4s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #74b72a;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-switch:hover .toggle-slider {
    opacity: 0.8;
}

.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* Multi-Upload Container Styling */
#multiUploadContainer {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.document-upload-list {
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin: 15px 0;
    background: #fafafa;
    box-sizing: border-box;
}

.document-upload-list::-webkit-scrollbar {
    width: 8px;
}

.document-upload-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.document-upload-list::-webkit-scrollbar-thumb {
    background: #74b72a;
    border-radius: 4px;
}

.document-upload-list::-webkit-scrollbar-thumb:hover {
    background: #5a9023;
}

/* Document Row Styling */
.document-row {
    background: white;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
    position: relative;
    box-sizing: border-box;
}

/* Ensure all child elements use border-box */
.document-row * {
    box-sizing: border-box;
}

.document-row:hover {
    border-color: #74b72a;
    box-shadow: 0 4px 12px rgba(116, 183, 42, 0.1);
}

.document-row.uploading {
    opacity: 0.6;
    pointer-events: none;
}

.document-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.document-header h4 {
    margin: 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.document-header h4:before {
    content: "📄";
    margin-right: 8px;
    font-size: 20px;
}

/* Remove Document Button */
.remove-doc {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #dc3545;
    background: white;
    color: #dc3545;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.remove-doc:hover {
    background: #dc3545;
    color: white;
    transform: rotate(90deg);
}

/* Form Groups in Document Rows */
.document-row .form-group {
    margin-bottom: 15px;
}

.document-row .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
    font-size: 13px;
}

.document-row .form-group label small {
    font-weight: normal;
    color: #888;
    margin-left: 5px;
}

.document-row .form-control {
    width: 100%;
    max-width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

/* Specific styles for multi-upload file inputs */
.document-row input[type="file"].doc-file {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    height: auto;
    min-height: 38px;
    box-sizing: border-box;
}

/* Style the native file upload button */
.document-row input[type="file"].doc-file::-webkit-file-upload-button {
    padding: 6px 12px;
    margin-right: 10px;
    background: #74b72a;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.3s ease;
}

.document-row input[type="file"].doc-file::-webkit-file-upload-button:hover {
    background: #5a9023;
}

/* Firefox compatibility */
.document-row input[type="file"].doc-file::file-selector-button {
    padding: 6px 12px;
    margin-right: 10px;
    background: #74b72a;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.3s ease;
}

.document-row input[type="file"].doc-file::file-selector-button:hover {
    background: #5a9023;
}

.document-row .form-control:focus {
    outline: none;
    border-color: #74b72a;
    box-shadow: 0 0 0 3px rgba(116, 183, 42, 0.1);
}

.document-row textarea.form-control {
    resize: vertical;
    min-height: 60px;
    max-width: 100%;
    box-sizing: border-box;
}

/* Add Document Button */
.btn-add-document {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    color: #74b72a;
    border: 2px dashed #74b72a;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn-add-document:hover {
    background: #74b72a;
    color: white;
    border-style: solid;
}

.btn-add-document:before {
    content: "+";
    font-size: 20px;
    font-weight: bold;
}

/* Upload Progress Modal */
#multiUploadProgressModal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    min-width: 400px;
}

.upload-progress-item {
    margin-bottom: 15px;
}

.upload-progress-item .filename {
    font-weight: 500;
    margin-bottom: 5px;
    color: #333;
}

.upload-progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #74b72a, #5a9023);
    transition: width 0.3s ease;
    border-radius: 4px;
}

/* Success/Error States */
.upload-success {
    color: #28a745;
    font-weight: 500;
}

.upload-error {
    color: #dc3545;
    font-weight: 500;
}

/* File Size Indicator */
.file-size-indicator {
    display: inline-block;
    margin-left: 10px;
    padding: 2px 8px;
    background: #f0f0f0;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
}

.file-size-indicator.warning {
    background: #fff3cd;
    color: #856404;
}

.file-size-indicator.error {
    background: #f8d7da;
    color: #721c24;
}

/* Batch Upload Summary */
.batch-upload-summary {
    margin-top: 20px;
    padding: 15px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
}

.batch-upload-summary.has-errors {
    background: #fff3cd;
    border-color: #ffeaa7;
}

.batch-upload-summary h4 {
    margin: 0 0 10px 0;
    color: #155724;
}

.batch-upload-summary.has-errors h4 {
    color: #856404;
}

.batch-upload-summary ul {
    margin: 0;
    padding-left: 20px;
}

/* Fix for Modal Form Controls - Single Upload */
.portal-modal .form-group {
    margin-bottom: 1rem;
    box-sizing: border-box;
}

.portal-modal .form-group * {
    box-sizing: border-box;
}

.portal-modal .form-control,
.portal-modal input[type="text"],
.portal-modal input[type="email"],
.portal-modal input[type="number"],
.portal-modal input[type="file"],
.portal-modal select,
.portal-modal textarea,
.modal-content .form-control,
.modal-content input[type="text"],
.modal-content input[type="email"],
.modal-content input[type="number"],
.modal-content input[type="file"],
.modal-content select,
.modal-content textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Specific fix for document upload modal single mode */
#singleUploadContainer .form-group {
    box-sizing: border-box;
}

#singleUploadContainer .form-control,
#singleUploadContainer input[type="text"],
#singleUploadContainer input[type="file"],
#singleUploadContainer select,
#singleUploadContainer textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Fix for any input/select in modal body */
.modal-body .form-group,
.modal-body .form-control,
.modal-body input,
.modal-body select,
.modal-body textarea {
    box-sizing: border-box;
}

.modal-body .form-group input,
.modal-body .form-group select,
.modal-body .form-group textarea {
    max-width: 100%;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .document-row {
        padding: 15px;
    }

    #multiUploadProgressModal {
        min-width: 90vw;
        padding: 20px;
    }

    .upload-mode-toggle {
        margin: 1rem 0;
        padding: 0.75rem;
    }

    .document-header h4 {
        font-size: 14px;
    }
}
