/* ====================================================================
   WORKSPACE SELECTION MODAL STYLES
   Clean, modern workspace selection interface
   ==================================================================== */

.workspace-selection-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow: hidden;
}

.workspace-selection-modal-overlay.show {
    opacity: 1;
}

/* Prevent body scrolling when modal is open */
body:has(.workspace-selection-modal-overlay.show) {
    overflow: hidden;
}

/* Fallback for browsers that don't support :has() */
.modal-open {
    overflow: hidden !important;
}

.workspace-selection-modal {
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    max-width: 700px;
    width: 95%;
    max-height: 80vh;
    min-height: auto;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.workspace-selection-modal-overlay.show .workspace-selection-modal {
    transform: scale(1) translateY(0);
}

.workspace-selection-modal-content {
    padding: 0;
}

.workspace-selection-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.workspace-selection-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
}

.workspace-selection-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0;
}

.workspace-selection-body {
    padding: 2rem;
}

.workspace-selection-icon {
    text-align: center;
    margin-bottom: 1.5rem;
}

.workspace-selection-icon i {
    font-size: 4rem !important;
    color: #667eea;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
    filter: drop-shadow(0 4px 8px rgba(102, 126, 234, 0.15));
    cursor: pointer;
}

.workspace-selection-icon:hover i {
    color: #764ba2;
    transform: translateY(-4px) scale(1.1);
    text-shadow: 0 4px 16px rgba(118, 75, 162, 0.3);
    filter: drop-shadow(0 8px 16px rgba(118, 75, 162, 0.25));
}

.workspace-selection-icon:active i {
    transform: translateY(-2px) scale(1.05);
    color: #5b4396;
}

.workspace-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 40vh;
    overflow-y: auto;
    min-height: auto;
    flex: 1;
}

/* Dynamic modal sizing based on workspace count */
.workspace-selection-modal.modal-small {
    max-height: auto;
    min-height: auto;
}

.workspace-selection-modal.modal-medium {
    max-height: 70vh;
    min-height: auto;
}

.workspace-selection-modal.modal-large {
    max-height: 80vh;
    min-height: auto;
}

.workspace-selection-modal.modal-extra-large {
    max-height: 95vh;
    min-height: auto;
}

/* Workspace list sizing */
.workspace-list.list-small {
    max-height: none;
    overflow-y: visible;
}

.workspace-list.list-medium {
    max-height: none;
    overflow-y: visible;
}

.workspace-list.list-large {
    max-height: 50vh;
    overflow-y: auto;
}

.workspace-list.list-extra-large {
    max-height: 60vh;
    overflow-y: auto;
}

.workspace-item {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.workspace-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

.workspace-item:hover {
    background: #f1f5f9;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.workspace-item:hover::before {
    transform: scaleY(1);
}

.workspace-item:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.workspace-item-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}


.workspace-item-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    flex: 1;
}

.workspace-item-role {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.workspace-item-role.archimesh-admin {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.workspace-item-role.admin {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.workspace-item-role.user {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.workspace-item-description {
    color: #64748b;
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.4;
}

/* Invited workspace styling */
.workspace-item--invited {
    border: 2px solid #ffa726;
    background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
    cursor: default;
}

.workspace-item--invited:hover {
    transform: none;
    box-shadow: 0 8px 25px rgba(255, 167, 38, 0.2);
}

.workspace-item-invitation-label {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Workspace invitation icon */
.workspace-invitation-icon {
    color: #ff9800;
    margin-right: 0.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Workspace invitation actions container */
.workspace-invitation-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 167, 38, 0.2);
}

/* Workspace invitation buttons */
.workspace-invitation-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.workspace-invitation-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.workspace-invitation-btn:active {
    transform: translateY(0);
}

.workspace-invitation-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.workspace-invitation-btn--accept {
    background: linear-gradient(135deg, #4caf50, #2e7d32);
    color: white;
}

.workspace-invitation-btn--accept:hover:not(:disabled) {
    background: linear-gradient(135deg, #45a049, #1b5e20);
}

.workspace-invitation-btn--decline {
    background: linear-gradient(135deg, #f44336, #c62828);
    color: white;
}

.workspace-invitation-btn--decline:hover:not(:disabled) {
    background: linear-gradient(135deg, #e53935, #b71c1c);
}

/* Confirmation state for decline button */
.workspace-invitation-btn--confirm-decline {
    background: linear-gradient(135deg, #ff9800, #f57c00) !important;
    color: white;
    animation: pulse-confirm 2s infinite;
}

.workspace-invitation-btn--confirm-decline:hover:not(:disabled) {
    background: linear-gradient(135deg, #f57c00, #ef6c00) !important;
}

/* Confirmation state for accept button */
.workspace-invitation-btn--confirm-accept {
    background: linear-gradient(135deg, #ff9800, #f57c00) !important;
    color: white;
    animation: pulse-confirm 2s infinite;
}

.workspace-invitation-btn--confirm-accept:hover:not(:disabled) {
    background: linear-gradient(135deg, #f57c00, #ef6c00) !important;
}

@keyframes pulse-confirm {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
    }
    50% {
        box-shadow: 0 6px 20px rgba(255, 152, 0, 0.6);
    }
}

.workspace-invitation-btn i {
    font-size: 1rem;
}

.workspace-item-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 167, 38, 0.2);
}

.workspace-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.workspace-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.workspace-action-btn--accept {
    background: linear-gradient(135deg, #4caf50, #2e7d32);
    color: white;
}

.workspace-action-btn--accept:hover {
    background: linear-gradient(135deg, #45a049, #1b5e20);
}

.workspace-action-btn--decline {
    background: linear-gradient(135deg, #f44336, #c62828);
    color: white;
}

.workspace-action-btn--decline:hover {
    background: linear-gradient(135deg, #e53935, #b71c1c);
}

.workspace-action-btn i {
    font-size: 1rem;
}

.workspace-action-btn span {
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .workspace-selection-modal {
        width: 95%;
        max-height: 90vh;
    }
    
    .workspace-selection-header {
        padding: 1.5rem;
    }
    
    .workspace-selection-title {
        font-size: 1.5rem;
    }
    
    .workspace-selection-body {
        padding: 1.5rem;
    }
    
    .workspace-item {
        padding: 1rem;
    }
    
    .workspace-item-header {
        gap: 0.75rem;
    }
    
    
    .workspace-item-name {
        font-size: 1.1rem;
    }
    
    /* Mobile responsive adjustments for invited workspaces */
    .workspace-item-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .workspace-action-btn {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }
    
    .workspace-item-invitation-label {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }
    
    .workspace-invitation-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .workspace-invitation-btn {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }
}

/* Loading State */
.workspace-list.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.workspace-list.loading::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State */
.workspace-list-empty {
    text-align: center;
    padding: 2rem;
    color: #64748b;
}

.workspace-list-empty i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #667eea;
}

/* Scrollbar Styling */
.workspace-list::-webkit-scrollbar {
    width: 6px;
}

.workspace-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.workspace-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.workspace-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
